Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to skip n SPI data bits #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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