Uploading a .hex file using avrdude not in sync er

Hi,

I am trying to generate a composite video black and white test card with text for Amateur Television.

I know this has been done on the Mega8 and is available as a stand alone or a shield to enable video out on an existing board.

I would however like to dedicate my Arduino Duemilanove board with and ATMEGA328 to the task.

The original was written in C and not using processing/arduino enviroment. I can upload to my board in processing/arduino but I cannot compile the C files supplied.(I dont know how) I also have not found a way to download the completed hex file provided to my board using the USB lead that comes with the duemilanove unit.

I spent ages trying different things. The closest I got is to

avrdude -p atmega328p -c stk500 -P COM9 -U flash:w:TellyMate_M328p.hex

The original batch file provided did not use the stk500 so I changed that. I also set my usb driver to com9 and put com9 in the settings.

The error I now get is stk500_getsync() : not in sync: resp=00x00

When I run avrdude the rx light flashed 3 times and the original program (blink) continues to run.

The main questions I have are:

  1. What is the easiest/best way to upload a hex file to an ATMEGA328 on a Arduino Duemilanove? (I tryed some GUI avrdude programs to no avail) (I tryed overwritting the Arduino hex file but it re-writes it just before upload)

  2. Is STK500 correct above?

  3. Is COM9 correct above or should I used USBxx? (I am running WinXP)

Note:programming the chip with arduino/processing works OK

Thanks in advance for your time and help. Dan from Ireland :-/

The Mega8 version is here:

The software compiled to work with the ATMEGA328 in the form of a hex file can be found here:
http://www.batsocks.co.uk/downloads/code_tm_114.zip

Hi Dan,

in order for the upload to work the Arduino Board must be reset immediately before the upload. You may want to read this http://johanneshoff.com/arduino-command-line.html for more details.

Cheers, Udo

OK. I have made much progress (after 5 hours) but it is still not working. However it is now talking to the board (tx and rx lights flashing)

The main changes I made are:
Force baud rate to 57600 (needed for duemilanove ATMEGA 328 bootloader)

Changed from STV500 to Arduino

Manually pressed onboard reset button about 1 second before downloading.

However I now get the following respose:


avrdude -b 57600 -p atmega328p -c arduino -P COM9 -U flash:w:TellyMate_M328p.hex

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e950f => ATmega328P (m328p)
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

To disable this feature, specify the -D option.
avrdude: erasing chip

avrdude: reading input file "TellyMate_M328p.hex"
avrdude: input file TellyMate_M328p.hex auto detected as Intel Hex
avrdude: writing flash (32716 bytes):
Writing | ################################################## | 100% 15.36s
avrdude: 32716 bytes of flash written

avrdude: verifying flash memory against TellyMate_M328p.hex:
avrdude: load data flash data from input file TellyMate_M328p.hex:
avrdude: input file TellyMate_M328p.hex auto detected as Intel Hex
avrdude: input file TellyMate_M328p.hex contains 32716 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 13.92s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7800
0x00 != 0x0c
avrdude: verification error; content mismatch
avrdude: Check to make sure Fuses are still correct.
avrdude: safemode: Fuses OK
avrdude done. Thank you.

So I am getting a verification error. When I reset the board afterwards the old program (blink) is gone so something must now be in the flash. I can still download blink using the arduino program. As I am using the onboard USB and the chip has a bootloader installed should I be using the ICSP instead? (I dont have an ICSP lead).

Has the program gone in ok? The bootloader is still there. Is that a problem?

The original hex file was designed without a bootloader in mind. It is 86KB in size. Can a bookload and the hex file fit?

Help me someone :cry:

How do I get verification to pass?

For those making their own version of a TellyMate, the default compiled version of v.1.0.14 of the TellyMate code will no longer upload onto a chip with a bootloader - v1.0.14 introduced re-flashable fontbanks which necessitated use of the bootloader memory space.

