Contents

Daisy Primer

Howdy, folks! Today’s post might not be the most thrilling, but after spending days wrestling with this, I figured it deserved a little attention…

Why This Exists

I’ve mentioned before how I like the Arduino framework but dislike the IDE. PlatformIO has been a game-changer for the hardware I’ve used so far, including Teensy, Arduino, and BluePill boards (for the most part). Recently, I decided to dive into the DaisySeed because it seems like the best option for audio developers tackling DIY projects. It boasts an awesome 96kHz 24-bit DAC for audio I/O! And it uses an ARM Cortex-M7 MCU with all the peripherals I need. How cool is that?

Eager to work with this board, I tried installing it with PlatformIO, but it was an epic fail! Despite my efforts, PlatformIO couldn’t properly identify the hardware. From what I’ve read, this isn’t necessarily a Daisy issue; PlatformIO seems to have different versions of the HAL libraries. Also, DaisyDuino only works with Arduino IDE 2.x.x, not 1.x.x or PlatformIO, which is a deal-breaker for me because the existing VSCode pluging only works with older versions of the Arduino IDE. For now at least, it seems Microsoft has decided to stop support on the VSCode plugin. Grrr!

So, I decided to use VSCode with the STM32Cube framework or libDaisy as suggested on the Daisy website. I chose libDaisy for two reasons: 1) I haven’t used the STM32Cube framework in PlatformIO and didn’t want to deal with the headaches of setting it up, especially given the differences in HAL libraries. 2) The Daisy website recommends using libDaisy with VSCode, which seems like a good fit for my first time working with Daisy.

Tradeoffs

I have a project that requires analog input and PWM output. Unfortunately, libDaisy doesn’t yet support hardware PWM. While daisyDuino does have hardware PWM support, I couldn’t get it working with VSCode, so I turned to libDaisy’s software PWM implementation. Luckily, this is sufficient for my needs, like dimming LEDs.

Daisy Primer

Now for the good stuff. I’ve created a template project that compiles and runs on my computer. I want to save you from the headaches I went through, so here it is: daisy_primer

I didn’t design this with sharing in mind, so apologies if it doesn’t work perfectly for you right off the bat. Here’s a step-by-step guide to get it working:

  1. Inistall the toolchain
  2. configure DaisyExamples as described here
  3. Insttall VSCode
  4. Download and install STM32CubeProgrammer from STMicoelectronics
  5. Flash the DaisySeed using the Blink example as shown in the video.
  6. In your DaisyExamples directory, create a folder named “MyProjects” or something similar.
  7. Clone or unpack the daisy_primer into your “MyProjects” folder. Name it whatever you want your project to be.
  8. Modify the Makefile and set TARGET to the name of your project folder.
  9. If you choose a different path for your project, you might need to update the paths to libDaisy and DaisySP in the .vscode/c_cpp_properties.json file.
  10. Note: I’m assuming you’re using the DFU upload method, not ST-LINK.

Lastly, I don’t have an ST-LINKV3 and had trouble getting debugging to work correctly. I found a workaround using screen on the USB port. I’ve created two additional tasks for easier debugging: “serial_monitor” and “build_and_program_dfu_serial_monitor”.

If you run into issues, feel free to submit them on the GitHub project’s issue tracker. I’ll try to answer as time permits.

cheers!

– Juan