Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › Bootloader problem

Pages: 1 2 
Bootloader problem (Read 23214 times)
10/18/10 at 18:25:39

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
Hello!
I got Olimex Atmega128 header board with 16Mhz crystal ans ICSP pinout. So, actually, it should be able to be flashed with Wired bootloader. I'm using AVR Pocker Programmer from Sparkfun and latest WinARV/avrdude. I've tried atmega128 bootloader, atmega128 bootloader with atmega1281 support and atmega128 bootloader with 7 sec delay. I even compiled one myself. And always I got validation error: 0x11!=0xff.
I've tried another bootloader (modified Hitec robonova, wich also uses atmega128, but with diff. crystal), and it flashes and verifies ok.
Tried different speed also. No help.
What could be the problem?
 
IP Logged
 
Reply #1 - 10/18/10 at 18:45:18

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
Update: opened hex files with ponyprog: they all consist of FFFF only.
 
IP Logged
 
Reply #2 - 10/18/10 at 18:52:28

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi, if the processor is atmega128 then you must use the atmega128stk500boot.hex, this bootloader wait for 3 seconds for new code to upload so this is good if the DTR line on the serial (ftdi or other) is attached to the RESET via a 100nF capacitor (this is for the autoreset feature). The other bootloader atmega128stk500boot_7SecondsDelay.hex was for older boards with no autoreset, so it waits for 7 seconds for the user to reset manually the board and upload code.
The other thing are the fuses, you can program them using the atmel avrstudio:
SPI enabled
Boot flash section size = 1024
Boot reset vector enabled
Brown-out detection level 4.0V
Brown-out detection enabled
CKOPT fuse enabled
Ext Crystal 16K CK + 64ms

Also, Wiring doesn't require the 32K XTAL anymore.

Let me know.
 
IP Logged
 
Reply #3 - 10/18/10 at 19:00:22

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
I've checked on the AVR-MT-128 and it should work fine. Just remember the pin mapping for the atmega128
PORTD are wiring pins 0-7
PORTC are wiring pins 8-15
PORTA are wiring pins 16-23
PORTB are wiring pins 24-31
PORTE are wiring pins 32-39
PORTF are wiring analog input pins 0-7 (or digital pins 40-47)
PORTG are wiring pins 48-53

the 32Khz in the original design is NO longer used/needed.

 
IP Logged
 
Reply #4 - 10/18/10 at 19:45:08

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
Thanks for answering!
I dont't have 32Khz crystal there - desoldered it long time ago. Also, I've found out PORT to pins configuration also (but thanks anyway).
I thought if I will not touch fusebits they will be by default. Could it be the problem?
 
IP Logged
 
Reply #5 - 10/19/10 at 03:22:44

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Yes, the fuses I mentioned are not the default on the atmega128 uses, you have to set them first.
 
IP Logged
 
Reply #6 - 10/19/10 at 14:03:39

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
Changed fuses - still error. I've just noticed, that hex file is only 5Kb. I believe it should be bigger?
 
IP Logged
 
Reply #7 - 10/19/10 at 15:11:02

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Please use the hex from the wiring code website.
 
IP Logged
 
Reply #8 - 10/19/10 at 16:13:26

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
I do! I've tried every hex from wiring website. I can't connect my svn client to repository, so downloaded directly. Mabe because of that error appears?
Could you, please attach it here?
 
IP Logged
 
Reply #9 - 10/19/10 at 23:56:24

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
I can't attach files send me an e-mail and I will send you the file. The only bootloader that work with your board is the atmega128stk500boot.hex or the atmega128stk500boot_7SecondsDelay.hex, it has to be flashed (loaded in the Flash memory) and setup the fuses accordingly.
I've tested svn co svn://aeon.uniandes.edu.co/wiring/trunk/wiring and it works well, it should get you a copy of the whole source tree.
What is the error you're getting? How are you programming the fuses?
 
IP Logged
 
Reply #10 - 10/20/10 at 04:31:11

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
Hooray! Finally, I was able to flash it. Bootloader - atmega128stk500boot.hex, programmer - AVR Pocket Programmer from Sparkfun (usbtiny actually).
Verification error was on 0x1f800 (nt sure I'm right, don't have it near me at the moment), It's code beginning actually.
Avrdude wasn't able to deal with this error even when I've chosen atmega 1280 or 1281.
Later I found way to use AVRStudio with usbtiny (on ladyada website, you'll need few apps to connect usbtiny and AVRStudio).
I programmed fusebits with AVRStudio, all as you sad, barragan.
Tried to flash - somekind or error appeared (atmega128 was chosen in options).
Changed atmega128 on atmega1281 in AVRStudio connection options and, tada!, I'm able to flash my atmega128 from it and it verifies!
Will try to load some code today to check if it flashed properly.
barragan, thanks for the help with fuses!

P.S. but still no luck with avrdude)))
 
IP Logged
 
Reply #11 - 10/20/10 at 20:42:18

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
great, what is the problem with avrdude? Remember if your olimex board doesn't have the auto-reset (serial DTR connected to RESET) you need to press the olimex board reset switch just right after pressing the upload button on the Wiring environment. By pressing the reset button the bootloader gets ready to receive the new code from the Wiring software.
« Last Edit: 10/20/10 at 23:58:07 by barragan »  
IP Logged
 
Reply #12 - 10/21/10 at 05:20:18

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
No idea what the problem:) I don't mind until I can use AVRStudio:) Anyway, I have to chose atmega1281 to be able to flash board.

Olimex board does not have reset button. I've connected reset leg of atmega to dtr via capacitor (around 270 nF, the smallest I have at the moment). It works.
The other problem appeared is that I'm using Inex UCON232S USB to Serial Converter (based on ft232R chip). It appears as com2 in system. I setup Wiring Software, choose atmega128, firmware v.2 and com2. But all stucks on Uploading. Wiring compiles .hex file, starts avrdude, avrdude send something out, but receives no answer from atmega128.
First, I've connected UCON232S and atmega as on Wiring board scheme to legs num 2 and 3. No effect. In wiring mini board description says we should use pins 32, 33.  Tried that ones - no effect again.
Thinking on that yet.
Tried to flash hex directly through avrstudio (used LED blink tutorial code) - and it works, LED turns on/off according to timing specified.
But Wiring does not connect to board itself, don't know why yet.

P.S. Could it be serial port speed issue?
 
IP Logged
 
Reply #13 - 10/21/10 at 05:51:32

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
yes it might be related to speed, for the bootloader is 115200, but there is no chance for it to work flashing it as an atmega1281 since your chip is the atmega128. Let me know.
 
IP Logged
 
Reply #14 - 10/21/10 at 08:27:28

SAzabi   Offline
YaBB Newbies

Posts: 10
*
 
But it does flash as atmega1281. And it does not as atmega128. On the chip it signed as atmega128. Don't know why that so.
The main problem now is to connect Wiring software and board.
Btw, which atmega128 pins should I connect to RX/TX on ftdi chip? 32/33 as in Wiring Mini descriptio or 2/3 as in "big" Wiring board scheme?
 
IP Logged
 
Pages: 1 2