Not applicable
May 09, 2016
04:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 09, 2016
04:51 AM
Hi,
I' using the xmc SD card interface to read and write to an SD card. I have some problems with the block transfers from and to the card.
I send the command WriteSingleBlock (CMD24) or WriteMultipleBlocks (CMD24). Than I wait on CMD_COMPLETE flag in INT_STATUS_NORM Register.
After this I get the command response and wait on the BUFFER_WRITE_READY Flag in in INT_STATUS_NORM Register. But this never goes signaled.
When I use the WRITE_TRANSFER_ACTIVE Flag of the PRESENT_STATE Register it is running because this is signaled and the WRITE_READY not.
I enabled BUFFER_WRITE_READY in the EN_INT_STATUS_NORM Register but it is never working.
I looked also in the Dave FATFS example they use also the BUFFER_WRITE_READY like I.
What is the mistake?
regards
I' using the xmc SD card interface to read and write to an SD card. I have some problems with the block transfers from and to the card.
I send the command WriteSingleBlock (CMD24) or WriteMultipleBlocks (CMD24). Than I wait on CMD_COMPLETE flag in INT_STATUS_NORM Register.
After this I get the command response and wait on the BUFFER_WRITE_READY Flag in in INT_STATUS_NORM Register. But this never goes signaled.
When I use the WRITE_TRANSFER_ACTIVE Flag of the PRESENT_STATE Register it is running because this is signaled and the WRITE_READY not.
I enabled BUFFER_WRITE_READY in the EN_INT_STATUS_NORM Register but it is never working.
I looked also in the Dave FATFS example they use also the BUFFER_WRITE_READY like I.
What is the mistake?
regards
- Tags:
- IFX
4 Replies
May 11, 2016
08:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 11, 2016
08:29 PM
Hi,
Currently DAVE4 had got an app for SD card and I had tested this to be working good. Please give this a try.
Currently DAVE4 had got an app for SD card and I had tested this to be working good. Please give this a try.
Not applicable
May 12, 2016
06:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 12, 2016
06:57 AM
Hi Travis,
I looked in the app and the app is doing it in the same way I want to do.
I can read now. this mean the signal BUFFER_READ_READY becomes signaled.
But the write signal BUFFER_WRITE_READY didn't got signaled. But in the PRESENT_STATE register it is set 0x0506 (the 5 means BUFFER_WRITE_ENABLE and WRITE_TRANSFER_ACTIVE).
And if I use this BUFFER_WRITE_ENABLE for writing to the FIFO it works.
regards
I looked in the app and the app is doing it in the same way I want to do.
I can read now. this mean the signal BUFFER_READ_READY becomes signaled.
But the write signal BUFFER_WRITE_READY didn't got signaled. But in the PRESENT_STATE register it is set 0x0506 (the 5 means BUFFER_WRITE_ENABLE and WRITE_TRANSFER_ACTIVE).
And if I use this BUFFER_WRITE_ENABLE for writing to the FIFO it works.
regards
Not applicable
May 12, 2016
11:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 12, 2016
11:13 PM
[HTML]
eStatus = SDCard_SendCommand(XMC_SDMMC, tCmd, u32Arg, XMC_SDMMC_RESPONSE_TYPE_R1, &u32Temp);
// Read/write block data
while ((ESDS_SUCCESS == eStatus) && (u32BlockCount > 0U))
{
eStatus = SDCARD_WaitForEvents(pSDMMC, XMC_SDMMC_BUFFER_READ_READY | XMC_SDMMC_BUFFER_WRITE_READY | SDMMC_DATA_ERROR_EVENT);
//while (!((SDMMC_PRESENT_STATE_BUFFER_READ_ENABLE_Msk | SDMMC_PRESENT_STATE_BUFFER_WRITE_ENABLE_Msk) & XMC_SDMMC_GetPresentState(pSDMMC).b32));
if (ESDS_SUCCESS == eStatus)
{
for (u32Temp = 0; u32Temp < u16BlockSize>>2; u32Temp++)
{
if (XMC_SDMMC_DATA_TRANSFER_HOST_TO_CARD == eIsCardToHostDirection)
XMC_SDMMC_WriteFIFO(XMC_SDMMC, pu32Data);
else *pu32Data = XMC_SDMMC_ReadFIFO(XMC_SDMMC);
pu32Data++;
}
u32BlockCount--;
}
}
[/HTML]
If I use the while loop with the get present state register it reading and working works fine.
If I use WaitForEvents it hangs in my while loop if I do a write transfer. The read transfer is successful running.
[HTML]
do
{
u32Register = (((TUINT32)pSDMMC->INT_STATUS_ERR) << 16) | pSDMMC->INT_STATUS_NORM;
u32Temp |= u32Register;
u32Register &= u32Events;
}
while (!u32Register);
XMC_SDMMC_ClearEvent(pSDMMC, u32Register);
[/HTML]
eStatus = SDCard_SendCommand(XMC_SDMMC, tCmd, u32Arg, XMC_SDMMC_RESPONSE_TYPE_R1, &u32Temp);
// Read/write block data
while ((ESDS_SUCCESS == eStatus) && (u32BlockCount > 0U))
{
eStatus = SDCARD_WaitForEvents(pSDMMC, XMC_SDMMC_BUFFER_READ_READY | XMC_SDMMC_BUFFER_WRITE_READY | SDMMC_DATA_ERROR_EVENT);
//while (!((SDMMC_PRESENT_STATE_BUFFER_READ_ENABLE_Msk | SDMMC_PRESENT_STATE_BUFFER_WRITE_ENABLE_Msk) & XMC_SDMMC_GetPresentState(pSDMMC).b32));
if (ESDS_SUCCESS == eStatus)
{
for (u32Temp = 0; u32Temp < u16BlockSize>>2; u32Temp++)
{
if (XMC_SDMMC_DATA_TRANSFER_HOST_TO_CARD == eIsCardToHostDirection)
XMC_SDMMC_WriteFIFO(XMC_SDMMC, pu32Data);
else *pu32Data = XMC_SDMMC_ReadFIFO(XMC_SDMMC);
pu32Data++;
}
u32BlockCount--;
}
}
[/HTML]
If I use the while loop with the get present state register it reading and working works fine.
If I use WaitForEvents it hangs in my while loop if I do a write transfer. The read transfer is successful running.
[HTML]
do
{
u32Register = (((TUINT32)pSDMMC->INT_STATUS_ERR) << 16) | pSDMMC->INT_STATUS_NORM;
u32Temp |= u32Register;
u32Register &= u32Events;
}
while (!u32Register);
XMC_SDMMC_ClearEvent(pSDMMC, u32Register);
[/HTML]
Not applicable
May 13, 2016
01:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 13, 2016
01:06 AM
I found the problem maybe this is a xmc4500 bug
The Bit BUFFER_WRITE_READY is set but if I clear the bit TX_COMPLETE the BUFFER_WRITE_READY bit is also cleared. But in the reference manual is written that every bit is cleared by writing 1 to this bit an not that the writing 1 to bit TX_COMPLETE clears also WRITE_READY
regards
The Bit BUFFER_WRITE_READY is set but if I clear the bit TX_COMPLETE the BUFFER_WRITE_READY bit is also cleared. But in the reference manual is written that every bit is cleared by writing 1 to this bit an not that the writing 1 to bit TX_COMPLETE clears also WRITE_READY
regards