Problems burning bootloader

What is a Uzebox? How can I get one? Check here!

Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 10:21 am

Hi all!

I have designed my own UZEBOX version, assembled it and now I'm trying to burn the bootloader. I'm new to AVR microcontrollers, and I'm trying to burn the hex file using avrdude and Olimex USB-AVR-JTAB. I made an adapter from 10 pin AVR JTAG to 6 pin AVR ISP. I plug the programmer, power up the board and try to burn the file in the command line without success:

Code: Select all
C:\Documents and Settings\URuser\Escritorio\UZE\avrdude-5.4-win>avrdude -p m644 -c stk500 -P COM2 Bo
otloader_0_2.hex
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout


Is this emulator compatible? Any tutorial about burning files with this emulator?
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby uze6666 » Tue Apr 19, 2011 2:32 pm

This JTAG programmer does not seem to support the ISP interface at all. And you can't use JTAG with the Uzebox design because the pins are used by the video port! Unless someone knows better, you will need to get an ISP programmer like this one.

Post some pics when you done eh!? :)

-Uze
User avatar
uze6666
Site Admin
 
Posts: 2672
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada

Re: Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 3:43 pm

Has anybody tested this programmer?

Image
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 6:50 pm

Also, how can I select the right fuses to burn using avrdude?
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby uze6666 » Tue Apr 19, 2011 7:58 pm

Personally, I never used AVRDUDE to program fuses. However, be sure you flash the right ones, or you will brick you chip, specially if it's SMT!
User avatar
uze6666
Site Admin
 
Posts: 2672
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada

Re: Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 8:00 pm

I have built STK200 simplified programmer by elm-chan:

http://elm-chan.org/works/avrx/stk.png

Then I have burned Megatris.hex using AVRSP I have burned Megatris.hex:

Code: Select all
avrsp -pl1 Megatris.hex


It has successfully completed the write and verify steps, so code should be correctly burned... but it looks it isn't. When I power my Uzebox up, I get no video, and only beeps in the audio signal.

Can it be because of the fuses? How can I make sure fuses are properly set?

EDIT:

Reading Fuses gives me the following output:

Code: Select all
D:\Usuarios\doragasu\Escritorio\avrxtool32\bin>avrsp -pl1 -RF
STK200 ISP dongle was found.
Detected device is ATmega644.

Low: 01100010
     ││││└┴┴┴── CKSEL[3:0] Clock source selection
     ││└┴── SUT[1:0] Startup time
     │└── CKOUT (0:Output system clock on the CLKO pin)
     └── CKDIV8 Clock division ratio (1:1/1, 0:1/8)

High:10-11001
     │││││││└── BOOTRST *Refer to data sheet
     │││││└┴── BOOTSZ[1:0] *Refer to data sheet
     ││││└── EESAVE (Retain EEPROM at chip erase 1:No, 0:Yes)
     │││└── WDTON (1:WDT normal, 0:WDT always on)
     ││└── SPIEN (1:Disable ISP, 0:Enable ISP) *Available only in Parallel mode
     │└── JTAGEN (1:Disable JTAG, 0:Enable JTAG)
     └── OCDEN (On-Chip Debugging via JTAG 1:Disable, 0:Enable)

Ext: -----111
          └┴┴── BODLEVEL[2:0] (111:Disabled, 110:1.8V, 101:2.7V, 100:4.3V)

Cal: 155
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 8:33 pm

Burned using avrdude with the same results:

Code: Select all
D:\Usuarios\doragasu\Escritorio\avrxtool32\bin>avrdude -p m644 -c stk200 -P lpt1
-U flash:w:Megatris.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9609
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 "Megatris.hex"
avrdude: input file Megatris.hex auto detected as Intel Hex
avrdude: writing flash (62852 bytes):

Writing | ################################################## | 100% 24.75s

avrdude: 62852 bytes of flash written
avrdude: verifying flash memory against Megatris.hex:
avrdude: load data flash data from input file Megatris.hex:
avrdude: input file Megatris.hex auto detected as Intel Hex
avrdude: input file Megatris.hex contains 62852 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 23.54s

avrdude: verifying ...
avrdude: 62852 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


I suppose it's because of the fuses. Is it documented how to burn the fuses using avrdude or avrsp?
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby doragasu » Tue Apr 19, 2011 9:05 pm

I have burned the bootloader v 0.2 with these fuses I found searching in the forum:

Code: Select all
-U efuse:w:0xFE:m
-U hfuse:w:0xD2:m
-U lfuse:w:0xFF:m


Plugged the board, turned the monitor on and...

BINGO!!! The bootloader menu has greeted me!!!

The colors are too dark, but it may be because the SEGA Megadrive/Genesis cable I'm using has 75 ohm serial resistors in the RGB lines. I'm also using a CPC6128 (a 8 bit computer famous in Europe) monitor, and maybe it wants greater voltage levels. Tomorrow I'll try plugging my unit to a TV and removing the 75 Ohm resistors in the cable.

Also I'll post some photos of my board.

But first I have to sleep a bit!

Thanks!
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Re: Problems burning bootloader

Postby uze6666 » Tue Apr 19, 2011 9:17 pm

Congrats! :mrgreen: I was just about to post about the fuses settings so glad you found them. I'll try making mention of them at a few places (like the schematic) to make things easier. Could you post the avrdude command you used to program the fuses? I'll add it to the WIKI.

I recall someone mentioned a dim picture and removed the 75ohm resistor to solve the problem (think that was for the B/W minimal Uzebox).

Uze
User avatar
uze6666
Site Admin
 
Posts: 2672
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada

Re: Problems burning bootloader

Postby doragasu » Wed Apr 20, 2011 6:59 pm

I have done some more tests and everything is working! The gamepad ports work, sound is perfect and the SD card also works.

But not everything shines... the color is a bit dark (even removing the serial 75Ohm resistors) and even worse, I'm missing graphics from the left of the screen. Tetris for example is unplayable because the leftmost block is not visible.

¿Is there a way to fix this? Maybe adding capacitors in the RGB lines?

Regarding the command, I'm a total noob when talking about AVR microcontrolles (I have used PIC, MSP430, C8051 and ARM, but never AVR) so the way I used to burn fuses maybe is not the best. I used 4 commands, and maybe it can be done with fewer (I suppose one or two). My way:

Code: Select all
avrdude -p m644 -c stk200 -P lpt1 -U flash:w:Bootloader_v2.hex
avrdude -p m644 -c stk200 -P lpt1 -U efuse:w:0xFE:m
avrdude -p m644 -c stk200 -P lpt1 -U hfuse:w:0xD2:m
avrdude -p m644 -c stk200 -P lpt1 -U lfuse:w:0xFF:m


Of course, you have to change lpt1 and stk200 with the right port and programmer. Sometimes I had to power cycle the board between commands. I don't know if it's a problem of my improvised programmer or maybe it's because of the procedure.

I have tried to attach the schematic, but the forum errors every time I try it...
doragasu
 
Posts: 28
Joined: Fri Apr 01, 2011 10:42 am

Next

Return to New to Uzebox? Start here!

Who is online

Users browsing this forum: No registered users and 0 guests

cron