sdcard: disable card detect pull-up resistor in card with ACMD42 #65
Labels
code
Code improvements
core
Trezor Core firmware. Runs on Trezor Model T and T2B1.
hardware only
Issue which does not appear on the emulator - but on physical device only.
Milestone
Pin 2 of the microSD socket is CD/DAT3 (MCU pin PC11).
When the microSD card gets powered-on, it enables a pull-up resistor internal to the card on CD/DAT3.
This acts as a card detect pin since the card starts up in 1-bit mode and thus DAT3 is unused for data transfer at that time.
Later we change to use a 4-bit data bus, but don't disable the card's internal card detect pull-up resistor with ACMD42.
We should probably do that just to be safe before switching to 4-bit mode at https://github.com/trezor/trezor-core/blob/cb9e7b5885a47f900c24153e22e4f93b39cbb792/embed/trezorhal/sdcard.c#L149
vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c
is useful for seeing how the HAL does its work.Here's some more example code:
https://github.com/LonelyWolf/stm32/blob/master/cube-usb-msc/sdcard-sdio.c
Will probably end up with something functionally similar to this, but need to factor code, etc...
Reference:
http://envoydatamemory.com/datasheets/EN-L0J%20Industrial%20microSD%20Card%20Spec%20Rev1.6.pdf
https://www.kingston.com/datasheets/SDCIT-specsheet-8gb-32gb_en.pdf
trezor/trezor-core#279 (comment)
The text was updated successfully, but these errors were encountered: