Skip to content

Conversation

danielkucera
Copy link

This is useful when you have no CS signal and want to offset the decoding by a few bits

@danielkucera danielkucera changed the title add option to skip n SPI data bits WiP: add option to skip n SPI data bits Jan 21, 2023
@danielkucera danielkucera changed the title WiP: add option to skip n SPI data bits add option to skip n SPI data bits Jan 22, 2023
@kamocat
Copy link

kamocat commented May 1, 2023

Hi Daniel, do you have a signal capture to give this some more context?
Have you considered looking for natural breaks in transmission to automatically guess where CS should be?

@danielkucera
Copy link
Author

Hi @kamocat , you can understand the context from here: https://blog.danman.eu/updating-rns315-maps-for-fun-and-profit/
What do you mean by "looking for natural breaks" ? How can I align the decoder by that?

@kamocat
Copy link

kamocat commented May 1, 2023

PulseView doesn’t have data decoding for SD card in SD mode so I had to improvise to get the password data. I have used SPI decoder, and since we don’t have chip-select signal here to properly align bits into bytes, I extended it with an option to skip bits on start. So I was able to get the password bytes decoded.

So you're using the SPI decoder to read SD card data, instead of extending the SD card decoder to output data?

@danielkucera
Copy link
Author

I know it's a shame but it's true. This was just a few lines, instead of implementing SD data decoding which would be 🤯

@kamocat
Copy link

kamocat commented May 2, 2023

It looks pretty simple to add this same functionality to the SD decoder. From the simplified SD standard,

Data Read

The DAT bus line is high by the pull-up when no data is transmitted. A transmitted data block consists of start bits (1 or 4 bits LOW), followed by a continuous data stream.
...

Data Write

The data transfer format is similar to the data read format.

So all you have to do is look for a falling edge on DAT0, and stop when all the data lines are high for 512 bits in a row.
True, it's not the full standard, but it gets you at least as far as the SPI bit offset, without guessing what the offset should be.

@danielkucera
Copy link
Author

And handle 1-bit, 2-bit, 4-bit, 8-bit mode, CRC, and, and, and...
Sorry, I am not going into this.

@danielkucera
Copy link
Author

Hi @kamocat ,

so no merge for me here?

@kamocat
Copy link

kamocat commented Jun 11, 2025

Hi Daniel,
I'm not thrilled with the testability of this, because it requires manual intervention to specify what the offset should be based on interpretation of the result. Maybe we can get an official maintainer to weigh in.
@abraxa @uwehermann What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants