Programming the tinylily directly via avrdude

jusp · 4 · 717

jusp

  • Newbie
  • *
    • Posts: 3
    • View Profile
Hi, I have been programming my atmega328 processors using an adafruit tinyusb board for a while, and am about to try a tinylily using its mini USB board.
What programmer type should I pass to avrdude? I optimistically tried tinyusb, but got the following error:


sudo avrdude -c usbtiny                         -p m328p -b 115200 -U flash:w:a.hex:a
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 255
    • View Profile
Hello,

This is the command that gets run by the Arduino IDE:
avrdude -v -patmega328p -carduino -PCOM1 -b57600 -D -Uflash:w:a.hex:i

You can test this by following this tutorial https://learn.tinycircuits.com/TinyLily/Processor_TinyLily_Tutorial/ and then going to File->Preferences in the Arduino IDE and checking the boxes for “Show verbose output during: compilation upload” in the window that pops up.

Hope that does the trick! Thanks!


jusp

  • Newbie
  • *
    • Posts: 3
    • View Profile
Yes, that gets me further. I am running on ubuntu, so COM1 does not exist, so tried the following instead:

sudo avrdude -v -patmega328p -carduino   -b57600 -D -Uflash:w:a.hex:i

This gets into the error "avrdude: ser_open(): can't set attributes for device "/dev/ttyS1": Inappropriate ioctl for device", which seems to mean that I am connecting to the wrong device (/dev/ttyS0). At ;east, I get the same error when explicitly trying to connect to other /dev/ttySnn using option -P.

lsusb lists the miniusb board as follows:

Bus 001 Device 018: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)

How can I find out the proper -D option?







jusp

  • Newbie
  • *
    • Posts: 3
    • View Profile
This issue is solved with help from @lennevia (thanks!).

The avrdude command that in the end worked for me on the Ubuntu machine that I am using is as follows:

         sudo avrdude -P /dev/ttyUSB0 -v -patmega328p -carduino  -b57600 -D -Uflash:w:a.hex:i

First, the baudrate is important, 115200 does not work.  Second, to get going I had soldered a programming header on the back pads of the tinylily so that I could program it with an SPI- based programmer. After success with that programmer I overwrote, as I usually do, the processor fuses with the settings that I need. This also reverted the prescaling of the system clock that is programmed into fuse settings by which the tinylilies are shipped. But changing the clock prescaling throws off the baudrate settings in the tinylily's bootloader. So be careful with changing the fuses.
Third, the linux port (/dev/ttyUSB0 in the command above) can be identified by the following shell command after plugging in the programmer cable: "dmesg | grep tty"



 

SMF spam blocked by CleanTalk