Skip to content

Commit e8208b1

Browse files
committed
Support RP2350B, refactor, Cppcheck fixes and bug fixes.
1 parent ce61a0e commit e8208b1

361 files changed

Lines changed: 45331 additions & 12061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,48 @@
11
### Warning: This version has major internal changes.
22

3-
SdFat version 2.3.0 has major changes to implement RP2040/RP2350 SDIO.
3+
SdFat version 2.3.1 has major changes. In addition there a number of bug fixes.
44

5-
In addition there a number of bug fixes.
5+
Please post an issue if you find a bug.
66

7-
Begin by running the Rp2040SdioSetup example to try RP2040/RP2350 SDIO.
7+
Support has been added for the SDIO on RP2350B QFN-80 with 48 GPIO pins.
8+
Each PIO block is still limited to 32 GPIOs at a time, but GPIOBASE
9+
selects which 32.
810

9-
This example requires a SDIO Card socket with the following six lines.
11+
GPIOBASE can only have value of zero or 16 so all SDIO pins must be in the
12+
range 0-31 or 16-47.
13+
14+
Run the Rp2040SdioSetup example to try RP2040/RP2350 SDIO.
1015

11-
CLK - A clock signal sent to the card by the MCU.
12-
CMD - A bidirectional line for for commands and responses.
13-
DAT[0:3] - Four bidirectional lines for data transfer.
16+
This example requires a SDIO Card socket with the following six lines.
1417

18+
* CLK - A clock signal sent to the card by the MCU.
19+
* CMD - A bidirectional line for for commands and responses.
20+
* DAT[0:3] - Four bidirectional lines for data transfer.
1521
CLK and CMD can be connected to any GPIO pins. DAT[0:3] can be connected
1622
to any four consecutive GPIO pins in the order DAT0, DAT1, DAT2, DAT3.
1723

18-
The release version of SdFat Version 2 is here:
24+
Here is an example of SDIO for Pico using an Adafruit socket, PiCowbell
25+
Proto and PiCowbell Proto Doubler.
26+
27+
![Alt text](images/SdioSpi.jpg)
28+
29+
This Socket supports SDIO with:
30+
```
31+
#define RP_CLK_GPIO 10
32+
#define RP_CMD_GPIO 11
33+
#define RP_DAT0_GPIO 12 // DAT1: GPIO13 DAT2: GPIO14, DAT3: GPIO15.
34+
```
35+
It also can be used on SPI1 with:
36+
```
37+
const uint8_t SD_CS_PIN = 15;
38+
#define SD_CONFIG SdSpiConfig(SD_CS_PIN, DEDICATED_SPI, SPI_CLOCK, &SPI1)
39+
40+
// In setup
41+
SPI1.setSCK(10);
42+
SPI1.setTX(11);
43+
SPI1.setRX(12);
44+
```
45+
### The release version of SdFat Version 2 is here:
1946

2047
https://github.com/greiman/SdFat
2148

@@ -117,4 +144,4 @@ documentation for the classes SdFat32, SdExFat, SdFs, File32, ExFile, FsFile.
117144
The SdFat and File classes are defined in terms of the above classes by
118145
typedefs. Edit SdFatConfig.h to select class options.
119146

120-
Please continue by reading the html documentation in the SdFat/doc folder.
147+
Please continue by reading the html documentation in the SdFat/doc folder.

doc/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,9 @@ INPUT = ../src \
958958
../src/SpiDriver \
959959
mainpage.h \
960960
../src/FsLib \
961-
../src/FsLib \
962961
../src/SdCard/TeensySdio \
963-
../src/SdCard/Rp2040Sdio
962+
../src/SdCard/PioSdio \
963+
../src/SdCard/SdSpiCard
964964

965965
# This tag can be used to specify the character encoding of the source files
966966
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

doc/SdErrorCodes.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2022-07-01
1+
2025-01-01
22

33
Run the SdErrorCode example to produce an updated list.
44

@@ -12,7 +12,7 @@ Code,Symbol - failed operation
1212
0X06,SD_CARD_ERROR_CMD8 - Send and check interface settings
1313
0X07,SD_CARD_ERROR_CMD9 - Read CSD data
1414
0X08,SD_CARD_ERROR_CMD10 - Read CID data
15-
0X09,SD_CARD_ERROR_CMD12 - Stop multiple block read
15+
0X09,SD_CARD_ERROR_CMD12 - Stop multiple block transmission
1616
0X0A,SD_CARD_ERROR_CMD13 - Read card status
1717
0X0B,SD_CARD_ERROR_CMD17 - Read single block
1818
0X0C,SD_CARD_ERROR_CMD18 - Read multiple blocks
@@ -46,6 +46,7 @@ Code,Symbol - failed operation
4646
0X28,SD_CARD_ERROR_ERASE_SINGLE_SECTOR - Card does not support erase
4747
0X29,SD_CARD_ERROR_ERASE_TIMEOUT - Erase command timeout
4848
0X2A,SD_CARD_ERROR_INIT_NOT_CALLED - Card has not been initialized
49-
0X2B,SD_CARD_ERROR_INVALID_CARD_CONFIG - Invalid card config
50-
0X2C,SD_CARD_ERROR_FUNCTION_NOT_SUPPORTED - Unsupported SDIO command
51-
0X2D,SD_CARD_ERROR_UNKNOWN - Unknown error
49+
0X2B,SD_CARD_ERROR_ADD_PIO_PROGRAM - Add PIO program
50+
0X2C,SD_CARD_ERROR_INVALID_CARD_CONFIG - Invalid card config
51+
0X2D,SD_CARD_ERROR_FUNCTION_NOT_SUPPORTED - Unsupported SDIO command
52+
0X2E,SD_CARD_ERROR_UNKNOWN - Unknown error

