This is a serial bootloader for Microchip (née Atmel) ATSAML11 microcontrollers. It is an updated version of Microhip's bootloader implementation.
- Uses Python 3 rather than Python 2.
- Self hosted, doesn't require abandoned Atmel IDE.
The bootloader will be entered when either of the following conditions are met:
- There is no application uploaded
- The BOOT button is pressed at reset
The LED will flash at ~5 Hz to indicate it is in the bootloader.
Note
The steps below are for Linux/macOS, I do not have a Windows machine to test this at the moment.
The uploader is ./tools/boot.py. A virtual environment should be set up before first use. In ./tools/ run:
python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txtNote
This assumes you are using bash or zsh. For fish and tcsh append .fish and .csh respectively to source venv/bin/activate.
Before you start, activate the virtual environment. In ./tools/ run:
source venv/bin/activateNow, you can upload your firmware to the microcontroller. In ./tools/ run:
python3 boot.py -v -i SERIAL_PORT -f PATH_TO_BIN -o 0x400
python3 boot.py -v -i SERIAL_PORT -rThis first loads the firmware and then resets the device. If the BOOT pin is not pulled LOW, the SAML10 will enter the application.
Succesful upload responce:
Unlocking
Uploading 67 blocks at offset 1024 (0x400)
Uploading... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Verification... success
Done!
The error Error: Unknown response byte: 0xbf means three's an issue with the UART connection or the device is not in bootloader mode
If you need to list your available SERIAL_PORTs, simply run python3 boot.py.
- Is the bootloader responsive?
- Open the serial device in a terminal. 115200 baud, 8+1 bits, no parity.
- Type any key. The bootloader should return
Qin return.
- Check the Python version you are using, it must be Python 3.
- Is the virtual environment activated?
You need to alter the pin configuration to match your board's bootloader entry pin and optionally LED indication and regulator enable. This can be done by setting the following #defines in src/saml_bl.c:
BL_REQ_PIN: pin for bootloader entry button/jumper.BL_LED_PIN: pin for LED (active high or low).BL_REG_PIN: pin for regulator enable.
The following #defines select the LED and regulator enable functionality:
BL_LED_EN: set to1to enable LED indication,0to disable.BL_REG_EN: set to1to enable regulator enable,0to disable.BL_REG_HIGH: set to1for active HIGH regulator enable,0for active LOW.
To build the bootloader, you need the Arm Embedded Toolchain installed. With this on your path, simply run:
make
This will produce build/saml10_bl.bin which you can upload to the microcontroller as described above.