Hey All,
I have been moving all my projects from Arduino over to PIO on mac. What an awesome IDE! I hit a bit of an issue with my STM32 project. In Arduino I can send code via the usb cabe to several devices. One over cu.SLAB_USBtoUART and the other is cu.usbserial-144220. When I get to PIO no matter what I add or remove from the platformio.ini file, I am unable to get code to my devices.
Use manually specified: /dev/cu.usbserial-144220
Uploading .pio/build/rak811_tracker/firmware.bin
Failed to init device.
stm32flash Arduino_STM32_0.9
Below are the setting in Arduino I would like to transfer over to PIO
PlatformIO also knows the upload_protocol = serial switch which attempts to program it via the builtin STM32 bootloader. For that the target chip has to be reset in bootloader mode (BOOT0 pin to 1).
Thanks for the quick response! Below is my platformio.ini. I have been trying to send code with the devices in boot mode and regular mode. Should I be specifying an external bootloader?
Can you show the output of a “Verbose Upload” (pio run -v -t upload) at the start of the flasher invocation? Also enable “Verbose Upload” in the Arduino IDE settings and copy the log output from the flashing process there?
Apologies as the code block sections got messed up.
It looks like there is a discrepancy between the upload tools.
Arduino - …/STM32Tools/1.3.2/tools/macosx/stm32Cube
PIO - …/tool-stm32duino”/stm32flash/stm32flash
Is it possible to use the platformio.ini to point the builder at the STM32 Cube Programmer?
Arduino Upload:
Sketch uses 32332 bytes (24%) of program storage space. Maximum is 131072 bytes.
Global variables use 2164 bytes (13%) of dynamic memory, leaving 14220 bytes for local variables. Maximum is 16384 bytes.
/Users/jandolina/Library/Arduino15/packages/STM32/tools/STM32Tools/1.3.2/tools/macosx/stm32CubeProg 1 /var/folders/k7/65ny6s4s5pd65s0twl6j4bgm0000gp/T/arduino_build_72294/Arduino_RAK811_LoRaWAN.ino.bin cu.usbserial-144220 -s
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
Serial Port cu.usbserial-144220 is successfully opened.
Port configuration: parity = even, baudrate = 115200, data-bit = 8,
stop-bit = 1.0, flow-control = off
Activating device: OK
Chip ID: 0x429
BootLoader protocol version: 3.1
Device name : STM32L100x6xxA/STM32L100x8xxA/STM32L100xBxxA/STM32L15xx6xxA/STM32L15xx8xxA/STM32L15xxBxxA
Flash size : 128 KBytes (default)
Device type : MCU
Device CPU : Cortex-M3
Memory Programming ...
Opening and parsing file: Arduino_RAK811_LoRaWAN.ino.bin
File : Arduino_RAK811_LoRaWAN.ino.bin
Size : 32708 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 127]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:05.827
RUNNING Program ...
Address: : 0x8000000
Start operation achieved successfully
================================================================= PIO Output:
I don’t know why the stm32flash flasher fails to talk to the UART bootloader while the STM32CubeProgrammer succeeds… with the same settings and target bootloader. Absolutely not.
But yes redirecting the upload command is possible and documented with upload_command.