doc/html.zip

161 KB
Binary file not shown.

doc/mainpage.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2011-2024 Bill Greiman
2+
* Copyright (c) 2011-2025 Bill Greiman
33
* This file is part of the SdFat library for SD memory cards.
44
*
55
* MIT License
@@ -149,7 +149,9 @@ will open "/music/BigBand.wav" on sd2.
149149
150150
\section Install Installation
151151
152-
You must manually install %SdFat by renaming the download folder %SdFat
152+
You can use the Arduino Library Manager to install release versions.
153+
154+
You must manually install %SdFat beta by renaming the download folder %SdFat
153155
and copy the %SdFat folder to the Arduino libraries folder in your
154156
sketchbook folder.
155157
@@ -247,10 +249,11 @@ debug folder - Some of my debug programs - will be remove in the future.
247249
248250
DirectoryFunctions - Use of chdir(), ls(), mkdir(), and rmdir().
249251
250-
examplesV1 folder - Examples from SdFat V1 for compatibility tests.
252+
examplesV1 folder - Examples from SdFat V1 soon to be removed.
251253
252254
ExFatLogger - A data-logger optimized for exFAT features.
253255
256+
254257
MinimumSizeSdReader - Example of small file reader for FAT16/FAT32.
255258
256259
OpenNext - Open all files in the root dir and print their filename.
@@ -261,6 +264,10 @@ ReadCsvFile - Function to read a CSV text file one field at a time.
261264
262265
rename - demonstrates use of rename().
263266
267+
RingBufLogger - Use of RingBuf class for fast data logging.
268+
269+
Rp2040SdioSetup - Setup test for fast PIO SDIO.
270+
264271
RtcTimestampTest - Demonstration of timestamps with RTClib.
265272
266273
SdErrorCodes - Produce a list of error codes.
@@ -271,7 +278,7 @@ SdInfo - Initialize an SD card and analyze its structure for trouble shooting.
271278
272279
SoftwareSpi - Demo of limited Software SPI support in SdFat V2.
273280
274-
STM32Test - Example use of two SPI ports on an STM32 board.
281+
SpiLoopBackTest - Loop-back test of SPI pins.
275282
276283
TeensyDmaAdcLogger - Fast logger using DMA ADC.
277284

examples/AvrAdcLogger/AvrAdcLogger.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef AnalogBinLogger_h
2-
#define AnalogBinLogger_h
1+
#pragma once
32
const size_t BLOCK_SIZE = 64;
43
//------------------------------------------------------------------------------
54
// First block of file.
@@ -30,4 +29,3 @@ struct block16_t {
3029
unsigned short overrun; // count of overruns since last block
3130
unsigned short data[DATA_DIM16];
3231
};
33-
#endif // AnalogBinLogger_h

examples/BufferedPrint/BufferedPrint.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Test and benchmark of the fast bufferedPrint class.
22
//
33
// Mainly for AVR but may improve print performance with other CPUs.
4-
#define DISABLE_FS_H_WARNING // Disable warning for type File not defined.
4+
#ifndef DISABLE_FS_H_WARNING
5+
#define DISABLE_FS_H_WARNING // Disable warning for type File not defined.
6+
#endif // DISABLE_FS_H_WARNING
57
#include "SdFat.h"
68
#include "BufferedPrint.h"
79
// SD_FAT_TYPE = 0 for SdFat/File as defined in SdFatConfig.h,

examples/DirectoryFunctions/DirectoryFunctions.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/*
22
* Example use of chdir(), ls(), mkdir(), and rmdir().
33
*/
4+
#ifndef DISABLE_FS_H_WARNING
45
#define DISABLE_FS_H_WARNING // Disable warning for type File not defined.
6+
#endif // DISABLE_FS_H_WARNING
57
#include "SdFat.h"
68
#include "sdios.h"
79

examples/ExFatLogger/ExFatLogger.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Avoid IDE problems by defining struct in septate .h file.
22
// Pad record so size is a power of two for best write performance.
3-
#ifndef ExFatLogger_h
4-
#define ExFatLogger_h
3+
#pragma once
54
const size_t ADC_COUNT = 4;
65
struct data_t {
76
uint16_t adc[ADC_COUNT];
87
};
9-
#endif // ExFatLogger_h

examples/ExFatLogger/ExFatLogger.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
//
44
// The maximum data rate will depend on the quality of your SD,
55
// the size of the FIFO, and using dedicated SPI.
6-
#define DISABLE_FS_H_WARNING // Disable warning for type File not defined.
6+
#ifndef DISABLE_FS_H_WARNING
7+
#define DISABLE_FS_H_WARNING // Disable warning for type File not defined.
8+
#endif // DISABLE_FS_H_WARNING
79
#include "SdFat.h"
8-
#include "ExFatLogger.h"
910
#include "FreeStack.h"
11+
#include "ExFatLogger.h"
1012
//------------------------------------------------------------------------------
1113
// This example was designed for exFAT but will support FAT16/FAT32.
1214
// Note: Uno will not support SD_FAT_TYPE = 3.

0 commit comments

Comments
 (0)