Commit Graph

28 Commits

Author SHA1 Message Date
Martin Vychodil
56f2001317 sdmmc/sdspi: allow custom setup of SD card frequency
In order to allow flexible setup of SD card frequency, sdmmc_host_t.max_freq_khz is used as a limit

Closes https://github.com/espressif/arduino-esp32/issues/6225
2022-09-12 17:08:36 +02:00
Martin Vychodil
d7e3072040 Merge branch 'fix/sdspi_no_cs' into 'master'
sdspi: Allow CS line to be set to GPIO_NUM_NC (-1)

Closes IDFGH-6175

See merge request espressif/esp-idf!19420
2022-08-11 20:17:26 +08:00
Adam Múdry
afe78ba0aa sdspi: Allow CS line to be set to GPIO_NUM_NC (-1)
Closes https://github.com/espressif/esp-idf/issues/7852
2022-08-08 09:13:36 +00:00
morris
d91c8759c0 driver: remove -Wno-format flag 2022-08-08 08:30:09 +00:00
Matus Fabo
384d61f156 remove: sdspi_host deprecated api
add: migration guide documentation
2022-06-12 20:07:27 +00:00
Ivan Grokhotkov
3ad98984e9
driver: sdspi: add support for R1b response
Same as R1 but with busy indication polling
2022-05-30 15:39:01 +02:00
lovyan03
8bb95150bf sdspi_host: bugfix The clock may be sent out before the bus that was used immediately before is released.
Merges https://github.com/espressif/esp-idf/pull/7710
2022-01-18 21:07:10 +00:00
Jan Brudný
690974e32f driver: update copyright notice 2021-05-25 17:43:57 +02:00
morris
753a929525 global: fix sign-compare warnings 2021-01-12 14:05:08 +08:00
morris
a4d0033c03 esp_rom: extract common GPIO apis into esp_rom_gpio.h 2020-07-07 11:40:19 +08:00
Michael (XIAO Xufeng)
48a62b3490 sdspi: use polling transactions to increase reading speed. 2020-02-12 15:16:19 +08:00
Michael (XIAO Xufeng)
067f3d21c9 sdspi, vfs_fat: allow sharing SPI bus among devices, and mounting multiple SD cards 2020-02-12 15:16:08 +08:00
Michael (XIAO Xufeng)
7026087dc0 spi: support esp32s2 2020-01-26 17:24:12 +08:00
Michael (XIAO Xufeng)
e91c7bcc3a sdspi: revert pin configs when deinit 2019-12-03 22:58:42 +08:00
Ivan Grokhotkov
5b6b624e1f driver: fix gpio pin_bit_mask truncation in sdspi_host and others
Closes https://github.com/espressif/esp-idf/issues/4348
2019-11-18 13:42:22 +01:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Michael (XIAO Xufeng)
28b2e113ca spi_master: move the spi_bus_init function into common header 2019-06-27 13:27:26 +08:00
michael
8a364b4bdf sdmmc: support SDIO over SPI 2019-04-12 02:24:28 +08:00
Angus Gratton
a67d5d89e0 Replace all DOS line endings with Unix
Command run was:
git ls-tree -r HEAD --name-only | xargs dos2unix
2018-07-12 19:10:37 +08:00
Ivan Grokhotkov
2699bb49ae sdspi: handle delayed responses for data write commands
Command response tokens can be delayed from the original command by 1
to 8 bytes. In 4a2489b9, handling for delayed tokens was added for
normal (no data) commands, and data read commands. This adds handling
for delayed commands for data write commands.
2018-04-26 10:04:44 +08:00
Ivan Grokhotkov
92a16ac6e6 sdspi: fix CD and WP incorrectly configured as outputs 2018-04-23 14:35:40 +08:00
Flavio Bayer
d477d3c5bd bugfix/sdspi_host.c: wrong CD/WP pin configuration
Looks like the configuration of CP and WP pins are wrong, since the check for `gpio_cd` and `gpio_wp` in `slot_config` seems to be swapped.
2018-04-23 11:32:42 +10:00
Ivan Grokhotkov
c6829fa5b8 sdmmc: improve error handling during SPI mode init
- In SPI mode, the card will respond to the initial SDIO reset (done
using CMD52) with “invalid command” error. Handle this correctly.

- sdmmc_card_init had a hack where GO_IDLE_STATE (CMD0) command was
sent twice. Add explanation why this is done, and don’t expect
correct response from the card on first CMD0.

- improve logs printed at debug level by adding CMD index
2018-04-11 11:11:17 +08:00
Ivan Grokhotkov
4a2489b99a sdspi: fix compatibility issue in multi block read
SDSPI driver optimized polling of the response tokens by requesting
two extra bytes on top of the block size (512) and CRC (2), and
checking whether these bytes contained the data response token or
not. In case the token was there, further polling would not need to
happen, thereby reducing latency between two consecutive blocks
transferred. However this caused compatibility issues when these two
extra bytes were sent after reading the final block. When
STOP_TRANSMISSION command was sent, these extra two bytes were
treated as part of the command, causing an invalid command error.

This fixes the logic by only requesting extra two bytes if the block
being read is not the final block. In addition to that, more strict
error checking is implemented for command response tokens.
2018-03-30 18:49:42 +08:00
Ivan Grokhotkov
229f67b816 sdspi: handle delayed R1 responses for data read commands 2018-03-30 18:49:42 +08:00
Ivan Grokhotkov
269486ca4d sdspi: use response timeout passed from upper layer
Previously SDSPI host driver would rely on retry count when waiting for
the card to read or write data. This caused different timeout times
depending on CPU frequency and card clock frequency. In practice, card
performance does not depend on these two factors.
This change uses timeout_ms field of sdmmc_command_t introduced
previously for SDMMC host.

Fixes https://esp32.com/viewtopic.php?f=2&t=3440&p=16037 and similar
issues related to SDSPI timeouts.
2017-12-11 11:07:08 +08:00
michael
1b91cb7be0 fix(sdspi): fix issues causing the sdspi driver to work low efficiently with DMA. 2017-09-19 19:00:47 +08:00
Dmitry Yakovlev
e5bb45f381 driver: SD protocol driver for SPI peripheral 2017-07-20 13:43:07 +08:00