Skip to content

Commit 9cf5880

Browse files
authored
Merge pull request #10962 from mikeysklar/docs-sdcardio-cs-invariant
docs(sdcardio): replace init-order note with the real shared-SPI CS invariant
2 parents b8e4fc6 + 710b77b commit 9cf5880

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

shared-bindings/sdcardio/SDCard.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,18 @@
3838
//| the microcontroller)
3939
//|
4040
//| .. important::
41-
//| If the same SPI bus is shared with other peripherals, it is important that
42-
//| the SD card be initialized before accessing any other peripheral on the bus.
43-
//| Failure to do so can prevent the SD card from being recognized until it is
44-
//| powered off or re-inserted.
45-
//|
46-
//| Exception: on boards where another SPI peripheral has a floating CS
47-
//| pin with no hardware pull-up (such as the Feather RP2040 RFM), that
48-
//| peripheral's CS must be driven HIGH before SD card initialization.
49-
//| Failure to do so will corrupt the SPI bus during SD card init. In
50-
//| these cases, initialize and drive the other peripheral's CS high
51-
//| first, then initialize the SD card.
41+
//| When the SPI bus is shared with other peripherals, every CS pin on
42+
//| the bus must be in a known HIGH (deselected) state before any SPI
43+
//| transaction occurs. This is normally guaranteed by a hardware
44+
//| pull-up on each CS line, but on boards where a co-resident
45+
//| peripheral's CS floats (for example the Feather RP2040 RFM, whose
46+
//| ``RFM_CS`` has no pull-up), that CS must be driven HIGH in
47+
//| software before the SD card is initialized. If any CS is allowed
48+
//| to float low, the SPI bus can be corrupted during SD card init
49+
//| and the card may not be recognized until it is powered off or
50+
//| re-inserted. The order in which peripherals are constructed is
51+
//| secondary; what matters is that all CS lines are HIGH (deselected)
52+
//| before any SPI transaction.
5253
//|
5354
//| Example usage:
5455
//|

0 commit comments

Comments
 (0)