This repository contains the MPLAB X projects for a basic bootloader compatible with AVR-DA family, a host application and the flashing environment (Python™ scripts) used to upload the application image into the microcontroller's memory, as described in AN3341 - Basic Bootloader for the AVR MCU DA (AVR-DA) Family Application Note from Microchip.
More details and code examples on the AVR128DA48 can be found at the following links:
- AN3341 - Basic Bootloader for the AVR MCU DA (AVR-DA) Family
- AVR128DA48 Product Page
- AVR128DA48 Code Examples on GitHub
- AVR128DA48 Project Examples in START
- MPLAB® X IDE 5.30 or newer (microchip.com/mplab/mplab-x-ide)
- AVR-GCC Compiler v5.4.0 (AVR 8-bit Toolchain v3.62)
- AVR-Dx 1.0.18 or newer Device Pack
- Python™ 3.7.0 or newer (python.org)
- AVR128DA48 Curiosity Nano (DM164151)
The AVR128DA48 Curiosity Nano Development Board is used as test platform.
In order to upload the application image follow this steps:
-
Connect the board to the PC.
-
Check the COM port the AVR128DA48 Curiosity Nano was connected to by opening Device Manager in Windows®:
-
Open in MPLAB X the two projects:
- avr128da48-cnano-avr-da-bootloader.X
- avr128da48-cnano-avr-da-host-app.X
-
Set avr128da48-cnano-avr-da-bootloader project as main project
-
Clean and build the Bootloader project: right click on avr128da48-cnano-avr-da-bootloader project and select Clean and Build
-
Clean and build the Host App project: right click on avr128da48-cnano-avr-da-host-app project and select Clean and Build
-
Program avr128da48-cnano-avr-da-bootloader project to the board.
-
Browse to scripts folder and open for editing SerialUpload.bat file. The python command has the following format:
python AVR-DA_uploader.py {path_to_hex_file} {flash_max_size} {COM_port} {baud_rate}
The parameters are:
{path_to_hex_file}
- path to the executable file to be flashed, including its path{flash_max_size}
- maximum size of the flash in hexadecimal value{COM_port}
- the COM port where the AVR128DA48 Curiosity Nano is attached to{baud_rate}
- the baud rate of the serial communication
Note: For the current implementation, the baud rate for serial communication is configured in code as 9600.
-
Replace {path_to_hex_file}, {flash_max_size}, {COM_port}, {baud_rate} fields with their actual values and save the file.
-
Press SW0 button to make the Bootloader enter in "application flashing mode".
-
Run SerialUpload.bat
This AN3341 - Basic Bootloader for the AVR MCU DA (AVR-DA) Family application note describes how the AVR® MCU DA (AVR-DA) family of microcontrollers (MCUs) can use self-programming. This enables the user to download application code into Flash without the need for an external programmer.