i.MX RT1064 USB Host CDC

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX RT1064 USB Host CDC

287 Views
Vagni
Contributor IV

I need help on developing my first USB Host CDC application on i.MX RT1064 MCU.

I started with a MIMXRT1060-EVK and the usb_host_cdc example provided in SDK_2_10_1_EVK-MIMXRT1060 for MCUXpresso IDE.

In this example the USB Host CDC task sends to the connected and properly enumerated USB CDC Device what receives from the UART, then waits an echo from the USB CDC Device to be sent to the UART.

My application needs to communicate with an AT Command Interface provided by the USB Device (a modem). So, I need to send AT command and receive AT replies, but I also need to receive unsolicited messages from the modem device.

I see USB_HostCdcDataSend() function is used to send data to the USB Device and USB_HostCdcDataRecv() function is used to receive data from the USB Device.

When I call USB_HostCdcDataRecv() function, I should wait for the end reception call-back. But what if I receive nothing? Is there a way to use a reception timeout? How can I abort USB Host CDC reception in order to start to send some data with USB_HostCdcDataSend() function?

In the end transmission call-back I would call USB_HostCdcDataRecv() to return my USB Host CDC in reception mode. How can I be sure that the end transmission call-back is always called? Is there a way to use a transmission timeout and/or to abort the transmission?

What is the right way to use the USB_HostCdcDataRecv() and USB_HostCdcDataSend() functions like in the case of an UART handled in half-duplex mode (in transmission mode when needed, otherwise always in reception mode)?

Thanks!

0 Kudos
1 Reply

231 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @Vagni 

I don't understand "In the end transmission call-back I would call USB_HostCdcDataRecv() to return my USB Host CDC in reception mode" means, can you clarify it?

The send and receive logic is designed in application layer. USB host can receive all the data.  

if you need to receive the data all the time. please call USB_HostCdcDataRecv in your main loop.

 

Regards

Daniel

0 Kudos