I'm trying to port the STM32 USB host+MSC driver to the little board fez cerb40 (stm32F405rg) to allow it to read a USB stick.
I'm blocked on a problem since several days.
I followed the guide and the CORE steps are OK.
The name of the KEY and manufactor are OK.
Then in the MSC_handle states :
. Get Max LUN is OK
. Test unit ready is OK
. mode sens 6 is OK
. request sens is OK
(Some of them use the CBW / DATA / CSW mechanism. )
After that, the process arrives in the application state when i try to access the file system.
During the first READ (disk_read in usb_msc_fatfs.c) which occured during that FAT function chk_mounted, the program freezes.
What happens is a toggle error while reading the CSW. (USBH_MSC_RECEIVE_CSW_STATE).
The error is not tracked so the program goes in an infinite loop.
If I removed the CSW check part and make it return with an OK status.
After that, I was able to mount the file system and even read file on it.
I read a small file an display the content on my LCD, it was correct.
What can make the "Receive CSW" receving a toggle error during the SCSI command ?
Thanks for any idea or suggestion i could investigate,