Here’s what I found after some “poking around.”
1. If you have never used the XIAO RP2040 with your Arduino system and you use the Hardware Manager to load the Seeed XIAO RP2040 package 2.7.2 (the latest package):
- It compiles OK, but chokes when you try to upload to the device. (Awww $hit!)
2. If you use the Arduino Boards Manager to remove the 2.7.2 package and install the 1.12.0 version:
- It compiles OK and you can upload the file to the device. (Attaboy!)
3. With version 1.12.0:
- I2C projects don’t work. (Awww $hit)
I had a lengthy sequence about I2C on this forum a few months ago when I first got my XIAO RP2040 modules. This can be considered to be an update to that one.
4. Now, if you use the Boards Manager to upgrade to board package 2.7.2 you get three results:
a. It compiles and uploads the sketch (Attaboy!!)
b. I2C now works (Attaboy!)
c. SPI functions are now borked. Yes, really! SPI used to work, but the upgrade screwed the pooch. (Awww $hit!)
Note that over the years in my professional career I have found that it takes something like 10 “Attaboys” to make up for one “Awww $hit” so we are still a little behind, but at least there is some progress.
Anyhow, here’s my significant discovery (Tested on Windows 10, Debian Linux and Raspbian Linux):
The reason it compiles now but didn’t compile with a “virgin” installation of 2.7.2 is because the upgrade from 1.12.0 installed some tools that Arduino needs to be able to put the compiled result onto the device, whereas the “virgin” installation did not install those tools! (That’s the original “Awww $hit”)
- It is possible to modify a file named pins_arduino.h in the module’s variants directory to make SPI work without screwing up the other stuff. A comment in the XIAO_RP2040_Test_SD project’s ino file explains my modification. I also attached a zip file containing the original and modified files that I used to get things working.
I have attached two projects that test the I2C and SPI functionality for an XIAO RPC2040 plugged into an XIAO Expansion Board. I also tested with a “bare” XIAO RP2040 plugged into a solderless breadboard along with appropriate other hardware modules (A SH1106 128x42 OLED and a uSD module with a 16G SD card plugged in.)
Footnote: If any of this can be passed along to Seeed developers, note the two big bugs that I uncovered here:
1. A brand new installation of the 2.7.2 package does not install the rp2040tools directory under Seeduino\tools. When you upgrade from 1.12.0 to 2.7.2 this is installed, and the upgraded 2.7.2 now works. Could have saved a lot of board bandwidth if I had realized this.
2. When you created the procedure to update the boards package from 1.12.0 to 2.7.2 you did a lot of work to make the I2C stuff work (not just arduino_pins.h, but other stuff in the compiler installation). BUT YOU CHANGED THE SPI STUFF in pins_arduino.h from something that worked to something that did not work. Why, oh why, did you do this? And, more importantly, didn’t someone test this? (That’s a rhetorical question, since if any had tested it, the error would have manifested itself.)
Ttttthat’s all, Folks!
davekw7x, Over and Out
XIAO_RP2040_Test_OLED.zip (142.5 KB)
XIAO_RP2040_Test_SD.zip (16.4 KB)
pins_ardino.h.zip (2.2 KB)