USB Host with CDC ACM, how do I change interfaces?

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

USB Host with CDC ACM, how do I change interfaces?

4,158 Views
yibbidy
Contributor V

Hi All,

 

I've been trying to talk to a 3G modem using MQX3.8 with the cdc_serial demo.

 

The trouble that I have been having is that after the modem is attached, the data interface is selected.  I want to select the control interface so that I can issue AT commands to the modem.  Here is what I get from the console when the modem is attached:

 

----- CDC control interface attach Event -----

State = attached  Class = 2  SubClass = 2  Protocol = 1

----- CDC data interface attach event -----

State = attached  Class = 10  SubClass = 0  Protocol = 0

----- CDC control interface selected -----

----- Device installed -----

----- CDC data interface selected -----

 

At this point, the example code then issues an "fopen()" to "tty0:" which translates to a "_io_cdc_serial_open()".  As far as I can tell, I need to select the control interface with "_usb_hostdev_select_interface()" before using fopen() as it is only possible to select one interface at a time - once the data interface is selected I cannot talk to the control interface.  Have I got this right or have I missed something?  Anyway, doing this causes exceptions or unhandled interrupts.

 

Incidentally, the data interface of the modem does not echo characters back.  I'm not surprised at that but I notice that the demo description seems to infere that I should get echo's "straight out of the box" so to speak.

 

I'd appreciate any help here or at least confirmation that I'm on the right track.

 

Thanks,  Shaun

Labels (1)
Tags (1)
8 Replies

1,886 Views
c0170
Senior Contributor III

Hello,

The fopen() opens the device. Inside the driver, the data interface and the control interface are bound together, so if you want to change the interface settings (baudrate etc.), use the standard IOCTL associated with the file.

The class driver will find the control interface and configures it. The with read() and write() it accesses the data interface.

Regards,

MartinK

0 Kudos
Reply

1,886 Views
yibbidy
Contributor V

Thanks for your reply MartinK.

I still need to be able to access the control interface of the modem as I need to send commands to it.  For example, I might need to send a dial string such as "ATD12345", or a send an SMS text message, or request some status information.

I tried reconfiguring the modem to use one of it's UARTs as the control interface, but keep the data interface on USB (for speed).  Interestingly, the CDC demo still enumerates a control interface and a data interface for this configuration.  I still don't get any characters echoed back in either way.

Regards,

Shaun

0 Kudos
Reply

1,886 Views
JuroV
NXP Employee
NXP Employee

Hello James,

the control interface is not there for controlling the device with AT commands. You should send these commands to the standard data interface= sending data to the open usb_serial file as I mentioned.

Or I did not understand you properly.

0 Kudos
Reply

1,886 Views
yibbidy
Contributor V

Hi Juraj,

Thanks for your reply.  There may be some misunderstanding of terminology on my part here...

The USB modem has a "data interface" and a "control interface" that should work over a single USB connection.  The modems control interface is for sending AT commands, the data interface is for data.  From what you are saying, the CDC ACM "control interface" is for controlling the USB channel, not for accessing the modem's "control interface"?

I can configure the USB modem to have it's "control interface" on a UART, and have it's "data interface" on the USB interface, or even another UART.  Having the "control interface" on a UART would suit my purpose as long as I can have the "data interface" on USB as I need a high speed connection.  I have tried this previously and have still not been able to get any characters to echo back using the CDC demo.

I'll have another look at it now that I understand that the CDC demo "control interface" is not talking to the USB modems "control interface".  Confusing terminology!

Regards, Shaun

0 Kudos
Reply

1,886 Views
JuroV
NXP Employee
NXP Employee

Hello Shaun (excuse me for calling you by surname previously),

I looked a bit into the specification and you were right with AT commands. Unfortunatelly the API in MQX is not ready for sending AT commands through control interface and must be implemented. :smileysad:

0 Kudos
Reply

1,886 Views
yibbidy
Contributor V

Thanks for chasing that up for me Juraj.

I now know not to persevere with that path which will save a lot of time. I'll have a look at using one of the modems UARTs as the control interface.

Regards,

Shaun James

0 Kudos
Reply

1,886 Views
ThomNet
Contributor III

Hi Shaun James,

I'm working on the same problem as you were / are. My UMTS modul is not responding on USB.

I'm using a u-blox LISA-230 UMTS module which comes up with in total 5 cdc interfaces, data and control, using the cdc_serial demo. I have only tty0 working, because im still in the debug process to make the four others to work.

I try to understand the difference between the two types of interfaces. Could you tell, what the control interfaces is actually controlling? Researching in serveral different USB books, wikipedia or Google could not answer this question.

And is your application running now?  What modul are you using?

Thanks in advance

Thomas

0 Kudos
Reply

1,886 Views
alipoth
Contributor III

Hi Thomas,

I'm also working on a modem with multiple (7) CDC interfaces. We found that the following configuration values had to be changed to get the interfaces working:

USBCFG_MAX_PIPES 

USBCFG_KHCI_TR_QUE_MSG_CNT

The number of pipes is 1 + (3 * num_of_cdc_interfaces), the transaction queue size is a bit of a trial-and-error. Hope this helps.