Libraries updated to support new RP2040-based boards (RASPBERRY_PI_PICO, etc.)

These libraries are updated to add support to new RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040.

Currently only for RP2040-based boards using Earle Philhower's arduino-pico core. Supporting for boards using Arduino-mbed RP2040 core will be added later.

The lists will be updated gradually.

1. Earle Philhower's arduino-pico core

2. Arduino-mbed RP2040 core

Many more to come.


Screenshots

1. ESP8266_AT_WebServer

Selection_784

2. EthernetWebServer

Selection_794

4 Likes

The SafeString library V4.0.4+ also supports Rasberry Pi Pico

1 Like

Could you please update the SafeString Library to also support Earle Philhower's arduino-pico core.

The compile error:

In file included from /home/kh/Arduino/libraries/SafeString/examples/SafeString_Tests/SafeStringCaseChanges/SafeStringCaseChanges.ino:13:
/home/kh/Arduino/libraries/SafeString/src/SafeString.h:120:10: fatal error: Printable.h: No such file or directory
  120 | #include <Printable.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Raspberry Pi Pico.

Created pull request for Earle Philhower's build

User requested SafeString library support be added for this project.

Current SafeString library works for Arduino Mbed OS RP2040 V2.0.0 board install

This pull request fixes missing Printable.h file
But in order to complete adding the support need a unique define (-D... = .. ) that can be detected by SafeString.h so that the
necessary
namespace arduino {
can be set

Can you add a -D to your compile line (and when Arduino detects libraries)
Also dtostrf( ) declaration not found by SafeString library (works with Arduino pico, fixed by an extern ... in SafeString.h )

@khoih-prog
Drop me a MP if you want a modified version of SafeString the only runs on that board

EthernetWebServer v1.4.0 now supports RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core

Selection_794

Earle Philhower's build V1.2.2 fixes support for SafeString.
SafeString V4.1.1 supports Earle's pico board

EthernetWebServer_SSL v1.4.0 now supports RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core

Selection_796

EthernetWebServer v1.5.0 now supports RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core v1.4.0+

Selection_799

EthernetWebServer_SSL v1.5.0 now supports RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core v1.4.0+

Selection_803

Now solved: Where is the macro "BOARD_NAME" defined? It is used in the TimerInterruptTest example and gives a compile error for me:
d:\Arduino\RaspberryPico\TimerInterruptTest\TimerInterruptTest.ino:126:72: error: 'BOARD_NAME' was not declared in this scope

Currently you have to use Packages' Patches for RP2040-based boards.

With core after v1.4.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.

8. For RP2040-based boards using Earle Philhower arduino-pico core

8.1 To use BOARD_NAME

To be able to automatically detect and display BOARD_NAME on RP2040-based boards (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).

Supposing the rp2040 core version is 1.4.0. This file must be copied into the directory:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/platform.txt

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt

With core after v1.4.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.

8.2 To avoid compile error relating to microsecondsToClockCycles

Some libraries, such as Adafruit DHT-sensor-library, require the definition of microsecondsToClockCycles(). To be able to compile and run on RP2040-based boards, you have to copy the files in RP2040 Arduino.h into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).

Supposing the rp2040 core version is 1.4.0. This file must be copied to replace:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz
This file must be copied to replace:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/cores/rp2040/Arduino.h

With core after v1.4.0, this step is not necessary anymore thanks to the PR Add defs for compatibility #142.

Excuse me, I cannot follow your instructions.
Thanks to your answer, I have now updated from V0.9.18 to V1.4.0, thanks for that.
Then I copied the "platform.txt" file to the location as instructed. After that, it was no longer possible to compile. I was also wondering: The "new" file contains:
name = Raspberry Pi RP2040 Boards
version = 0.9.9
That doesn't look very up to date!
Therefore I continue to work with the original file, it contains
name = Raspberry Pi RP2040 Boards (1.4.0)
version = 1.4.0
and works - except for the macro "BOARD_NAME".

I'm sorry I haven't updated the Patch then. Please use this new platform.txt

To khoih-prog: OK, now it warks. I see the name RASPBERRY_PI_PICO. Thanks for advice!

1 Like

Hello khoih-prog, we'll keep in touch.
I have the following question: Why is a callback function of type bool? An interrupt callback cannot (and must) not give anything back?

Hi @RudolfAtRTC

Thanks for the feedback.

The bool return is a strange one, currently not being used for anything, but requested by the core / pico-sdk as in :

pico-sdk time.h

typedef bool (*repeating_timer_callback_t)(repeating_timer_t *rt);
bool alarm_pool_add_repeating_timer_us(alarm_pool_t *pool, int64_t delay_us, repeating_timer_callback_t callback, void *user_data, repeating_timer_t *out);

I'm glad that the library is working OK for you.

You should be able to tick SafeString on both board packages now.

@drmpf
Done. Thanks.

@drmpf

I now get compiler error with ArduinoCore-mbed RP2040 core v2.1.0 for almost every example as follows:

/home/kh/Arduino/libraries/SafeString/src/SafeString.cpp: In member function 'size_t arduino::SafeString::printInt(double, int, int, bool, bool)':
/home/kh/Arduino/libraries/SafeString/src/SafeString.cpp:938:5: error: 'dtostrf' was not declared in this scope
     dtostrf(d, width, decs, result);
     ^~~~~~~
/home/kh/Arduino/libraries/SafeString/src/SafeString.cpp:938:5: note: suggested alternative: 'strstr'
     dtostrf(d, width, decs, result);
     ^~~~~~~
     strstr
exit status 1
Error compiling for board Raspberry Pi Pico.

I'm using latest Safestring v4.1.3. Compile OK now with the Earle Philhower's arduino-pico RP2040 core v1.5.1

Thanks for finding that. Fixed in SafeString V4.1.4 available shortly from library manager