SDMMC Command structure

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi I'm currently working with the the SD Interface of the XMC4500 controler.
To familirize me with the interface I'm currently looking with the SDMMC App of DAVE3. I needed the SD CMDs and tryped to store them not as they are stored in the example app but as defines. But by doing this I realized, that there is a part I don't understand. the SD CMDs are stored in a bitfeeld. But the occupation of the bitfeeld is revers to the SDMMC->COMAND register description.


As far as I know you can see a struct like an array with different data types. So the elements in the struct are in a sequential order, inside the memory, starting with the first element of the struct. But if this is the case then writing the content of this struct to the COMAND register would write this bits in a reversed order. I know there are some cases where a processor uses a reversed bit order but i think it isn't the case here because using other registers uses the "correct" bitorder.

So maybe someone can explane it to me. I didn't work with bitfeelds before maybe there is another bitorder then in structs or there is any other thing what I messed up. The example app works fine so the bit field must be correct but in my oppinion the bit order for writing a CMD to the COMAND register should be reversed.

for example:
read single block cmd.

how it is stored in the array

{2U,0U,1U,1U,1U,0U,SDMMC003_READ_SINGLE_BLOCK,0U}

what i thought it should look like

{0U,SDMMC003_READ_SINGLE_BLOCK,0U,1U,1U,1U,0U,2U} (cause this is like the datasheet descripes the COMAND register)

I know it is correct how it is, i just hope some one can help me to understand it.

Regards

Thomas
0 Likes
1 Reply
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi briddl,

My colleague shall assist on this issue.

Best Regards
Travis
0 Likes