To get V1.0.14 onto a 328 with a bootloader, a couple of small changes are needed to the makefile (documented therein) before recompiling...

  • remove the 'reprogrammable fonts' functionality
  • reduce the number of fontbanks to 10

Dan, since you're not au-fait with makefiles and the likes, PM me, and I'll send you a bootloader friendly M328p version of 1.0.14.

In the mean time, the .hex file in release v.1.0.11 should work fine on a M328p with a bootloader.

Thanks condemned. I knew I was doing something wrong!!

Actually before I read your post I think I got it going. I installed over the bookloader using an ICSP design found here:
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html

Using an arduino duemilanove this enabled me to insert a few jumpers and covert the USB port to do ICSP!

This enabled me to remove the bootloader and get it working (I think it is working but I dont have resistors and diodes to hand to check it!

I also think I figuired out what connections I need to set the mode to PAL and where to connect the diodes etc:


Grounding enables option

PC0 ADC0 J1 Baud rate selection
PC1 ADC1 J2
PC2 ADC2 J3
PC3 ADC3 J4 Auto Line Overflow
PC4 ADC4/SDA J5 Auto LF on CR
PCS ADC5/SCL J6 PAL/NTSC selection

So PCS MUST be held low for NTSC

J3 J2 J1 Baud Rate
Off Off Off Autobauding
Off Off On 300
Off On Off 1200
Off On On 4800
On Off Off 9k6
On Off On 19k2
On On Off 38k4
On On On 57k6

So for Arduino Duemilanove connected analogue in 5 to ground (pal enable)
Connect RX (0) to Digital 8 (serial data in)
Digital 9 goes to 1N4148 and 1K resistor then to video out
Digital 11 goes to 1N4148 and 330R resistor then to video

Data is then set from PC hyperterminal to Com9 (via USB) with autobauding


I am hoping to use this as an Amateur Television test card with callsign display so once I get it working I'll probably be back asking for more help!

I have ordered a shield from batsocks so they may get a few quid from me anyway!

Thanks for all your help guys. ;D

I'd sort of guessed that the order I'd got from Dan in Ireland was 'Dan IRL'! :slight_smile: - I'm just about to post it...

A chap called 'Pixelfrenzy' has posted a great summary on Flickr on wiring up a TellyMate on a spare Arduino.

er yeah that was me... Thanks condemned/nigel/keith/whichever brother you are! :slight_smile:

I meant to document all of this back in the summer but never got round to it...

I was using the hacked version of avrdude supplied with Luminet version of Arduino IDE, which has/had bitbang-based .hex file programming built-in. LumiNet: An organic illumination network - Media Computing Group - RWTH Aachen University

I use a mac and at the time (this might still be true) there was an issue with the Mac FTDI driver, since it uses VCP and avrdude doesn't like this. (thanks to René Bohne for help with this!)

From what I can gather looking at the scant documentation I made, I ended up resorting to running windows under parallels, and using the windows version of the avrdude distributed with Luminet like this:

C:\luminet\Windows\hardware\tools\avr\bin> avrdudeFTDI -C ../etc/avrdudeFTDI.conf -v -v -v -v -pm168 -cdiecimila -Pft0 -B4800 -e -Uefuse:w:0x01:m -Uhfuse:w:0xdf:m -Ulfuse:w:0xff:m

C:\luminet\Windows\hardware\tools\avr\bin> avrdudeFTDI -C ../etc/avrdudeFTDI.conf -v -v -v -v -pm168 -cdiecimila -Pft0 -B4800 -e -U flash:w:TellyMate_M168.hex

The first one sets the fuses, while the second one burns the hex file. I got the fuse values from the batch file M168_program_all.bat on the batsocks website. I guess you can do something similar for non-168 based arduinos.

In terms of wiring I used the common hack at http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html including soldering a 4-way header onto the board.

caveat: this info is now a whole 5 months old and so could be hideously outdated by now...

cheers,

pixelfrenzy/mungbean/chris

To uploade the hex file you can use this program:
http://xloader.russemotto.com Its point and click