Generalization of the USB Hosts CDC example for more than PSTN

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

Generalization of the USB Hosts CDC example for more than PSTN

752 Views
davepfaltzgraff
Senior Contributor I

In working through the USB Host CDC example found at C:\KSDK2\boards\frdmk22f\usb_examples\usb_host_cdc\freertos I find that the device must specifically be "Calss-specific PSTN". Since I'm new to this arena, is there any documentation available that would help me move towards just a serial interface.

Specifically, for this device, the InterfaceClass and InterfaceSubClass are all defined as 0xFF.

Note: I found the example  in KSDK 1.2 more enlightening, but I'd prefer to use the more recent examples.

Thanks

0 Kudos
2 Replies

502 Views
davepfaltzgraff
Senior Contributor I

Hopefully someone knowledgeable is "listening" to this sequence of posts as I have learned enough to be dangerous but still may be of help to others.

As described in my first post, I changed the InterfaceClass and InterfaceSubClass so that a generic device would be accepted. Now, the unit enumerates and I can start "talking" to it. However, I have found some errors in the base code and question whether or not it was actually tested against real hardware. But...

My question now is that I get to the point where the console prints out "Error in USB_HostCdcInterruptRecv:" Backtracking, I found that cdcInstance->interruptPipe was NULL. Where in the code should the pipe be defined? The documentation in the "USB Stack Host Reference Manual" merely mentions interruptPipe and does not clarify how/when it is to be used.

Thanks

0 Kudos

502 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi David:

The interrupt pipe initialization is in the CDC state machine.

Please refer to USB_HostCdcTask (usb_host_cdc.c )

This task is used to execute a CDC state machine.

            case kStatus_DEV_Attached:
                cdcInstance->runState = kUSB_HostCdcRunSetControlInterface;

Next, usb stack will call USB_HostCdcSetControlInterface

        case kUSB_HostCdcRunSetControlInterface:

            cdcInstance->runWaitState = kUSB_HostCdcRunWaitSetControlInterface;
            cdcInstance->runState = kUSB_HostCdcRunIdle;
            if (USB_HostCdcSetControlInterface(cdcInstance->classHandle, cdcInstance->controlInterfaceHandle, 0,
                                               USB_HostCdcControlCallback, &g_cdc) != kStatus_USB_Success)
            {
                usb_echo("set control interface error\r\n");
            }

USB_HostCdcSetContorlInterfaceCallback will call USB_HostCdcOpenControlInterface,  and interruptPipe is initialized in this function.

Regards

Daniel

0 Kudos