mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
Fix for SD card
This commit is contained in:
parent
594e85b1d7
commit
8f3604018c
@ -74,7 +74,8 @@
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
miso-pull-up;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
|
||||
@ -81,7 +81,8 @@
|
||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
miso-pull-up;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
|
||||
@ -77,7 +77,8 @@
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
miso-pull-up;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
|
||||
@ -122,7 +122,8 @@
|
||||
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
|
||||
miso-pull-up;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
status = "disabled";
|
||||
|
||||
@ -104,7 +104,8 @@
|
||||
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
|
||||
miso-pull-up;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
|
||||
@ -41,3 +41,11 @@ properties:
|
||||
element-type: "struct GpioPinSpec"
|
||||
default: "{ }"
|
||||
description: Null-terminated array of chip select GPIO pin specs for peripherals on this bus
|
||||
miso-pull-up:
|
||||
type: boolean
|
||||
default: false
|
||||
description: >
|
||||
Enables a weak internal pull-up on MISO, which floats between transactions/while another
|
||||
device on the bus is selected. Helps some SPI peripherals (a garbled/invalid response on
|
||||
CMD8/if_cond has been observed for SD-over-SPI on some boards) but has been observed to
|
||||
break others (prevents the SD card from responding to CMD0 at all) - opt in per board.
|
||||
|
||||
@ -27,6 +27,14 @@ struct Esp32SpiConfig {
|
||||
struct GpioPinSpec* cs_gpios;
|
||||
/** The item count of cs_gpios */
|
||||
uint8_t cs_gpios_count;
|
||||
/**
|
||||
* Enables a weak internal pull-up on MISO, which floats between transactions/while
|
||||
* another device on the bus is selected. Helps some SPI peripherals (a garbled/invalid
|
||||
* response on CMD8/if_cond has been observed for SD-over-SPI on some boards) but has been
|
||||
* observed to break others (e.g. prevents the SD card from responding to CMD0 at all on
|
||||
* some boards) - opt in per board rather than defaulting it on for everyone.
|
||||
*/
|
||||
bool miso_pull_up;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -129,8 +129,9 @@ static error_t start(Device* device) {
|
||||
// MISO is only actively driven by the selected slave; between commands (and briefly during
|
||||
// slave selection/response) it floats, which can be read as spurious bits. A weak pull-up
|
||||
// costs nothing against an actively-driven line and avoids that, e.g. on SD-over-SPI this
|
||||
// shows up as CMD8/if_cond failing with a garbled/invalid response.
|
||||
if (data->miso_descriptor != nullptr) {
|
||||
// shows up as CMD8/if_cond failing with a garbled/invalid response. Opt-in per board though:
|
||||
// it's been observed to instead prevent an SD card from responding to CMD0 at all elsewhere.
|
||||
if (data->miso_descriptor != nullptr && dts_config->miso_pull_up) {
|
||||
gpio_descriptor_set_flags(data->miso_descriptor, GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user