Programming AVR-BLE Dev Board with PlatformIO in VS Code
Posted by Fremic_@reddit | learnprogramming | View on Reddit | 3 comments
I am working on a project for a friend who is using a AVR-BLE DEVELOPMENT BOARD from Microchip. I am an avid ESP32 user and thus I am not very familiar with this hardware. I am using a direct USB connection to my PC and don't have any specialized programmers. I am also trying to avoid using the ATMEL software as it is massive and I am only using this board for the one small project.
I am trying to create a "Hello World" type program for the AVR-BLE board in VS Code using PlatformIO so I can start working on the project. Ideally this would include a blinking on-board LED or something. However, I am struggling to find the correct parameters for the platformio.ini file and create a corresponding main file template.
A simple explanation (possibly with examples) would be greatly appreciated. I am not looking for a deep dive to understand the software to hardware interaction or changing the hardware of the project. Thanks!
gofuckadick@reddit
I’ve used these boards a bit - not a ton, but enough to get something simple running.
The smallest reasonable platformio.ini to try would be:
For a basic “hello world” blink, the board has two user LEDs: - green “Data” LED -> PF4 - red “Error” LED -> PF5
According to the user guide they’re active-low, so you turn them on by writing LOW (pulling the pin to ground).
Since it's a Microchip board and not a typical Arduino board, I wouldn’t assume something like
LED_BUILTINwill work - it’s safer to just hit the registers directly at first:That avoids guessing how (or if) the Arduino core mapped the pins.
PlatformIO does support the ATmega3208 so building should work fine, but it doesn’t support uploading/debugging for it, and Microchip’s docs specifically mention using MPLAB X/Microchip Studio with the onboard debugger.
But, to flash manually: - build with PlatformIO in VS Code - grab the .hex from
.pio/build/avr_ble/- flash it via USB (the board supports drag and drop programming so you can literally just drop the .hex onto the drive like it's a flash drive)Fremic_@reddit (OP)
This solution works perfectly. Thank you very much!
gofuckadick@reddit
I’ve used these boards a bit - not a ton, but enough to get something simple running.
The smallest reasonable platformio.ini to try would be:
For a basic “hello world” blink, the board has two user LEDs: - green “Data” LED -> PF4 - red “Error” LED -> PF5
According to the user guide they’re active-low, so you turn them on by writing LOW (pulling the pin to ground).
Since it's a Microchip board and not a typical Arduino board, I wouldn’t assume something like
LED_BUILTINwill work - it’s safer to just hit the registers directly at first:That avoids guessing how (or if) the Arduino core mapped the pins.
PlatformIO does support the ATmega3208 so building should work fine, but it doesn’t support uploading/debugging for it, and Microchip’s docs specifically mention using MPLAB X/Microchip Studio with the onboard debugger.
But, you can flash manually: - build with PlatformIO in VS Code - grab the .hex from
.pio/build/avr_ble/- flash it via USB (the board supports drag and drop programming so you can literally just drop the .hex onto the drive like it's a flash drive)See more docs here.