- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone,
i have two questions regarding the application examples for the Cypress FX3S.
The first question is for the FX3SMassStorage example, CyFxMscApplnSibCB function:
In the same function, two kind of errors are managed by resetting the DMA Channels. But glCmdDirection is used to reset different channels:
First case:
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT)
{
if (status != CY_U3P_SUCCESS)
{
glMscCmdStatus = 1;
glSensePtr[portId] = CY_FX_MSC_SENSE_CRC_ERROR;
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaChannelReset (&glChHandleMscIn); // <-- resets the bulk_in channel
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaChannelReset (&glChHandleMscOut); // <-- resets the bulk_out channel
}
}
}
Second case:
if ((evt == CY_U3P_SIB_EVENT_DATA_ERROR) || (evt == CY_U3P_SIB_EVENT_ABORT))
{
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection)
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscOut); // <-- resets the bulk_out channel
}
else
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscIn); // <-- resets the bulk_in channel
}
/* Make sure the request is aborted and that the controller is reset. */
CyU3PSibAbortRequest (portId);
}
Why is it different?
---------------
Second question, regarding the RAID1 application note example (AN89661):
Analyzing the content of the CyFxMscApplnSibCB function, I have found different behavior on error conditions:
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT) {
glSPortPending &= ~(1 << portId);
if (status != CY_U3P_SUCCESS) {
...
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection) {
CyU3PDmaSocketGetConfig((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET), &sockConf);
glMscResidue -= sockConf.xferCount;
if (glRaidMultiChannelValid)
CyU3PDmaMultiChannelReset((CyU3PDmaMultiChannel *)&glChHandleUSBOut);
else
CyU3PDmaChannelReset(&glChHandleWrErrIn);
} else {
CyU3PDmaSocketGetConfig((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET), &sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaMultiChannelReset(&glChHandleUSBOut);
}
}
Regardless of glCmdDirection, the glChHandleUSBOut is reset. This example differs from FX3SMassStorage (the first code excerpt). Could this be a bug?
I hope this post is clear enough. Thanks in advance for you time!
Salvatore.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Salvatore,
Thank you for bringing the error to our notice.
I have reported this error to respective team and the error would be fixed in the next sdk (FX3SMassStorage example firmware ) release.
As for now, you can swap the two DMA channel reset under CY_U3P_SIB_EVENT_DATA_ERROR or CY_U3P_SIB_EVENT_ABORT
if ((evt == CY_U3P_SIB_EVENT_DATA_ERROR) || (evt == CY_U3P_SIB_EVENT_ABORT))
{
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection)
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscIn);
}
else
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscOut);
}
EDITED:
The same changes need to be done for RAID1 application note example (AN89661):
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT)
.
.
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBIn);
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
if (glRaidMultiChannelValid)
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBOut);
else
CyU3PDmaChannelReset (&glChHandleWrErrIn);
}
Regards,
Rashi
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Salvatore,
Thank you for bringing the error to our notice.
I have reported this error to respective team and the error would be fixed in the next sdk (FX3SMassStorage example firmware ) release.
As for now, you can swap the two DMA channel reset under CY_U3P_SIB_EVENT_DATA_ERROR or CY_U3P_SIB_EVENT_ABORT
if ((evt == CY_U3P_SIB_EVENT_DATA_ERROR) || (evt == CY_U3P_SIB_EVENT_ABORT))
{
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection)
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscIn);
}
else
{
CyU3PDmaChannelReset ((CyU3PDmaChannel *) &glChHandleMscOut);
}
EDITED:
The same changes need to be done for RAID1 application note example (AN89661):
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT)
.
.
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBIn);
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
if (glRaidMultiChannelValid)
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBOut);
else
CyU3PDmaChannelReset (&glChHandleWrErrIn);
}
Regards,
Rashi
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rashi,
maybe i'm not getting this right, but to correct the RAID1 example, I think it should be done that way:
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET), &sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaMultiChannelReset (&glChHandleUSBIn);
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET), &sockConf);
glMscResidue -= sockConf.xferCount;
if (glRaidMultiChannelValid)
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBOut);
else
CyU3PDmaChannelReset (&glChHandleWrErrIn);
}
Is this right?
Anyway, thanks for your fast response!
Salvatore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Salvatore,
Yes, you are right.
The changes need to be done for RAID1 application note example (AN89661):
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT)
.
.
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_MSC_EP_BULK_IN_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBIn);
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_MSC_EP_BULK_OUT_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
if (glRaidMultiChannelValid)
CyU3PDmaMultiChannelReset ((CyU3PDmaMultiChannel *) &glChHandleUSBOut);
else
CyU3PDmaChannelReset (&glChHandleWrErrIn);
}
Regards,
Rashi
Rashi