Skip to content

Commit 841277d

Browse files
committed
sdcard_sd: Decode commands always as command
The SD card decoder predicts always the next token type from the current token type. This is working if the SD card is responding as expected. But if the card is not responding, the prediction is wrong. A second command token is decoded as a response token. To fix this behavior the decoder state is set to St.GET_COMMAND_TOKEN, if the current token is a command token.
1 parent 71f4514 commit 841277d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

decoders/sdcard_sd/pd.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ def get_token_bits(self, cmd_pin, n):
142142
self.token.append(Bit(self.samplenum, self.samplenum, cmd_pin))
143143
if len(self.token) > 0:
144144
self.token[len(self.token) - 2].es = self.samplenum
145+
# check the transmission bit if this is a command
146+
if len(self.token) == 2:
147+
transmission = self.token[1].bit
148+
if transmission:
149+
self.state = St.GET_COMMAND_TOKEN
145150
if len(self.token) < n:
146151
return False
147152
self.token[n - 1].es += self.token[n - 1].ss - self.token[n - 2].ss

0 commit comments

Comments
 (0)