linguini1 opened a new issue, #17248:
URL: https://github.com/apache/nuttx/issues/17248

   ### Description / Steps to reproduce the issue
   
   This is not really a bug, but when developing the RPi4B SDIO implementation 
in #17245, I wasted a little bit of time troubleshooting CSD parsing since the 
upper-half expects the CSD to include the trailing CRC, while some SDMMC 
controllers remove the trailing CRC before storing the response, since they 
check it in hardware.
   
   You can see that some other architectures have taken the same approach as I 
did in #17245 to shift over the bits properly for the CSD parsing. It's not 
necessary to compute the checksum, since the CSD parsing logic doesn't actually 
check the value (that is a lower-half responsibility).
   
   ## Suggested solution
   
   1. I think it should be documented in the function comment for `SDIO_RECVR2` 
that it is necessary to check if your controller removes the CRC, and if it 
does, shift over the response by 1 byte.
   2. Document this similarly in the NuttX doc website (it would be good to 
have a page about implementing an SDIO lower-half to give devs an idea of the 
call-flow).
   3. Run-time DEBUGASSERT in the CSD parsing to make sure that the CSD which 
was pased is actually valid. I'm not too familiar with the CSD contents, and 
it's likely the only way to check for a valid CSD is by the CRC, but it would 
be good if we could warn a developer at runtime that their CSD is in the wrong 
form (i.e. missing CRC and has leading 0s) so they can catch it quicker.
   
   ### On which OS does this issue occur?
   
   [OS: Linux]
   
   ### What is the version of your OS?
   
   Arch Linux
   
   ### NuttX Version
   
   master
   
   ### Issue Architecture
   
   [Arch: all]
   
   ### Issue Area
   
   [Area: Drivers], [Area: Debugging]
   
   ### Host information
   
   N/A
   
   ### Verification
   
   - [x] I have verified before submitting the report.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to