jamchamb/gc-memcard-adapter

opening sequence 1000hz

Opened this issue · 4 comments

Hello,

Apologies for contacting you this way, but i have found no other way to contact you.
I am trying to understand your code, because i want to use it on a different board.
What i do not undestand is the bit in your adapter.py that you have labeled opening sequence (line 197).
It uses the xfer2 function to write spi data at 1000 hz as far as i can see, but the raspberry pi only supports down to 3800hz spi speed according to documentation. Is the speed for this opening sequence not that important, or am i missing something?
I found no mention of this sequence on YAGCD or anywhere, so i would appreciate any information you can give me.

It's based on this sequence, the actual rate here is around 800 kHz. Not sure why I had 1000, but it looks like that came out to around 6 kHz when running it from the RasPi.

memcard_00FF00

Thanks a lot for your help! Sorry for not responding for such a long time. I had some medical issues do deal with, but i'm all good now, so i wanted to get back into this. It seems to me that the frequency of this opening sequence does not really matter. I built a card reader from an old Wii dual memory card slot, but unfortunately i still haven't been able to get your code working. Even using the same Raspberry Pi it only reads random garbage and fails to verify the card size. I recorded the get_status command with a logic analyzer and the response from the card looks very wrong. After that i tried my card reader hardware on an actual gamecube and it works fine. Also it looks like you are using 16 or 32 bits per word which should not be possible with the Raspberry Pi model B according to documentation. Maybe you can shed some light on this? Here is what the code does on my board:
SCR02

The RasPi model I've tested it with is a 3B, and the memory card hardware is one of the newer third-party cards from Amazon as shown in the blog post. I recall that the initial read sometimes returns garbled data (this is why I added the card size sanity check at the beginning), but it works on the second try and from then on until the card is powered off.

Could you point me to the documentation you're referring to?

Well that's good to know, because i somehow thought it was an original model B, which i have been using. I will look into buying a 3B but i don't understand what would prevent my other boards from being able to do this. The documentation i was referring to was for the spidev python library: https://sigmdel.ca/michel/ha/rpi/dnld/draft_spidev_doc.pdf i don't know how official this is, but that's what google turned up. Specifically i was referring to the beginning of section seven (Class Attributes).