purpose of timeout in fsrw driver?
ags
Posts: 386
Looking at the safe_spi.spin driver used by fsrw, I see there is some effort to keep track of time and automatically release the card after a timeout (defined as 125 ms).
Can someone explain the purpose of this? I don't see any such requirement in the SD specification. Is it a power saving step? Does it extend lifetime of the SD card? Is it to enable sharing the SPI bus with other devices?
Thanks.
Can someone explain the purpose of this? I don't see any such requirement in the SD specification. Is it a power saving step? Does it extend lifetime of the SD card? Is it to enable sharing the SPI bus with other devices?
Thanks.
Comments
Communication with an SD memory is via the SD memory controller chip which is built into every SD card along with the memory chip itself. The controller is responsible for managing the Flash memory and handling the wear levelling and mapping of bad sectors etc. Because of this the controller may take a lot longer to respond to a command and if it's really bad then too long. Since the host software is looking for a valid response then a timeout is required otherwise it is quite possible that it could be locked in an endless loop and this could also be because of an invalid sequence or because the card is stuck in block mode etc. So all the host software needs to know is if it worked or if it failed, hence the timeout.
I suppose the definitive answer will have to come from lonesock (the author).