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

1 Like

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

1 Like

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

Again a new release of Earle F. Philhower Arduino “core ” for RP2040 …

Release 2.0.3 - SerialPIO, UART, new WizNet boards, other board fixes

Fix XIAO RP2040, allow swapping HW units 0/1 (#606)
New WIZnet boards (#605)
Fix Wire::available() when ::requestFrom fails (#604)
Add attachInterruptParam (#602)
Modify DFRobot Beetle pin_arduinos.h (#597)
Deallocate resources on SerialPIO::end (#596)
Updated PID for WiFi/BLE board and other changes (#595)

Guglielmo

1 Like

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

Release 2.1.0 - Memory/Flash reduction, C++ exceptions, Platform.IO, bugfixes

Shrink flash and RAM usage even more (#627)
Temporary fix for muilticore realloc (#625)
Remove IRQ-level malloc from USB setup
Disable Wire slave interrupt on ::end (#621)
Activate default -Os optimization for Platform.IO (#619)
Hide get.py download percent when not interactive (#618)
Remove obsolete include paths from build.inc (#616)
Fix IDE include paths / Intellisense (#615)
Reduce flash, RAM use, reduce download/install (#613)
Add GCC stack protector support (#611)
Try and upload ASAP instead of hard-waiting 10sec (#610)
Add C++ exception option to menus (#607)
Fix WizFi360-EVB-Pico pins_arduino.h (#608)

Guglielmo

1 Like

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

Release 2.2.0 - Multicore, Platform.IO fixes, TinyUSB update

Major bugfix for multicore standard and FreeRTOS
Add dependency file generation to build (#644)
Update to latest Adafruit_TinyUSB (#639)
Update PlatformIO builder script and docs (#633)
Add analogReadResolution() docs (#631)
Updated helper class for Challenger NB board. (#629)
Add f_cpu 120, 240 mhz option (#628)
Add Platform.IO publish to release process

Guglielmo

2 Likes

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

Release 2.3.1 - Raspberry Pi Pico W WiFi support (and bug fix)

Add Pico W WiFi support (#670)
Fixes a compile error when building non-WIFI sketches on the Pico W
Fix ::printf/etc. due to mutex size conflict (#677)
Add delay to 2nd core start for Picoprobe (#676)
Add support for new SD/RTC and SubGHz boards (#663)
Automatically update the JSON file in makeboards (#664)
Disable WiFi.begin on plain Pico, add JSON (#682)
Provide dummy CYW43 callbacks when no WiFi used (#681)

Guglielmo

1 Like

I am exploring the RTOS capabilities.

1 Like

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

Release 2.4.0 - OTA support. I2S, UART, FreeRTOS, WiFi, IPv6 bug fixes

Add OTA.o to make p.io builds function (#755)
Add OTA update support (#711)
Increase FreeRTOS timer task stack to 1024 (#752)
Udp: default local_ip to IP_ANY_TYPE when IPv6 is enabled (#750)
IPv6 initial support from @oddstr13 (#748)
Fix typo in XIAO board name (#745)
Add board ElectronicCats Hunter Cat NFC (#741)
Fix UART wrong ::available() during wraparound (#739)
Stop random crashes while writing to flash (#730)
Increase LWIP MEM_SIZE to > TCP_SND_BUF (#731)
Adjust tcp_write size when memory is tight (#729)
Fix I2S timing (#728)
Add CMSIS defines to Platform.io (#721)
platform.txt: Add compiler flags for ARM CMSIS (#717)
Added to possibility to have extra compiler directives for a board. (#713)

Guglielmo

Earle F. Philhower is always working :grin: … a new release of Arduino “core ” for RP2040 …

Release 2.5.0 - Full RP2040 Web Support - WebServer, HTTPUpdate Server added

Update version
Add ExtremeElectronics RC2040 (#799)
Add WebServer, WebServerSecure, HTTPUpdateServer, HTTPUpdateServerSecure (#791)
Fix functions in docs: RP2040 Helper Class (#793)

Guglielmo

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

Release 2.6.0 - IDE 2.0 support and bugfixes

Add TARGET_RP2040 to build defines (#898)
Support IDE 2.0, detect UF2 volumes (#897)
Allow double-reset to jump to USB bootloader (#893)
Drive pin LOW after Tone(period) timeout (#887)
Fix Serial1/2 debug output mode in CoreMutex (#883)
Allow setCTS/RTS(UART_PIN_NOT_DEFINED) (#881)
Fix deadlock during attachInterrupt (#879)
Fix typo in HttpClient HTTPS example (#876)
Allow setting the WiFi region for PicoW (#875)

Guglielmo