Go Down

Topic: NEWER New Optiboot bootloader (Read 108679 times) previous topic - next topic

westfw

Quote
is *A-PU supported by optiboot?
"Probably."
If you're asking about the "A" versions (atmega168-PU vs atmega168a-PU), those are normally indistinguishable (same behavior, same signature, etc - the bootloader and Arduino core SW can't even tell.)  (Alas, not true of many "B" versions ("Atmel, you fool!"))
If you're asking about the part after the dash, that usually indicates package type, and the software doesn't care...

Kashyapkoshti

How to use optiboot with esplink esp01 and arduino mega?

GoForSmoke

"Probably."
If you're asking about the "A" versions (atmega168-PU vs atmega168a-PU), those are normally indistinguishable (same behavior, same signature, etc - the bootloader and Arduino core SW can't even tell.)  (Alas, not true of many "B" versions ("Atmel, you fool!"))
If you're asking about the part after the dash, that usually indicates package type, and the software doesn't care...

The chip has an ID number and Optiboot has an ID table, right? And there's a command-line user override?

Or does the name matter?
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Curie

Hi all,

So I have an ATmega328pb dev board and I have been struggling from quite a long time to start programming it. I am wanting to upload the bootloader but getting errors every time. Also I went through so many posts regarding the same, tried things, but to no avail. I will be really grateful if someone could guide me as to where am I going wrong.

I have an Arduino Uno and an ATmega328pb dev board. I am trying to burn the bootloader onto the dev board using Arduino as ISP. I am using Arduino IDE version 1.8.12 (just upgraded from 1.8.3 two days back) and avrdude version is 6.3. Also the 328pb dev board doesn't have any external crystal/ resonator attached with it, so I am working with its internal  clock only.                                                               I began with MiniCore, could install the board successfully. But somehow I couldn't upload the bootloader using Arduino ISP pins. Currently I am using the package provided by WAtterott (https://github.com/watterott/ATmega328PB-Testing). Everything seems good here, got the board initialized and getting detected by avrdude. But still not able to burn the bootloader.

I am attaching a document regarding the things i have tried and the errors i am getting.

Thanks!

westfw


GoForSmoke

This is a blog on programming AVRs on breadboards that includes internal clock how-to,
https://gammon.com.au/breadboard

See if your errors show up on that page.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Curie

#111
May 04, 2020, 03:25 pm Last Edit: May 06, 2020, 09:18 pm by Coding Badly
Which dev board?

Thank you for your time and hope you are keeping safe :)


It's a custom board. I will attach the schematic for your convenience.
Thanks!





Curie

This is a blog on programming AVRs on breadboards that includes internal clock how-to,
https://gammon.com.au/breadboard

See if your errors show up on that page.

Hi, thank you. Will go through it and let you know.

GoForSmoke

Do the custom boards have socketed AVR's like the Uno?
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

6v6gt

You can program your custom ATmega328pb board using minicore together with an Arduino uno with the ISP sketch so you can, for example, load the blink sketch?
So it is not easy to see why you fail to be able to load optiboot.
The only thing I could suspect is that the resistor to the led on the SCK pin (pb5) is rather strong at 220 ohms. 1k is usual on say a Nano. This may interfere with attempts to program it. That your pdf attachment shows inconsistent device signatures could support that idea.

Curie

You can program your custom ATmega328pb board using minicore together with an Arduino uno with the ISP sketch so you can, for example, load the blink sketch?
So it is not easy to see why you fail to be able to load optiboot.
The only thing I could suspect is that the resistor to the led on the SCK pin (pb5) is rather strong at 220 ohms. 1k is usual on say a Nano. This may interfere with attempts to program it. That your pdf attachment shows inconsistent device signatures could support that idea.
Hi,

Hope you are doing well. Thanks for the reply.
I will take your suggestion and try replacing the resistor at PB5, whenever i get a chance to, or atleast keep that in mind when designing another 328pb custom board.
As i am a newbie, i tried to look through the datasheet as to figure out how did you come to that conclusion, but cannot really understand it. I think it will take a lot more experience on my end to reach that stage :)

Curie

Do the custom boards have socketed AVR's like the Uno?
Hi,

No, the board doesn't have a socketed AVR chip. It has the SMD package of the ATmega328PB.

6v6gt

#117
May 05, 2020, 10:55 am Last Edit: May 05, 2020, 11:06 am by 6v6gt
. . .
As i am a newbie, i tried to look through the datasheet as to figure out how did you come to that conclusion, but cannot really understand it. I think it will take a lot more experience on my end to reach that stage :)
It is not in the data sheet. The most concrete information about shared use of SPI lines, that I can find, is here: http://ww1.microchip.com/downloads/en/appnotes/atmel-2521-avr-hardware-design-considerations_applicationnote_avr042.pdf , although this may not exactly cover your scenario.

However, there is a also lot of anecdotal evidence about the wisdom of keeping clear of the SPI lines when possible to minimise the risk of interference with attempts to program the device, for example: https://www.avrfreaks.net/forum/can-i-reuse-isp-pins-other-taskstarget-atmega164p?skey=reuse%20of%20spi%20lines

As a result of my own experience, I attempt to keep at least 1K away from the SPI lines where possible. I documented some of this here: https://forum.arduino.cc/index.php?topic=673817.0 (post#6 onwards)

GoForSmoke

The minimal breadboard Duino article has chip ID and Nick's programming software that accepts many ID's.

Here's a page with what you may want directly:

http://www.gammon.com.au/bootloader

Quote
This sketch was inspired by the Optiloader sketch written for the Arduino. However it is a total rewrite, in order to accomodate the Mega2560 board, which the original one did not handle, due to the larger address space.

Supported bootloaders

The code for the following bootloaders is incorporated in the sketch, and will be downloaded depending on which signature is detected:

Atmega8 (1024 bytes)
Atmega168 Optiboot (512 bytes)
Atmega328 Optiboot (for Uno etc. at 16 MHz) (512 bytes)
Atmega328 (8 MHz) for Lilypad etc. (2048 bytes)
Atmega32U4 for Leonardo (4096 bytes)
Atmega1280 Optiboot (1024 bytes)
Atmega1284 Optiboot (1024 bytes)
Atmega2560 with fixes for watchdog timer problem (8192 bytes)
Atmega16U2 - the bootloader on the USB interface chip of the Uno
Atmega256RFR2 - the bootloader on the Pinoccio Scout board


You have the option of programming (writing) the bootloader or verifying (checking) the existing bootloader.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

GoForSmoke

It is not in the data sheet. The most concrete information about shared use of SPI lines, that I can find, is here: http://ww1.microchip.com/downloads/en/appnotes/atmel-2521-avr-hardware-design-considerations_applicationnote_avr042.pdf , although this may not exactly cover your scenario.

However, there is a also lot of anecdotal evidence about the wisdom of keeping clear of the SPI lines when possible to minimise the risk of interference with attempts to program the device, for example: https://www.avrfreaks.net/forum/can-i-reuse-isp-pins-other-taskstarget-atmega164p?skey=reuse%20of%20spi%20lines

As a result of my own experience, I attempt to keep at least 1K away from the SPI lines where possible. I documented some of this here: https://forum.arduino.cc/index.php?topic=673817.0 (post#6 onwards)

If you won't be changing the bootloader, already have one then connecting SD won't stop you from changing your sketch.

With 328pb you have an extra UART capable of full speed master-mode SPI, Nick Gammon has the software to do it. You could have Serial RX/TX, ISCP and still have hardware-SPI. Atmel had really good engineers.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up