Hi,
The example that I use is from here.
I have to use the USB interface to send and receive data between the host PC and the nRF52840 chip.
In the example, I can only send the data from the chip to the computer through EPIN2, but can not send the data from the computer to the chip through EPOUT2.
• send the data from the chip to the computer
Press Button 2 → send the data through EPIN2 → SUCCESS (the array that the chip sent shows on the Python terminal, and "transfer complete" shows on PUTTY)
• send the data from the computer to the chip
Input the data (I use RTT Viewer to send the data. But when I input the string, it shows the warning messages.) → FAIL
What should I do to let the data transfer successfully?
What function should I add to call the NRF_DRV_USBD_EVT_EPTRANSFER event to let the receive_custom_data() function work?
static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
{
switch (p_event->type)
{
...
case NRF_DRV_USBD_EVT_EPTRANSFER:
if (NRF_DRV_USBD_EPIN2 == p_event->data.eptransfer.ep)
{
NRF_LOG_INFO("EP2IN transfer complete");
}
else if (NRF_DRV_USBD_EPOUT2 == p_event->data.eptransfer.ep)
{
NRF_LOG_INFO("EP2OUT transfer complete");
receive_custom_data();
}
...
break;
...
}