MQX CDC ACM Communication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX CDC ACM Communication

1,366 Views
kirankunnath
Contributor II

Hello All,

     I need to connect a USB CDC ACM modem device to the MCU. I have to send and receive data packets to and from modem through USB interface. My modem device is having a UART interface for controlling the modem with AT commands. I have gone through MQX example for USB host CDC device. In this example, as per my understanding, after reading data from UART hyper-terminal, it will  write to the device through USB interface. And after reading data from the device through USB interface, it will display the data in hyper-terminal by UART.

For me i need to send a data buffer to modem. For this can i pass data "myBuffer" directly to the below API in the cdc_serial.c,without using UART APIs?

fwrite( myBuffer, sizeof(buffer[0]), num, f_usb);in the cdc_serial.c ?

Similarly For reading data from modem to my local buffer, can i directly use the API

fread(myBuffer, 1, sizeof(myBuffer) / sizeof(myBuffer[0]) - num, f_usb);?

All the enumeration should be done with this example code cdc_serial.c?

I don't have much idea about the CDC ACM communication.

One  basic question,

What is the relation between CDC ACM device and USB COM communication? I went through different documents, still i have some confusion.

When i connect a cdc device to the host MCU, the device will be considered as a USB device or UART device?

Please help me to solve this issue.

Thanks in advance,

Kiran

Tags (2)
0 Kudos
2 Replies

770 Views
mauricioscalera
Contributor II

Hi, Kiran,

I have developed a customized USB communication through a Virtual COM (CDC ACM). It is based on a 8-bits microcontroller - particularly MC9S08JS family - working on CodeWarrior Development Studio 10.3. Although it is not a MQX application, it could be useful to understand better how this USB class works. I have just shared this project as well as attaching some files. You can find this document opening my profile or browsing the following tags: cdc usb microcontroller 8-bits mc9s08js.

Please, check out it and let me know if you have any questions.

I hope it can help you.

Best regards,

Mauricio.

770 Views
kirankunnath
Contributor II

Hello All , I will ask the same issue in a better way.......

   I need to connect a USB CDC ACM modem device to the MCU-tWRK60D100.

Modem-MCU is having 2 communication interface. One usb and one UART. 

I have to send and receive data to and from modem through USB interface .

And UART interface for controlling the modem with AT commands.

I have few queries regarding this setup. I will ask one by one.

1) I don't have much idea about the CDC ACM communication. So One  basic question,

When i connect a cdc device(Modem) to the host MCU, the device will be considered as

a USB device or UART device?

In the MQX CDC serial example, usb device is open using "tty0".ie will the device 

use one physical serial port of the MCU? OR

when we connect the cdc device, the usb device will be appeared as "tty0"?

Can we change this name?

2) My Modem has 2 USB interfaces. One for sending AT commands and one for data.

I thought of using USB for data transfer and separate UART for AT commands. If the

USB CDC acm device itself  will use a separate serial port, i have shortage of UART channels.

In this case i have to use only USB with 2 different interface.

( Interface 0 for AT commands and interface 1 for data). Please comment on this.

3) How to change these interfaces in the example code?

4) I have gone through MQX example for USB host CDC device. In this, as per my understanding,

after reading data from UART hyper-terminal, it will  write to the device through USB.

And after reading data from the device through USB, it will display the data in hyper-terminal by UART. Am i right?

5) For me i need to send a data buffer to modem. For this can i pass data "myBuff" directly

to the below API in the cdc_serial.c,without using UART APIs?

fwrite( myBuff, sizeof(myBuff), num, f_usb) in cdc_serial.c ?

Similarly For reading data from modem to my local buffer, can i directly use the API

fread(myBuff, 1, sizeof(myBuff), f_usb)    ?

6) All the enumeration should be done with this example code cdc_serial.c?

Please help me to solve these issues.

0 Kudos