Go Down

Topic: Smaller bootloader on 8U2 (Read 1 time) previous topic - next topic


Hi. Does anyone have any advice on freeing up space on the Uno's ATmega8U2 by using a smaller bootloader? I have implemented the LUFA keyboard HID on the Uno's 8U2, but LUFA occupies about 4K and the remaining 4K is reserved for the bootloader, so there is no room to add any extra code.
Thanks,
Henry

P.S.
This is effectively the same question as in my earlier post today entitled "LUFA fills ATmega8U2's 4K of flash" (http://arduino.cc/forum/index.php/topic,56287.0.html) but that post received no replies whatsoever, I think it was too long-winded, so this post is more concise (which is a metaphor for my question).

MobileWill



Hi. Does anyone have any advice on freeing up space on the Uno's ATmega8U2 by using a smaller bootloader? I have implemented the LUFA keyboard HID on the Uno's 8U2, but LUFA occupies about 4K and the remaining 4K is reserved for the bootloader, so there is no room to add any extra code.
Thanks,
Henry

P.S.
This is effectively the same question as in my earlier post today entitled "LUFA fills ATmega8U2's 4K of flash" (http://arduino.cc/forum/index.php/topic,56287.0.html) but that post received no replies whatsoever, I think it was too long-winded, so this post is more concise (which is a metaphor for my question).



You could get a AVR programmer and skip the bootloader all together. You would program it with the ISCP header pins instead of USB/Serial.
Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com


Thanks very much MobileWill, that sounds like a perfect solution.

I understand that ICSP can be used to program the Uno's main ATmega328, but are you sure that it can also be used to program the ATmega8U2?

Thanks,
Henry

MobileWill

I am fairly certain, but someone else might what to chime in.

Everything I Googled, I don't see why not.
Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

retrolefty



Thanks very much MobileWill, that sounds like a perfect solution.

I understand that ICSP can be used to program the Uno's main ATmega328, but are you sure that it can also be used to program the ATmega8U2?

Thanks,
Henry



There are two seperate ICSP 6 pin connetor locations on a Uno board. The one populated with a 6 pin IDC 2x3 male pins is for the 328 chip, and only free pad holes are provided for the 8U2 ICSP port, so you have to install pins to access ICSP for the 8U2.

I don't own a Uno so I'm not up to speed on the 8U2 chip. Does it really contain a bootloader? I don't see why it would need one?

Lefty


dhunt

Hi Henry,

I've done the same thing to build Keyboard HID firmware for the UNO, and found it was very tight on space.  (See details and source here: http://hunt.net.nz/users/darran/blog/).

I was able to claim some space back from LUFA by adding the following LUFA_OPTs:
-D NO_DEVICE_SELF_POWER -D NO_DEVICE_REMOTE_WAKEUP -D NO_INTERNAL_SERIAL.

Hope that helps.

Cheers,
Darran.


Hi, and thank you very much for your replies. I will now get an AVR programmer and try to program the 8U2 via its ICSP interface, and completely exclude the bootloader.

Does anyone have any advice on how to solder a 6 pin header onto the 8U2's ICSP pads on the Uno? I can't tell if the pads are actually through-holes filled with solder, or if the there are no holes in the board and I'll have to surface-mount the header.

Also, any thoughts on the best AVR programmer to use? I know an Arduino can do it, but I do not have a second Arduino. The USBtinyISP (http://www.ladyada.net/make/usbtinyisp) seems functional and low cost.

Darran, thanks for your reply here and on the other thread. I'll certainly try those LUFA compile options, and 196 bytes is a lot, though I suspect that it will probably not be enough for my requirements.

Thanks,
Henry

MobileWill

Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560

http://mobilewill.blogspot.com

stimmer

The ICSP pads are through-hole. It helps if you have a solder sucker to get the solder out of the holes. (I also drilled the remaining solder out of the hole with a 0.7mm drill. Whether you need to do this depends on how big the pins you are soldering in are. If you do, be sure to carefully blow all the solder dust away as it can get under the 8u2 pins and cause a short)

I soldered in a female socket rather than the normal male pins. The reason is that there are 3 pins on the header that can be used like Arduino pins and so can be used for I/O and bit-banging, and with a female header it is easier to put wires in the holes. And it can be turned into a normal male header simply by inserting a 2x3 male pin header.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

Stimmer, thanks very much for that great advice. What programmer hardware and PC software do you use to program the 8U2? I'd be very happy to use SparkFun's programmer with AVRDUDE, as recommended by MobileWill (thanks MobileWill), but I haven't confirmed that AVRDUDE supports the 8U2 (see my other post http://arduino.cc/forum/index.php/topic,56392.0.html).

stimmer

With avrdude it's usb82 and you need -F

I've only ever used the FTDI bit-bang programmer or another Arduino (another reason for the female socket), I keep meaning to buy a proper programmer but never get round to it.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

CBlair

Stimmer, do you use another Arduino running ArduinoISP to program the 8u2 chip? It doesn't seem like this would be possible since in the Arduino IDE there's no option to select an 8u2 chip as the target board. Any tips would be helpful :)

Go Up