Updating from DeviceOS 1.5.0 to 1.5.1-rc.1 - SdFat - SpiProxy - Compile issue

Got the following compile issue from source code that was compiling and working perfectly fine under DeviceOS 1.5.0.

lib/SdFat/src/SdSpiParticle.cpp:35:1: error: cannot convert 'particle::SpiProxy<(HAL_SPI_Interface)0u>*' to 'SPIClass* const' in initialization

I don’t have access to this source code as it is an included library. This is the library in question as listed in my project.properties file (am using ParticleDev):


One may ask why I am not using the latest version of SdFat? It is because I had lots of issues upgrading to the latest in the past. I will set up a test scaffold under WebIDE to see how I get on with higher versions.

Any clues in the interim?


Similar (WebIDE) compiler issue when using SdFat Library 1.0.16.

lib/SdFat/SdCard/../SpiDriver/SdSpiDriver.h:38:20: conditional expression between distinct pointer types 'SPIClass*' and 'particle::SpiProxy<(HAL_SPI_Interface)0u>*' lacks a cast

I would (and do) use SdFat 1.0.16 and compile with Workbench not Web IDE. I think from memory the original problems I had getting SdFat to compile stem from the type SPISettings which needs to be changed to __SPISettings. Having said that I haven’t tried with 1.5.1-rc.1. Sounds like a ticket to Particle?

This is a somewhat obscure decision that was made some time ago when the Arduino.h compatibility header was given support for SPI transactions.
When you use #include <Arduino.h> you can actually use SPISettings. Without it you should use __SPISettings - I tried to ask for the reason back then but didn’t get any satisfying rational but something along the line: “Since some users may already have created thair onw version of SPISettings we don’t want to break their solutions”, however other changes were introduced without that kind of reluctance :see_no_evil: :speak_no_evil:

I’m getting a different compilation issue on 1.5.1-rc1 regarding SdFat.
Build targeting P1 on 1.5.0 works fine, lib version 1.0.16.

project_dir\lib\sdfat\src\spidriver\sdspidriver.h:38:20: error: conditional expression between distinct pointer types 'SPIClass*' and 'particle::SpiProxy<(HAL_SPI_Interface)0u>*' lacks a cast
project_dir\lib\sdfat\src\spidriver\sdspidriver.h:184:34: note: in expansion of macro 'SDCARD_SPI'
     m_spi = spiPort ? spiPort : &SDCARD_SPI;

Thanks for that nugget of history - I wondered where the __SPISettings came from.

Thanks guys!

So, how do we proceed to resolve this?

The way I see it, anyone using SDFat (a lot of installations I believe) with DeviceOS 1.5.1-rc.1 will have issues.

Q1. Do I need to raise a formal support ticket? If so, how is this done?

I fear so

Via support.particle.io

I will report back with any updates.

This is an issue we are actively looking into with regards to SPI changes and will post our guidance.


Compilation issue solved by @avtolstoy with release of DeviceOS 1.5.1 and specifically this fix https://github.com/particle-iot/device-os/pull/2095.

Can also confirm that my SPI devices - OLED and SDCARD work a.ok.

Case closed with thanks!


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.