Author Topic: ATMEGA328P-PU UART bootloader suggestion...  (Read 959 times)

0 Members and 1 Guest are viewing this topic.

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
ATMEGA328P-PU UART bootloader suggestion...
« on: November 30, 2019, 09:05:22 am »
Hi All,

I have Arduino UNO R3 board. With the development board, I have demonstrated my project. Now, I want to design a custom board with ATMEGA328P-PU (MCU) and ATMEGA16U2MU-R which act as USB to UART converter in the Arduino board.

Coming to the programming the microcontroller in the Arduino board, from the Arduino IDE, I will just dump the hex which will be received by ATMEGA16U2MU-R that does USB to UART protocol conversion and send it to the ATMEGA328P-PU microcontroller over UART. The microcontroller should have had UART bootloader to flash it's internal memory with the hex received over its UART.

Here, my question is that if I am buying the ATMEGA328P-PU (MCU) from Microchip instead Arduino, the microcontroller will be having the UART bootloader code on the chip (Or) I have to write the UART bootloader code myself. In the case I am writing the bootloader code, Is there any reference code that will help me.

Please suggest.

Thanks and Regards,
Muthu
 

Offline jhpadjustable

  • Frequent Contributor
  • **
  • Posts: 295
  • Country: us
  • Salt 'n' pepper beard
Re: ATMEGA328P-PU UART bootloader suggestion...
« Reply #1 on: November 30, 2019, 09:15:47 am »
MCUs are shipped blank. You can install the standard Arduino bootloader with another Arduino, among other ways. I googled "installing arduino bootloader" and found this: https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader
« Last Edit: November 30, 2019, 09:18:06 am by jhpadjustable »
"There are more things in heaven and earth, Arduino, than are dreamt of in your philosophy."
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: ATMEGA328P-PU UART bootloader suggestion...
« Reply #2 on: November 30, 2019, 10:05:39 am »
The Arduino bootloader is open source (GPL2), and you can install it in any ATmega328p based project that you want (many other types of AVR as well.)  But it is not pre-installed on chips that you buy from Microchip/Digikey/Mouser/etc, so you'll need an actual device programmer to program the chips using the ISP protocols.
Current Arduino Bootloader source is here: https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/optibootAnd a more recent version of the same Optiboot Bootloader (additional features, additional chips, significant documentation) is here: https://github.com/Optiboot/optiboot
(Microchip and other vendors will provide you chips that are pre-programmed with ... whatever code you want.  For a fee.  I haven't actually done this, but it looks like it's pretty reasonably priced (~$0.25/chip from Microchip?))
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: ATMEGA328P-PU UART bootloader suggestion...
« Reply #3 on: November 30, 2019, 12:10:23 pm »
Hi westfw,

Since the optibootloader is GPL2, I don't need to worry much about licensing in the case of my product is going for commercial.

Please let me know it is good to go with Optiboot for the commercial product and how much stable it is.


Thanks
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: ATMEGA328P-PU UART bootloader suggestion...
« Reply #4 on: November 30, 2019, 10:49:40 pm »
Quote
Since the optibootloader is GPL2, I don't need to worry much about licensing in the case of my product is going for commercial.
Please let me know it is good to go with Optiboot for the commercial product and how much stable it is.
Correct.  IMO, it is just a OK to use Optiboot for a commercial product as it is to use linux as the OS for commercial software.  Since Optiboot is completely separate from the application code, it does not "infect" the product as a whole.  If you end up making change to optiboot itself, you should be prepared to make the modified optiboot source available to customers as well (that's what GPL2 says), but it doesn't affect other parts of the product.
If I had been the original author instead of just the maintainer, I wouldn't have used GPL (because I regard GPL as ambiguous for deeply embedded code.)  But the original author attached that license and then disappeared, and changing licenses of abandoned software is ... at best, really tricky.
Arduino itself is a commercial product that uses Optiboot, and I'm sure it doesn't have any special arrangements.
Stability-wise: The Optiboot version running in the Uno has been essentially unchanged since 2011.  The separate Optiboot repository has had more changes, but the "releases" are in pretty good shape (and are well-tracked, and used in the MCUdude and DrAzzy alternative AVR cores.)
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1534
  • Country: au
Re: ATMEGA328P-PU UART bootloader suggestion...
« Reply #5 on: November 30, 2019, 11:55:32 pm »
Why do you need optiboot... why not simply burn the hex file directly with an ISP programer? reduce complexity of your board?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf