ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

micro_ros_arduino RP2040 Connect build trouble SPI.h not found?

asked 2022-03-23 14:58:27 -0600

Redstone gravatar image

Hello All, as much as I hate to admit I'm officially stuck. Thanks for any help you can offer.

I have been trying to get micro_ros_arduino to build as per the docs located here:

However I still cannot build anything. Does this rely on any libraries installed with the Arduino IDE?

My testing main.cpp is just a blink sketch that works fine otherwise with PIO. It has no other code.

My platoformio.ini is setup per the docs but I get build errors that claims it cannot find SPI.h (see below)

What I have tried.

Adding SPI manually in a few different ways.

  • putting arduino-libraries/SPI as a lib_dep simply reported that the library was built in and not needed.

  • Adding SPI as a lib_dep

  • lib_ignore SPI

    Results: Build got past SPI not found error but build then spits out some initial warnings regarding WIFi (captured below) then about 500+ more lines of warnings from libmicroros and then fails with collect2: error: ld returned 1 exit status

Arduino RP2040 Connect Ubuntu20.04 VSCode, Foxy VsCode Version: 1.65.2 Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: OS: Linux x64 5.13.0-35-generic

SPI.h Error

Processing nanorp2040connect (platform: raspberrypi; board: nanorp2040connect; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Raspberry Pi RP2040 (1.5.0) > Arduino Nano RP2040 Connect
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, raspberrypi-swd)
 - framework-arduino-mbed 2.4.1 
 - tool-rp2040tools 1.0.2 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <micro_ros_arduino> 2.0.3-galactic+sha.8b64548
|   |-- <WiFiNINA> 1.8.13
|-- <WiFiNINA> 1.8.13
Building in release mode
Compiling .pio/build/nanorp2040connect/src/main.cpp.o
Compiling .pio/build/nanorp2040connect/libb5c/WiFiNINA/utility/spi_drv.cpp.o
Compiling .pio/build/nanorp2040connect/libb70/micro_ros_arduino/native_ethernet_transport.cpp.o
Compiling .pio/build/nanorp2040connect/libb70/micro_ros_arduino/wifi_transport.cpp.o
.pio/libdeps/nanorp2040connect/WiFiNINA/src/utility/spi_drv.cpp:22:10: fatal error: SPI.h: No such file or directory

* Looking for SPI.h dependency? Check our library registry!
* CLI  > platformio lib search "header:SPI.h"
* Web  >

 #include <SPI.h>
compilation terminated.
*** [.pio/build/nanorp2040connect/libb5c/WiFiNINA/utility/spi_drv.cpp.o] Error 1
.pio/libdeps/nanorp2040connect/micro_ros_arduino/src/wifi_transport.cpp:10:10: fatal error: SPI.h: No such file or directory


Indexing .pio/build/nanorp2040connect/libb5c/libWiFiNINA.a
Compiling .pio/build/nanorp2040connect/FrameworkArduinoVariant/nina_pins.cpp.o
Compiling .pio/build/nanorp2040connect/FrameworkArduinoVariant/variant.cpp.o
.pio/libdeps/nanorp2040connect/micro_ros_arduino/src/wifi_transport.cpp: In function 'size_t arduino_wifi_transport_read(uxrCustomTransport*, uint8_t*, size_t, int, uint8_t*)':
.pio/libdeps/nanorp2040connect/micro_ros_arduino/src/wifi_transport.cpp:53:33: warning: comparison between signed and unsigned integer expressions ...
edit retag flag offensive close merge delete


Above was a known issue however the fix did not work 100%


Adding a kind of answer to my own question...

It compiles now... but I have a warning.

I still had to manually include lib_dep = SPI and I got a few warnings that mean nothing to me I hope it's not a problem.

Redstone gravatar image Redstone  ( 2022-03-23 16:09:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-03-24 08:28:32 -0600

Pablogs gravatar image

Can you open an issue in the micro-ROS for Arduino repo? This way we can track the issue and answer there. Just reference it here in ROS answers.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-03-23 14:58:27 -0600

Seen: 204 times

Last updated: Mar 24