Problem with Rasberry Pi Pico and TinyUSB for usbMIDI

Hi all,
Been using Platoform IO for a couple of years but first time poster. Hope I’m in the right sub:)

I decide to give the Pico a go for a project with midi over USB but ran into some problems. I managed to set up the earlephilhower core with the platformio.ini example from the bottom of this page:
https://arduino-pico.readthedocs.io/en/latest/platformio.html#selecting-the-new-core

Everything seems to work fine until I try to change USB stack to access tinyUSBs midi implementation. When I add the build flag (below) the pico doesn’t show up as a com port or as a midi device.
build_flags = -DUSE_TINYUSB

The closest I’ve gotten to figuring out where the problem lies is that, from the picos side, the command TinyUSBDevice.mounted() never returns true.

Setting up the same project with the same core in the Arduino IDE works.

I’m in quite over my head here so please let me know if I’ve just misunderstood something or what other info I should post

Can you show the exact used platformio.ini and src/main.cpp code? (I’m the mantainer of the Pico PlatformIO build scripts)

I recognise you’re name form my .ini file;) Thanks for taking a look!

platformio.ini

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
; note that download link for toolchain is specific for OS. see https://github.com/earlephilhower/pico-quick-toolchain/releases.
platform_packages =
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.1-a/x86_64-w64-mingw32.arm-none-eabi-7855b0c.210706.zip

upload_port = D:
build_flags = -DUSE_TINYUSB

main.cpp

#include <Arduino.h>
#include <Adafruit_TinyUSB.h>

// FSR
int fsrPin = A0;

void setup()
{
  Serial.begin(115200);
  pinMode(fsrPin, INPUT);

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop()
{
  if(TinyUSBDevice.mounted()){
    digitalWrite(LED_BUILTIN, HIGH);
  }
  long fsrVal = analogRead(fsrPin);
  Serial.print("FSR val: ");
  Serial.println(fsrVal);
  delay(10);
}

Thanks, I will very soon have a look at reproducing + bugfinding.

1 Like

Any luck with this?
Have been using the Arduino IDE and also tried other micro controllers for this project but the Pico in PlatformIO with this core would still be my first choice if this works

2 Likes