Code runs in Arduino IDE but not Platformio

I built a drum machine/sequencer using Teenst and VS1053 which I am now trying to move to Daisy Seed. The new code is here: GitHub - ukmaker/BassMate

My issue is that the code so far (which does nothing useful yet) works in Arduino IDE, but in PlatformIO it does not. Specifically

  • it runs more slowly
  • after the first time the I2C input device is sampled that code somehow creates a fault and never runs again

Additionally, it is impossible to create a new Arduino project using PlatformIO which either builds correctly or can be debugged using PlatformIO. I can add some defines to platformio.ini to make it build, but to debug I have to launch an ST-Link session from VSCode directly. I get the same results on Windows and Mac.

Anyone know how to get PlatformIO to work? I could really do with having the debugger work!

I have made this work, and in the process discovered a few things. Now sure where to report them so I’ll put everything here (@shensley anywhere else I should post this?)

  1. The default configuration when a new arduino project is created with PlatformIO does not work. It is necessary to add some configuration to platformio.ini. The key to getting debugging working was adjusting the level of optimization in a debug build.

  2. PlatformIO itself packages a very old version of the toolchain by default. This is no addressed by following the Daisy Wiki instructions to install the Daisy toolchain - more configuration in platformio.ini is needed.

  3. The board definition files are incorrect - the sizes of RAM and Flash are swapped. E.g. see .platformio/platforms/stm32/boards/electrosmith_daisy.json
    I’ll post an issue in Issues · platformio/platform-ststm32 · GitHub to cover this

For 1. and 2. your platformio.ini should look like the following

  • remove the USB lines if you don’t need USB serial suport
  • check the latest toolchain at PlatformIO Registry for version

---- platformio.ini ----


platform = ststm32

board = electrosmith_daisy

framework = arduino

lib_deps =


build_flags = -w







debug_build_flags =

    -Os -ggdb2 -g2

platform_packages =

1 Like