USB host cdc with modem not cdc_acm/cdc_data

cancel
Showing results for 
Search instead for 
Did you mean: 

USB host cdc with modem not cdc_acm/cdc_data

Jump to solution
870 Views
alainbridel
Contributor I

I'm working with FRDM-KL26 that we have "boosted" with the KL26256.

I'm working with KSDK 1.3 and Keil IDE.

 

I use the provided FRDM-KL46Z usb host CDC sample.

 

Everything is working perfectly when I attach a real USB CDC ACM compliant device. I have tested with a home made CDC device and a commercial modem from gemalto (BGS5T).

 

Next I have tryied to attach another modem that is not CDC ACM compliant (quectel UC15). This modem expose 5 interfaces with 0xFF in both class, sub class and protocol.

The modem "should" work using the fourth interface that expose three endpoints : an int in, a bulk out and a bulk in.

 

For the modem to be recognized I have added in cdc_serial.c a driver info to match the VID/PID (05C6, 9090).

 

The USB modem is then well recognized but only for its cdc_acm interface and not the cdc_data interface. So, data_init class is never called and nothing is working.

 

My question is :

How can I define a cdc peripheral that in the same interface expose two different usb classes ?

 

The SDK 1.3 doesn't seem to support this kind of architecture.

 

Thnks,

 

Alain.

Labels (1)
1 Solution
373 Views
alainbridel
Contributor I

Hello Isaac,

First I'd like you to know that I have solved my problem in stepping in a lot in the KSDK USB library (4 long weeks...).

So The probleme was simple to solve once I have understood how things "could" work and not "should" work.

The CDC Host driver is requesting two differents interfaces: one for the CDC ACM and one for the CDC Data.

So, in the DriverInfoTable there are two entries, with two differents callback. That's good enough for most USB devices but not for modems that generaly expose a lot of interfaces with class, subclass and protocol equal to 0xFF, that is, vendor specific.

I have 4 USB modems in here, and each one got specific interfaces.

First one got 2 CDC ACM and 2 CDC Data :

To solve carrying this modem I have updated the usb_host_cdc_acm_event callback to deal with it this way :

int the switch case USB_CONFIG_EVENT:

Simply, recast the dev_hanle to a dev_instance_t* and the intf_handle to a usb_device_interface_struct_t*

then test that this is my product : if (dev_ptr->dev_descriptor.idVendor[1] == 0x1e &&  dev_ptr->dev_descriptor.idVendor[0] == 0x2d)

and test that this is the first interface : if (intf->lpinterfaceDesc->bInterfaceNumber == 0) {

if so, I set the acm_intf_handle and that's enought for the acm part.

Next I have updated the usb_host_cdc_data_event callback to also react on the good interface. Same cast, same test except on the requested interface.

And everything is ok.

The 3 other modems got some vendor specific class, and specifically, they all have only one interface that handle the 3 requested endpoints (ctrl, in and out).

To deal with those modems I have added an entry in the DriverInfoTable like this :

// QUECTEL UC15

{

     {0xC6,0x05},

     {0x90,0x90},

     0xFF, 0xFF, 0xFF, 0, mycallback

}

same for SIERRA MC8092 and HUAWEI MU709S, but this is not enought. I had to update the class_interface_map driver, allocate a fake ACM controller, pepper, salt, mix everything et voilà ! It works.

Thanks,

Alain.

PS : I don't think I'll go to SDK 2.0 since everything has changed ...

View solution in original post

2 Replies
373 Views
isaacavila
NXP Employee
NXP Employee

Hello Alain,

How are you defining your DriverInfoTable? Remember that current example logic is using one callback for Control Interface and other one for Data interface.

How are you checking that "device is recognized correctly"?

Regards,

Isaac

0 Kudos
374 Views
alainbridel
Contributor I

Hello Isaac,

First I'd like you to know that I have solved my problem in stepping in a lot in the KSDK USB library (4 long weeks...).

So The probleme was simple to solve once I have understood how things "could" work and not "should" work.

The CDC Host driver is requesting two differents interfaces: one for the CDC ACM and one for the CDC Data.

So, in the DriverInfoTable there are two entries, with two differents callback. That's good enough for most USB devices but not for modems that generaly expose a lot of interfaces with class, subclass and protocol equal to 0xFF, that is, vendor specific.

I have 4 USB modems in here, and each one got specific interfaces.

First one got 2 CDC ACM and 2 CDC Data :

To solve carrying this modem I have updated the usb_host_cdc_acm_event callback to deal with it this way :

int the switch case USB_CONFIG_EVENT:

Simply, recast the dev_hanle to a dev_instance_t* and the intf_handle to a usb_device_interface_struct_t*

then test that this is my product : if (dev_ptr->dev_descriptor.idVendor[1] == 0x1e &&  dev_ptr->dev_descriptor.idVendor[0] == 0x2d)

and test that this is the first interface : if (intf->lpinterfaceDesc->bInterfaceNumber == 0) {

if so, I set the acm_intf_handle and that's enought for the acm part.

Next I have updated the usb_host_cdc_data_event callback to also react on the good interface. Same cast, same test except on the requested interface.

And everything is ok.

The 3 other modems got some vendor specific class, and specifically, they all have only one interface that handle the 3 requested endpoints (ctrl, in and out).

To deal with those modems I have added an entry in the DriverInfoTable like this :

// QUECTEL UC15

{

     {0xC6,0x05},

     {0x90,0x90},

     0xFF, 0xFF, 0xFF, 0, mycallback

}

same for SIERRA MC8092 and HUAWEI MU709S, but this is not enought. I had to update the class_interface_map driver, allocate a fake ACM controller, pepper, salt, mix everything et voilà ! It works.

Thanks,

Alain.

PS : I don't think I'll go to SDK 2.0 since everything has changed ...

View solution in original post