/avr128da48-cnano-bootloader-atmel-studio

This repo provides an Atmel Studio solution which contains two projects, representing a basic implementation of a Bootloader and a Host Application example for the AVR-DA family.

Primary LanguageC

MCHP

Basic Bootloader for the AVR-DA Family (Atmel Studio)

This repository contains an Atmel Solution with two projects - a basic bootloader compatible with AVR-DA family and 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.

Related Documentation

More details and code examples on the AVR128DA48 can be found at the following links:

Software Used

Hardware Used

Setup

The AVR128DA48 Curiosity Nano Development Board is used as test platform.

Operation

In order to upload the application image follow this steps:

  1. Connect the board to the PC.

  2. Check the COM port the AVR128DA48 Curiosity Nano was connected to by opening Device Manager in Windows:

  3. Open the Bootloader.atsln solution in Atmel Studio

  4. Set AVR-Dx_Bootloader project as StartUp project:

  5. Build the Bootloader solution: right click on Bootloader solution and select Build

  6. Select the AVR128DA48 Curiosity Nano on-board debugger in the Tool section of the AVR-Dx_Bootloader project settings:

  • Right click on the project and click Properties;
  • Click Tool tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
  1. Program AVR-Dx_Bootloader project to the board: select AVR-Dx_Bootloader project and click Start Without Debugging:

  2. 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.

Example:

  1. Replace {path_to_hex_file}, {flash_max_size}, {COM_port}, {baud_rate} fields with their actual values and save the file.

  2. Press SW0 button to make the Bootloader enter in "application flashing mode".

  3. Run SerialUpload.bat

Summary

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.