Debug Print on USB Interface.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ankitvats846
Level 2
Level 2
10 questions asked 25 sign-ins 10 replies posted

Hi , on my device there no UART pins. 

I take the reference of "cyfxusbdebug" example code to print the Debug messages on USB interface. 

I configure the Endpoint as interrupt endpoint. 

epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_INTR;
epCfg.burstLen = (usbSpeed == CY_U3P_SUPER_SPEED) ? (BURST_LEN) : 1;
epCfg.streams = 0;
epCfg.pcktSize = size;

/* Interrupt  endpoint configuration */
 CyU3PSetEpConfig(CY_FX_EP_DEBUG, &epCfg);

After that I make the entry this endpoint on "cyfxusbdscr.c"   in   CyFxUSBSSConfigDscr[], CyFxUSBHSConfigDscr[],CyFxUSBFSConfigDscr[]  descriptors 

 

And Host application retrieve the data through interrupt endpoint.

while (1)
{
// cout << "In Thread" << endl;
if ((lpParams->IsOpen() == TRUE) && 1)
{
if (lpParams->InterruptInEndPt)
{
length = lsize - 1;
if ((lpParams->InterruptInEndPt->XferData(fInBuf, length) == FALSE))
{
Sleep(100);
cout << "InterruptInEndPt->XferData Failure!" << endl;
}
else
{
cout << "RD= " << length << endl;
if (length == 0)
{
cout << "IN THREAD LENGTH_0" << endl;
#if 0
if ((m_bLogFileOpenFlag == TRUE))
{
fclose(wrLogFile);
m_bLogFileOpenFlag = FALSE;
}
#endif
Sleep(100);
}
else
{
cout << "IN THREAD LENGTH_NON_0" << endl;
fInBuf[length + 1] = '\0';
#if 0
if (m_bLogFileOpenFlag == FALSE)
{
wrLogFile = fopen(DEBUF_FILE_NAME, "a+"); //TODO FIle check
m_bLogFileOpenFlag = TRUE;
}
#endif
// Sleep(100);
wrLogFile = fopen("./Fwlog.txt", "a+");
fwrite((fInBuf /*+ 8*/), 1, length, wrLogFile);
fclose(wrLogFile);
}
}
}
else
{
cout << "No Interrupt Endpoint on Device" << endl;
break;
}
}

this error 

InterruptInEndPt->XferData Failure! 

 The Debug are not coming ??

0 Likes
1 Solution
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

Hello,

Can you print "length" value in host app before calling "XferData", "length" must be grate then 128.

Best Regards,
Biren

View solution in original post

0 Likes
1 Reply
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

Hello,

Can you print "length" value in host app before calling "XferData", "length" must be grate then 128.

Best Regards,
Biren

0 Likes