If using the 4 bit mode on a eMMC the card detect is working .
If i switch to 8 bit mode, the CyU3PSibQeryDevice returns a numBlks which is 256 times to small !
Shifting numBlks 8 times don't solve the problem, because CyU3PSibReadWriteRequest return with a CY_U3P_ERROR_INVALID_ADDR. The ReadWrite command is not using the patched numBlks to check the address range.
Which variable is used to check the address range ?
I have tested FX3SMassStorage example project with 4-bit and 8-bit eMMC mode on S0 port. (When UART is used for logging, since we can configure S1 port only as 4-bits wide, I have tested on S0 port). I have attached the logs for your reference. In the logs, you can see that the numBlks value does not change when busWidth=1(4-bit mode) or busWidth=2(8-bit mode)
Could you provide the following information:
Are you observing this with the FX3SMassStorage example project or with a modified version?
I think it is a problem with the samsung chip I'm using.
The CyU3CardMgrMmcInit function is testing the bus before reading the Ext_CSD register. If the EXT_CSD is read in 4 bit mode the data is ok. If read in 8 bit mode one byte is missed, but without CRC error. Later I can read the chip without problems in 8 bit mode.
I have fixed the problem by reading the EXT_CSD before switching the bus to 4/8 bit mode.