Author Topic: AVR- Uploading New firmware on AVR 0 series through UART  (Read 1167 times)

0 Members and 1 Guest are viewing this topic.

Offline sanka1pTopic starter

  • Contributor
  • Posts: 23
  • Country: us
AVR- Uploading New firmware on AVR 0 series through UART
« on: September 20, 2023, 02:55:34 pm »
Hi All,

This is completely new topic for me, I am trying to upload firmware on my Atmega1608, through a UART - USB bridge chip. I have a made a block diagram and pasting it below for better understanding. I know, I would have to make a boot-loader first and flash that boot-loader into Atmega1608, but where should I get started for that. I have seen an application note from Microchip that gives info about UART boot-loader and they also gave a sample boot-loader. Would that be a good starting point? At the end I want to take a hex file generated by my IDE and upload that hex file through USB onto the MCU. One important point to note here is that CH9326 is a HID USB device chip.
« Last Edit: September 20, 2023, 05:59:41 pm by sanka1p »
Using Analog in a Digital world.
 

Offline sgnka

  • Contributor
  • Posts: 13
  • Country: us
Re: AVR- Uploading New firmware on AVR 0 series through UART
« Reply #1 on: September 21, 2023, 07:11:29 am »
I know, I would have to make a boot-loader first and flash that boot-loader into Atmega1608
You don't have to; the 0-series chips can be programmed using a USB-USART bridge over their native UPDI protocol as well using pymcuprog. However, if you actually want to program it without using UPDI or envision having to program it in the field without access to the UPDI pin, then yes, a bootloader is required.

Would that be a good starting point?
Yes, it works well and is simple to understand.

One important point to note here is that CH9326 is a HID USB device chip.
However, the example won't work out of the box with CH9326 (and neither will pymcuprog), since the python script expects a serial device connected to the PC and talks to it using pyserial, while your chip presents a HID interface on the PC. You can modify the script to use the hid library or use a CH340/CP2102/FT232 etc. serial-USB converter. I suggest doing the latter.
« Last Edit: September 21, 2023, 07:14:39 am by sgnka »
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Re: AVR- Uploading New firmware on AVR 0 series through UART
« Reply #2 on: September 21, 2023, 01:13:04 pm »
Isn't that mcu a 2K flash device ?
How much space will a HiD BL take ??


 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: AVR- Uploading New firmware on AVR 0 series through UART
« Reply #3 on: September 21, 2023, 01:31:39 pm »
Atmega1608 is 16KB
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline up8051

  • Frequent Contributor
  • **
  • Posts: 288
  • Country: pl
Re: AVR- Uploading New firmware on AVR 0 series through UART
« Reply #4 on: September 21, 2023, 05:12:55 pm »
It can be very small.
I have my own UART bootloader for ATTiny Series-0.

- simple version  256 bytes
- version with encrypion (AES128)  768 bytes.

 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: AVR- Uploading New firmware on AVR 0 series through UART
« Reply #5 on: September 21, 2023, 09:55:29 pm »
Mine is 3KB with PC1 encryption,
It's used on a 64KB Atmega64A, so I wasn't all that concerned with making it tiny

Loosely based on this bootloader
https://sourceforge.net/projects/avrub/
« Last Edit: September 21, 2023, 10:00:00 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf