Go Down

Topic: [Help needed] compiling and installing optiboot on Linux for UNO R3 problem (Read 197 times) previous topic - next topic

otto001

Hi,

I am pretty new to arduino bootloaders.
Nevertheless I am having issues with my W5100 shields and UNO R3, and I think a changed bootloader could fix this problems... (see here http://forum.arduino.cc/index.php?topic=322325.15)

I am using a Fedora 22 (64bit) box with the avr-packages installed (avr-gcc version 4.9.2), I have downloaded the recent arduino IDE-version (1.6.5) and I downloaded the recent optiboot files from github. I noticed that the avr-gcc version of arduino IDE is 4.8.1 - I assume, this should not be a problem?

I am issuing the following comand for make:
Code: [Select]
make LED_DATA_FLASH=1 LED_START_FLASHES=3 LED=B0 BAUD_RATE=115200 atmega328 -d > tt.txt
What gives me on stderr:
Code: [Select]
In file included from optiboot.c:247:0:
/usr/avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>." [-Wcpp]
 #warning "This file has been moved to <util/delay.h>."
  ^
optiboot.c:305:6: warning: #warning BAUD_RATE error greater than 2% [-Wcpp]
     #warning BAUD_RATE error greater than 2%
      ^

I have attached the file tt.txt which contains the stdout of the command.

optiboot_atmega328.lst and optiboot_atmega328.hex are generated

Then I use the following command to burn the files using a USBtiny:

Code: [Select]
avrdude -c usbtiny -p m328p -U flash:w:optiboot_atmega328.hex -vv
This gives me:
Code: [Select]
avrdude: Version 6.1, compiled on Aug 16 2014 at 00:04:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 005:007
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 95]
Reading | #################                                  | 33% 0.01sCMD: [30 00 02 00] [00 30 00 0f]
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
CMD: [50 00 00 00] [00 50 00 ff]
CMD: [50 00 00 00] [00 50 00 ff]
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode: lfuse reads as FF
CMD: [58 08 00 00] [00 58 08 de]
CMD: [58 08 00 00] [00 58 08 de]
CMD: [58 08 00 00] [00 58 08 de]
avrdude: safemode: hfuse reads as DE
CMD: [50 08 00 00] [00 50 08 fd]
CMD: [50 08 00 00] [00 50 08 fd]
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode: efuse reads as 5
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
CMD: [ac 80 00 00] [00 ac 80 00]
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 ac 53 00]
avrdude: reading input file "optiboot_atmega328.hex"
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 0.00s

CMD: [4c 3f 00 00] [e0 4c 3f 00]
CMD: [4c 3f 40 00] [01 4c 3f 40]
CMD: [4c 3f 80 00] [e9 4c 3f 80]
CMD: [4c 3f c0 00] [06 4c 3f c0]
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against optiboot_atmega328.hex:
avrdude: load data flash data from input file optiboot_atmega328.hex:
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: input file optiboot_atmega328.hex contains 32768 bytes
avrdude: reading on-chip flash data:

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

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

CMD: [50 00 00 00] [06 50 00 ff]
CMD: [50 00 00 00] [00 50 00 ff]
CMD: [50 00 00 00] [00 50 00 ff]
avrdude: safemode: lfuse reads as FF
CMD: [58 08 00 00] [00 58 08 de]
CMD: [58 08 00 00] [00 58 08 de]
CMD: [58 08 00 00] [00 58 08 de]
avrdude: safemode: hfuse reads as DE
CMD: [50 08 00 00] [00 50 08 fd]
CMD: [50 08 00 00] [00 50 08 fd]
CMD: [50 08 00 00] [00 50 08 fd]
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK (E:05, H:DE, L:FF)

avrdude done.  Thank you.


Looks good to me.
Then I connect the UNO to power using the USB from my PC.
The only thing that happens is, that the ON and L LEDs of the UNO are burning red. No flashing, nothing else.

Can anyone help me please?

Thanks and regards,

Otto





DrAzzy

You should not have to build your own bootloader to make the board work - just use the one that's included with the IDE.

Why do you suspect that you need to change the bootloader on the board to make an ethernet shield work?
ATtiny core for 841+1634+828  http://goo.gl/6fRf8e
ATtiny core for x4/x5/x61/x7/x8 series http://goo.gl/O5Wtyu
ATtiny 841/1634/828/88/861/167 breakouts, mosfets, touch sensors and prototyping board in my store http://goo.gl/xyUN2v

otto001

As mentioned in the NEW optiboot thread, I am having a strange problem with my chinese W5100 shields.
Every time the arduino gets power, the sketch does not load, I have to press reset first, then the sketch loads fine.
I also tried to insert a delay(1000) into setup() of the sketch, tried different arduinos and W5100 shields and different sketches as well. Nothing helped. So westfw suggested to try a small adaption of optiboot.c

Anyway, I am curious how stuff works ;-)

DrAzzy

If westfw said to do it, do what he says ;-)

What was the change to optiboot?

