Dear Alice,
thank you for you reply.
I have to develope a project that receives and transmits data from USB port. I have three cases:
a) The application has to receive and send data
b) The application only has to receive data (it doesn't transmit anything)
c) The application only has to transmit data (it doesn't receive anything)
I'm using LPC55S28-EVK and MCUXpresso IDE v11.5.1 [Build 7266] [2022-04-13]
I started from the sdk example dev_cdc_vcom_bm and I connected the USB port of PC to the board via 'full speed' USB port. Using PuTTY software I can send and receive chars to and from theboard and it works fine: Case a) is OK.
Than I commented out the lines from 630 to 639 of the file virtual_com.c
if ((0 != s_recvSize) && (USB_CANCELLED_TRANSFER_LENGTH != s_recvSize))
{
int32_t i;
/* Copy Buffer to Send Buff */
for (i = 0; i < s_recvSize; i++)
{
s_currSendBuf[s_sendSize++] = s_currRecvBuf[i];
}
s_recvSize = 0;
}
#if 0
if (s_sendSize)
{
uint32_t size = s_sendSize;
s_sendSize = 0;
error = USB_DeviceCdcAcmSend(s_cdcVcom.cdcAcmHandle, USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, size);
if (error != kStatus_USB_Success)
{
/* Failure to send Data Handling code here */
}
}
#endif
in order to simulate the case b)
I set a breakpoint on the line 632 as you suggested in your previouse post
s_currSendBuf[s_sendSize++] = s_currRecvBuf[i];
Then I started PuTTY software and I typed one key on the PC keyboard. The software stops at the brackpoint and the the s_recvSize is equale 1. The received char on the first position of s_currRecvBuf is 'a' (I typed 'a' on the PC keyboard).
Than I clicked on the 'Resume' icon of the MCUXpresso IDE software to continue the debug.
Than I typed another char ('b') on the PC keyboard but the software doesn't stop at the breakcpoint: the character 'b' is not received. Case b) does'nt work.
Than I modified the virtual_com.c file as follow:
/* endpoint callback length is USB_CANCELLED_TRANSFER_LENGTH (0xFFFFFFFFU) when transfer is canceled */
#if 0
if ((0 != s_recvSize) && (USB_CANCELLED_TRANSFER_LENGTH != s_recvSize))
{
int32_t i;
/* Copy Buffer to Send Buff */
for (i = 0; i < s_recvSize; i++)
{
s_currSendBuf[s_sendSize++] = s_currRecvBuf[i];
}
s_recvSize = 0;
}
#endif
s_currSendBuf[0]='a';
s_currSendBuf[1]='b';
s_currSendBuf[2]=' ';
s_sendSize=3;
if (s_sendSize)
{
uint32_t size = s_sendSize;
s_sendSize = 0;
error = USB_DeviceCdcAcmSend(s_cdcVcom.cdcAcmHandle, USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, size);
if (error != kStatus_USB_Success)
{
/* Failure to send Data Handling code here */
}
}
in order to simulate the 'Case c) (the application transmits but doesn't receive)
As usual I used the PuTTY software and I noticed that the string 'ab ' is correctly transmited and received by the PC: case c) is OK.
Just for summaty:
a) The application has to receive and send data: It works.
b) The application only has to receive data (it doesn't transmit anything): It doesn't work.
c) The application only has to transmit data (it doesn't receive anything): It works.
Did yoy have any similar problem ?
How did you fixed it ?
Thank you for your help and cooperation
regards