SDFat Library With Mesh

Has/Will the public SDFat library been updated to supported for mesh devices? For example, is there a good way to integrate an Adafruit Datalogger Featherwing with these devices?

Yes it has v1.0.15 also supports Mesh devices.

Okay, when trying to use the Xenon and the Adafruit Datalogger Featherwing with the SDFormatter.ino example file, we weren’t able to access the SD card (nothing erased in the end), while trying different pins for the chip select. Based off the documentation, we took the CS to be A5, D2, and GPIO 10, however none these resulted positively. Is there a certain pin that we should try troubleshooting instead or should we be redefining the SPI pins off of its defaults?

I haven’t got a Adafruit Datalogger Featherwing, but I have an Adafruit Music Maker Featherwing that also sports an SD slot and with that I can use the SD card just fine.

I haven’t tested the that particular sample tho’, I’ll give the SDFormatter sample a go.

If you are using Web IDE, you could post a SHARE THIS REVISION link.

Where does that info come from? :confused:
I (currently) can’t see any mention of Particle devices in the Adafruit docs.
But I looked at the Adalogger and the default CS pin on that board and AFAICT that would be D5 on the Particle Mesh devices.

(Pinouts | Adafruit Adalogger FeatherWing | Adafruit Learning System)

1 Like

I have the Adafruit data logger FeatherWing. I’ll try to add instructions to the community feather page in the docs next week with instructions.


We looked at the tutorial for the Adalogger Featherwing, and you’re right, there is no specific documentation for the Particle boards, but the tutorial does list: “On nRF52840, it’s on GPIO 10” It’s possible that I’m not understanding the pin mapping clearly…From the Particle Accessories page for the Mesh boards they list other examples with CS from other boards that use the SPI and SPI1 pin mappings and those, I believe at A5 and D2, however I would have to cut the trace on the Adalogger and reroute them there. I thought that the CS could be “redefined” in a way through software, from the mesh documentation, but…The error that I was getting, while using sd.begin(D5) or any other pin, was:
Can’t access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X20,0X0
but I’ve never seen this error in particular before.
I’ll try cutting the trace and rerouting to see if this fixes anything

Actually it says “On the nRF52832 it’s GPIO 11” which refers to this board :wink:
But although the nRF52540 based Adafruit Feather Pro also uses pin 11 that’s only valid for the Adafruit nRF boards. Another company may decide to put any other pin at its place as long they document the difference (as done with the D5 silk screen for the Xenon) - hence you’d need to do the physical compare as I’ve done with the images I posted.

And when it comes to the default SPI CS pins, these are mere suggestions if you don’t actually provide an explicit pin but then you have to have the wiring accordingly.
After all, the CS pin(s) are meant to allow multiple devices to share the same bus, so there can’t be only one CS pin but you need one per device of which only ever one is allowed to be active at any given time.
So you don’t need to use the default A2 (for SPI) at all but can choose the one that’s already connected (D5).


If you read the Tutorial it does refer to the NRF model that I quoted. I understand that it’s possible that the feathers could have used different pins layout and models and whatnot and that only one SPI device can be active at a time. I’ll keep working at it. Thanks!

I see, thanks for the update :+1:
That board wasn’t even mentioned at the page I looked at (and linked above) - only a few pages on. Seems to be an oversight on Adafruits part.

There is now a library:

The Adafruit AdaLogger FeatherWing is an SD card and real-time-clock (RTC). You can find more about the board here.

The AdafruitDataLoggerRK library allows you to use both features easily, or you can directly use the libraries for the two things on the FeatherWing:

  • Adafruit_RTClib_RK, a port of the Adafruit RTCLib (real time clock)
  • SdFat, version 1.0.16 or later.

The SD card is connected to the SPI bus and the default connection for the CS pin is D5.

Pin Usage
D5 SD Card CS

The RTC can only be used if the CR1220 battery is inserted. It connects by I2C and uses address 0x68.

Pin Usage

The AdafruitDataLoggerRK library includes a class to synchronize the RTC and the Time class clock in both directions, depending on which one has a valid time. This is especially useful on the 3rd-generation devices which don’t maintain the time clock when powered down or in deep sleep modes.

The AdafruitDataLoggerRK library also includes the SdCardLogHandlerRK, an optional class that makes it easy to write to a rotating log file. Each file is sequentially numbered. The largest number is newest, and writing appends to this file.

The maximum size of the file can be specified, as can the maximum number of files to keep.

This is intended to be used with text-based information, as data is written to the card by lines (ending with \n).


Thanks @rickkas7! Your library worked like a charm! I’ll have to do a direct compare to see what happened on our end.

1 Like