Stm32 Nucleo Arduino Pin Definitions Wrong?

I’m trying to use platformio to program a Nucleo_f429zi, but the pins definition appear to be incorrect…

Consider the following blink sketch

uint8_t led = LED_BLUE; void setup() { pinMode(led, OUTPUT); } void loop() { digitalToggle(led); delay(1000); }

It successfully compiles and uploads from both arduino and pio (yes, the main.cpp in pio has #include <Arduino.h> in it), but in the pio case nothing happens after the upload.

for reference, here are my arduino settings

and here is my platformio.ini

[env:nucleo_f429zi] platform = ststm32 board = nucleo_f429zi framework = arduino upload_port = COM6

Any help / advice is appreciated!

I tried uninstalling an old global pio core from my system, alongside the stm32 framework with no luck.

I also find that, when uploading from arduino, the LD4 led on the nucleo programmer is green, while it is red when uploading from PIO. Going to keep trying!

Also updated the onboard st-link programmer… no luck there either

Just tried building it with pio and manually dragging firmware.bin over to the upload disk.

When resetting the board, I get a new file on the disk called “failed.txt” with the following contents:

The application file format is unknown and cannot be parsed and/or processed

This doesn’t bode well…

Same problem as in Code appears to upload but does not run on STM32 Nucleo L476RG · Issue #537 · platformio/platform-ststm32 · GitHub.

PlatformIO defines the board to have 256kByte RAM

but the RAM is not continuous. At 0x2000000 there’s only 192 Kbyte, the Core-coupled memory is at another address. Datasheet page 86

However due to recent linker script changes the maximum_ram_size value is used in the build system to calculate the start stack pointer. By using a value of 256Kbyte, this will point at 0x2000000 + 256*1024, at which there is no RAM, the board will instantly crash on startup.


board_upload.maximum_ram_size = 196608

to the platformio.ini.

EDIT: Fix board_build to board_upload, facepalm.

This corrects the stackpointer back down to where there is RAM.

This didn’t make it work for me. I still get the “failed.txt” when I try to manually build and upload on mass storage, as well as having PIO upload.

I’m got a new nucleo overnighted, I’ll see if this trick works on that one!

Then there’s a problem even before you get to the uploading part.

I overlooked this earlier, but you musn’t have that option in. The upload happens via USB (the STLink), not via a COM port.

If there is a failed.txt then the connections between the STLink and the MCU might have been disconnected. There are 2 jumpers for the SWD connections, one voltage selection jumper (E5V vs U5V) and one IDD jumper (supplies the entire current to the MCU). Make sure these are all set. When you re-plug the Nucleo into the PC, the LD1 LED must go green. See docs chapter 6.3.3 and 6.4.2.

Well, I have no idea what I’m doing :smiley:

I followed the thread you linked and using there value of ram worked.

board_upload.maximum_ram_size = 98304

I took out upload_port at one point because I saw another thread suggesting it, although I don’t think it was ever an issue. By any chance do you know why this random ram value made it work?

This line is wrong. It’s supposed to be upload not build. It changes the wrong variable.

Please use

board_upload.maximum_ram_size = 196608

instead to get the correct value for your board. Otherwise the possible stack is heavily reduced.

Ah, you know I didn’t even read the difference between the two. This works as expected, thanks again for the help!