f_ changed the topic of ##raspberrypi-internals to: The inner workings of the Raspberry Pi (Low level VPU/HW) -- for general queries please visit #raspberrypi -- open firmware: https://librerpi.github.io/ -- VC4 VPU Programmers Manual: https://github.com/hermanhermitage/videocoreiv/wiki -- chat logs: https://libera.irclog.whitequark.org/~h~raspberrypi-internals -- bridged to matrix and discord
Stromeko has quit [Quit: Going… gone.]
Stromeko has joined ##raspberrypi-internals
inara has quit [Quit: Leaving]
inara has joined ##raspberrypi-internals
vriska has quit [Quit: ZNC 1.8.2 - https://znc.in]
vriska has joined ##raspberrypi-internals
vriska has quit [Remote host closed the connection]
vriska has joined ##raspberrypi-internals
vriska has quit [Quit: ZNC 1.8.2 - https://znc.in]
vriska has joined ##raspberrypi-internals
Stromeko has quit [Quit: Going… gone.]
Stromeko has joined ##raspberrypi-internals
<f_ridge> <x​2x6_/D> You'd probably laugh, but I can't get CMD9 working)
<f_ridge> <x​2x6_/D> You'd probably laugh, but I can't get CMD9 working), according to spec it should always work(edited)
<f_ridge> <c​lever___/D> are you setting the reply type correctly?
sys64738 has quit [Quit: WeeChat 4.2.1]
<f_ridge> <x​2x6_/D> In CMDTM register I have to set bits as [17:16] as 0b01
<f_ridge> <x​2x6_/D> for R2
<f_ridge> <x​2x6_/D> for R2 (136bits)(edited)
<f_ridge> <c​lever___/D> my memory says its R1
<f_ridge> <c​lever___/D> ah but the pdf says R2
<f_ridge> <c​lever___/D> > Addressed card sends its card-specific data (CSD) on the CMD line.
<f_ridge> <c​lever___/D> are you including the card address in the args?
<f_ridge> <x​2x6_/D> I include RCA, but RCA is a bit stange - its 0x5048
<f_ridge> <c​lever___/D> thats normal
<f_ridge> <c​lever___/D> its basically a 16bit random number
<f_ridge> <c​lever___/D> and i assume youve `<<16`'d it?
<f_ridge> <x​2x6_/D> Yes,
<f_ridge> <x​2x6_/D> But its strange , 5 minutes ago I saw different section with different response type
<f_ridge> <c​lever___/D> same
<f_ridge> <c​lever___/D> compare pages 297 and 102
<f_ridge> <c​lever___/D> i suspect the R1 vs R2 differs, depending on the version of the card?
<f_ridge> <c​lever___/D> try setting it up as an R1 reply?
<f_ridge> <c​lever___/D> this also says "selected" not "addressed", so you need to select the card by rca with another cmd first
<f_ridge> <x​2x6_/D> Either way controller does not get a response
<f_ridge> <c​lever___/D> CMD7 to select a card
sys64738 has joined ##raspberrypi-internals
<f_ridge> <x​2x6_/D> Yep
<f_ridge> <x​2x6_/D> I run it right after select card function
<f_ridge> <x​2x6_/D> it does not work
<f_ridge> <c​lever___/D> > The following table provides a detailed description of the SPI bus commands.
<f_ridge> <c​lever___/D> oh, thats why one of them differs
<f_ridge> <x​2x6_/D> Yes, the one on page 104 I think is the more appropriate
<f_ridge> <c​lever___/D> yeah
<f_ridge> <c​lever___/D> line 346, your printing a %d and not passing it an arg
<f_ridge> <x​2x6_/D> Yes, I've added that, but in the logs i see error logged inside of the cmd9 function. I fixed that but it's still error by timeout, this happens when command takes too long
<f_ridge> <x​2x6_/D> but even without timeout it just hangs
<f_ridge> <x​2x6_/D> I mean while waiting forever response never comes
<f_ridge> <c​lever___/D> thats strange
<f_ridge> <x​2x6_/D> Yes, it's kind of depressing
<f_ridge> <x​2x6_/D> I will install linux on this card and see how raspberry reads it from kernel
<f_ridge> <c​lever___/D> where does that occur in the code? i'm having trouble finding it
<f_ridge> <c​lever___/D> installing linux to the card isnt entirely needed
<f_ridge> <c​lever___/D> you can boot from usb, and then read the card
<f_ridge> <x​2x6_/D> Running it from usb is not quick if you don't have usb)
<f_ridge> <c​lever___/D> ah, sure
<f_ridge> <x​2x6_/D> wait a sec, I'll make a branch with trials
<f_ridge> <x​2x6_/D> wait a sec, I'll make a branch with cmd9 trials(edited)
<f_ridge> <x​2x6_/D> can you go to cmd9_test_0 branch?
<f_ridge> <c​lever___/D> there
<f_ridge> <x​2x6_/D> And the other more "RAW version" is the cmd9_test_1 branch. In there I use the custom_cmd9 function, there is less nesting there
<f_ridge> <c​lever___/D> so, you have this big `sd_commands` array, that contains every command index, and its size
<f_ridge> <c​lever___/D> ah, and 623 reads that
<f_ridge> <x​2x6_/D> I see that in interrupt after setting cmdtm is receive 0x00018000 as an interrupt value.
<f_ridge> <x​2x6_/D> its bits 15 and 16,
<f_ridge> <x​2x6_/D> 15 is OR for all errors, while 16 is the actual error CTO_ERR - timeout on CMD line
<f_ridge> <x​2x6_/D> Probably the card did not respond with any kind of ACK
<f_ridge> <G​itHub Lines/D> ```c
<f_ridge> <G​itHub Lines/D> CMDTM_GEN(9, R1, 1, NA, 0, 0),
<f_ridge> <G​itHub Lines/D> ```
<f_ridge> <c​lever___/D> should this still be R1?
<f_ridge> <x​2x6_/D> No. I think its changed when we tried it 5 minutes ago and got into branch
<f_ridge> <x​2x6_/D> So R2 also will not work, tested
<f_ridge> <c​lever___/D> do other R2's work?
<f_ridge> <c​lever___/D> try doing cmd9 much late in the init process?
<f_ridge> <c​lever___/D> this also says that CMD9 can only be ran while in standby
<f_ridge> <c​lever___/D> and CMD7 moves you to transfer state
<f_ridge> <x​2x6_/D> Good point
<f_ridge> <x​2x6_/D> Looks like it is possible to run cmd7 again to go into standby again
<f_ridge> <c​lever___/D> or just do it before 7
<f_ridge> <x​2x6_/D> Before CMD7 it worked somehow
<f_ridge> <x​2x6_/D> Before cmdtm: rsp:50480500,00000000,00000000,00000000,sta:01ff0000,int:00000000
<f_ridge> <x​2x6_/D> After cmdtm: rsp:50480500,00000000,00000000,00000000,sta:00ff0001,int:00000000
<f_ridge> <x​2x6_/D> After cmdtm: rsp:800a4000,03a0e77f,325b5900,00400e00,sta:01ff0000,int:00088001
<f_ridge> <x​2x6_/D> After cmdtm: rsp:800a4000,03a0e77f,325b5900,00400e00,sta:01ff0000,int:00000000
<f_ridge> <x​2x6_/D> After cmdtm: rsp:800a4000,03a0e77f,325b5900,00400e00,sta:01ff0000,int:00000000
<f_ridge> <x​2x6_/D> rsp: is all 4 RESP registers printed
<f_ridge> <c​lever___/D> `CSD: 0x400e0032db790003ae077f800a400027`
<f_ridge> <c​lever___/D> this is what i get, when i print it in the "correct" order, that <https://archive.goughlui.com/static/csdecode2.htm> expects
<f_ridge> <c​lever___/D> `printf("CSD: 0x%08x%08x%08x%08x\n", csd[3], csd[2], csd[1], csd[0]);`
<f_ridge> <c​lever___/D> if i punch `50480500000000000000000000000000` into the decoder, i get something semi valid
<f_ridge> <x​2x6_/D> rpi doc gives idea of how 136 bits are layed out in the resp registers
<f_ridge> <c​lever___/D> that matches the order i needed with sdhost, resp0 is the lower 32bits
<f_ridge> <x​2x6_/D> Thanks for help.
<f_ridge> <x​2x6_/D> Now I need to parse it
<f_ridge> <x​2x6_/D> It's much easier, the harder part is to know where to put cmd9
<f_ridge> <x​2x6_/D> I also have the same problem sending one more register, with help of cmd58, I will check the diagrams for it later
<f_ridge> <G​itHub Lines/D> ```cpp
<f_ridge> <G​itHub Lines/D> if (SD_CSD_CSDVER(csd) == SD_CSD_CSDVER_2_0) {
<f_ridge> <G​itHub Lines/D> printf(" CSD : Ver 2.0\n");
<f_ridge> <G​itHub Lines/D> printf(" Capacity: %d\n", SD_CSD_V2_CAPACITY(csd));
<f_ridge> <G​itHub Lines/D> printf(" Size : %d\n", SD_CSD_V2_C_SIZE(csd));
<f_ridge> <G​itHub Lines/D> ```
<f_ridge> <c​lever___/D> some examples of parsing CSD
t0mm13b has quit [Ping timeout: 268 seconds]
t0mm13b has joined ##raspberrypi-internals