What pin is the LED on? With that compile command, it has the LED on pin B0 (arduino pin 8); the LED is normally on pin B6 (arduino pin 13). But maybe that's what you want?
ATtiny core for 841+1634+828  http://goo.gl/6fRf8e
ATtiny core for x4/x5/x61/x7/x8 series http://goo.gl/O5Wtyu
ATtiny 841/1634/828/88/861/167 breakouts, mosfets, touch sensors and prototyping board in my store http://goo.gl/xyUN2v

westfw

As DrAzzy asks: why are you setting the LED to B0?  Are you working with an actual Uno board, or something else?
In general, you should use as few make options as necessary.  Since you've changed the sources and want an Uno bootloader, you should be able to get by with just "make atmega328"...

(I know I've asked for debug info, but "-d" given to make isn't useful to me because I don't understand any of it :-( )

I've built of a Fedora22 VM and added avr-gcc/etc, and download/expanded the optiboot .zip file from github, so I should be working with the same things you have.  However, your log says:

Quote
avr-size optiboot_atmega328.elf
Live child 0x1993150 (optiboot_atmega328.elf) PID 16102
   text       data        bss        dec        hex    filename
    504          0          0        504        1f8    optiboot_atmega328.elf
Whereas I am seeing:

Quote
avr-size optiboot_atmega328.elf
   text       data        bss        dec        hex    filename
    464          0          0        464        1d0    optiboot_atmega328.elf
Which is a pretty substantial difference.  Have you still got other differences in there?
Still working on getting the Fedora VM to recognize my FTDI connection :-(

westfw

Well, the FTDI showed up long enough to program the modified bootloader on a 328 in an old FTDI-based board, and it seems to work as expected, both WRT to uploading and to changed power-on behavior.  (I might, um, be having trouble finding my actual Uno boards...)

FTDI connectivity to the Fedora system was "flakey"...


otto001

Hi,

THANK you for your help!
I just managed it :-)
Re-downloaded the recent files from github, compiled with make atmega328, just changed the baudrate and burned the bootloader using
Code: [Select]
avrdude -c usbtiny -p m328p -D -U flash:w:optiboot_atmega328.hex -vv

The strange thing:

My firmata-sketch does not work any more, no matter if I press reset after power on or not...
I have to investigate further. It is also NOT running with the hex-file from arduino 1.6.5 IDE - there seems to be a difference in the pre-flashed bootloader.... strange

And yes: I am using an actual UNO R3 board from ali****

Will investigate further and contact the seller, which bootloader they used...

dmjlambert

What parameters did you use to compile Optiboot (baud rate, LED, etc.)?

DrAzzy

Hi,

THANK you for your help!
I just managed it :-)
Re-downloaded the recent files from github, compiled with make atmega328, just changed the baudrate and burned the bootloader using
Code: [Select]
avrdude -c usbtiny -p m328p -D -U flash:w:optiboot_atmega328.hex -vv

The strange thing:

My firmata-sketch does not work any more, no matter if I press reset after power on or not...
I have to investigate further. It is also NOT running with the hex-file from arduino 1.6.5 IDE - there seems to be a difference in the pre-flashed bootloader.... strange

And yes: I am using an actual UNO R3 board from ali****

Will investigate further and contact the seller, which bootloader they used...
Many of the boards sold as Uno R3 (particularly from aliexpress/ebay - it's okay to link to product pages here, you don't need to * out the names) are not Uno R3's - they use a CH340G instead of the 16u2 for serial (if you never plan to reprogram the 16u2, I'd take a ch340g over 16u2, no question) - but this is a detail.

If you unplug the W5100 shield does it work? Do you have a link to details (specs, pictures, schematic, etc) on the shield which causes these problems?
ATtiny core for 841+1634+828  http://goo.gl/6fRf8e
ATtiny core for x4/x5/x61/x7/x8 series http://goo.gl/O5Wtyu
ATtiny 841/1634/828/88/861/167 breakouts, mosfets, touch sensors and prototyping board in my store http://goo.gl/xyUN2v

otto001

As mentioned, I just did a "standard" make: make atmega328

This is the UNOs I have: http://www.aliexpress.com/item/1PCS-Tower-Pro-9g-micro-servo-for-airplane-aeroplane-6CH-rc-helcopter-kds-esky-align-helicopter/32340815424.html

And I am using those W5100 shields: http://www.aliexpress.com/item/UNO-Shield-Ethernet-Shield-W5100-R3-UNO-Mega-2560-1280-328-UNR-R3-only-W5100-Development/1571438805.html

I have to check if something works without the shield, I am not at home right now. But The standard sketch I am using, does not what it uses to do with the pre-loaded bootloader. Would it be helpful if I upped the sketch as well (anyway I am using different sketches, eg one for the ethernet gw from mysensors.org)

otto001

Hmm.... seems that anything without this W5100 shield is working...
strange.... I am trying with the untouched optiboot from github...
I am a little bit helpless and confused.... :-(
Only the Power LED and the L-LED are burnig on the shield. With the delivered firmware mostly all of the LEDs are on/blinking?!?!

otto001

@DrAzzy: The product description says: high quality UNO R3 MEGA328P CH340 CH340G for Arduino UNO R3 + USB CABLE
So they are using a CH340G instead of a 16u2. Could this cause the problems?

otto001


Go Up