XIAO RP2040, RP2040 SDK and APIs

On Raspberry Pico, using the Earle F. Philhower “core” is possible, adding at beginning of the Arduino program:

#include "pico/stdlib.h"

to use all RP2040 SDK functions, including the very useful “Semaphore APIs” (e.g. to coordinate the access to certain resources by the two cores).

Seeed “core” (v2.7.2) does not seem to recognise the aforementioned #include, so … how can I call the RP2040 SDK functions?

Thanks in advance,

Guglielmo

It looks to me that the Raspberry Pi Pico sdk stuff hasn’t been fully ported to the Arduino software environment.

The Seeed stuff was apparently copied from the Raspberry Pi Pico distribution, and I would be shocked (shocked, I say) if they added anything.

The thing is that pico/stdlib.h is there for the XIAO RP2040 package (as well as for the Pico package), but it includes a couple of files that are missing, namely pico/stdio.h and pico/time.h

Here are error outputs from a Raspberry Pi Pico Arduino project that includes pico/stdlib.h and error output from an XIAO RP2040 project that includes pico.stdlib.h

Pico:

Arduino: 1.8.16 (Windows 10), Board: "Raspberry Pi Pico"
In file included from C:\Users\davee\Sketchbook\RpiTest\RpiTest.ino:1:0:

C:\Users\davee\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\3.0.1\cores\arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/common/pico_stdlib/include/pico/stdlib.h:11:10: fatal error: pico/stdio.h: No such file or directory

 #include "pico/stdio.h"

          ^~~~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board Raspberry Pi Pico.

XIAO RP2040

Arduino: 1.8.16 (Windows 10), Board: "SEEED XIAO RP2040"

In file included from C:\Users\davee\Sketchbook\RpiTest\RpiTest.ino:1:0:
C:\Users\davee\AppData\Local\Arduino15\packages\Seeeduino\hardware\rp2040\2.7.2\cores\arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/common/pico_stdlib/include/pico/stdlib.h:11:10: fatal error: pico/stdio.h: No such file or directory
 #include "pico/stdio.h"
          ^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Bottom line: SDK stuff for Arduino is a “work-in-progress,” and I don’t know if/when to expect progress.

FWIW: I have experimented with C++ (not Arduino) projects using the Raspberry Pi Pico SDK for the XIAO RP2040, and they work as expected, but I haven’t done enough to contribute any worthwhile suggestions. I installed the sdk on my Linux system and followed instructions in the document “Getting started with Raspberry Pi Pico C/C++ development…”
Just copy the .uf2 file to the XIAO in boot mode.

Regards,

Dave

You used the wrong “core” … as I wrote you MUST use the Earle F. Philhower “core” and … you don’t have any error. :slightly_smiling_face:

Guglielmo

By the way, I am adapting said “core” to include also XIAO RP2040 (borads.txt and variant files) so … in the future I will use only the Earle F. Philhower “core and NOT the buggy Seeedstudio “core:wink:

Guglielmo

P.S.: Just compiled for XIAO RP2040, without errors, a test program with 3 serial, semaphores and “multi-core” control … :grin:

1 Like

Great!

Regards,
Dave

Just started using the XIAO and relatively new to arduiono/raspberry hardware - where can I find the EFP core?

You can find the Earle F. Philhower “core” HERE … follow the instructions on the page for its installation.

Basically, without modifying anything, you can use the “generic” board, obviously being very careful about which pins you use, as it is not specific to the XIAO RP2040.

Guglielmo

1 Like

Earle F. Philhower just released the v1.13.2 of the arduino-pico “core” and …
… Seeed XAIO RP2040 is officially supported (pull #538) so … it’s possible to use one of the best arduino “core” for RP2040 also with XIAO RP2040 ! :slightly_smiling_face:

Guglielmo

2 Likes

Thats great

I strongly recommend the port from Earle F. Philhower:

  • It relies on the official Raspberry Pi Pico SDK, and not the cumbersome mbedOS the Arduino port is based upon;
  • It provides macros for the GPIOs, as well as for the neopixel and the three RGB LEDs;
  • It can easily be debugged with SWD, for example the very affordable Segger Edu Mini and its excellent Ozone GUI, or a Raspberry Pi Pico turned into a programmer-debugger PicoProbe.

New release of Earle F. Philhower Arduino “core” for RP2040 … version 2.0.0 and … :smiley:

Version 2.0.0 adds FreeRTOS SMP support thanks to @hfellner.

Normal applications will still use the default, non-RTOS setup/loop and setup1/loop1, but for users who need preemptive multitasking and multiple threads, FreeRTOS SMP can be used with
a simple #include <FreeRTOS.h>

Guglielmo

New release of Earle F. Philhower Arduino “core ” for RP2040 …

Release 2.0.1 - SoftwareSerial and FreeRTOS updates, I2S input and output support

Fix picoprobe and pico-debug upload recipes (#577)
Modify DFRobot pins_arduino.h (#573)
Fix order of bootsel IRQ/idle calls (#572)
Rewrite I2S from scratch, add I2S input support (#569)
Correct Serial1 and Serial2 pinout definitions added (#570)
Fix compile error when configSUPPORT_STATIC_ALLOCATION is set to 1 (#564) (#566)
Add invert option to SWSerial (#563)
Fix SWSerial polarity. (#560)

Guglielmo

1 Like