USB Host Processor Expert Callback

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

USB Host Processor Expert Callback

680 Views
FarhanH
Contributor III

I have tried the PE USB Host component on both the Freedom and Tower K20 boards and can't get the callbacks to work. The regular non-PE library works. I am using USB Stack 4.0.3. Here's how the code works:

In ProcessorExpert.c, I have a main loop that includes the "Poll" function. Before the main loop starts, it calls an initialization function.

In the initialization function, I call:

Poll_Init

USB_lock

_usb_host_init = returns USB_OK

_usb_host_register_service = returns USB_OK

USB_unlock

I just wanted to test the basic ATTACH event callback. I am not using _usb_host_driver_info_register on purpose. When I plug in a device, I can see it getting power but the callback isn't fired. I even tried registering error callbacks, and still nothing. I have also tried the complete processor expert examples with their HID code (for example) and it doesn't seem to work. Is there some other setting needed in the PE USB Host component to get callbacks to work?

Based on previous experience with PE, there must be some subtle setting changes required or function calls needed before it works. Anyone have any experience with this?

I don't want to use _usb_host_driver_info_register. If I did, I would use that code (although I have tried the samples).


Thanks!

4 Replies

429 Views
FarhanH
Contributor III

I'm guessing that _usb_host_register_service won't work without the driver registration. I will look at the lower level libraries (ch 9) to see if those work.

0 Kudos

429 Views
Monica
Senior Contributor III

Hello Farhan!

Sorry for the delay of the response, was that the final workaround? Please share qith us, we'd like to know :smileywink:

Best regards,

Monica

0 Kudos

429 Views
FarhanH
Contributor III

Hi Monica,

I found two things. The first is that the USB interrupts don't get called when I use the USB Host PE component, that's why it doesn't respond to USB events. While stepping through the code it looks like the interrupt registers that should be on are on. I have tried this on both the FRDM and TWR K20 boards with the same result. I am not sure why this is happening, so I am stuck using the non-PE host stack.

The second, there is incompatibility with some devices using the USB stack. Specifically, a call to get string descriptors hangs the program. I posted the devices I tested in another topic but the string descriptor issue was with some Sony USB flash drives. Again, not sure why getting string descriptors works on some devices but not on others. I tested all the devices on a PC using microsoft's USB tool to confirm the strings. I used code from Derek (modified slightly), which integrated the code to get a string descriptor in the enumeration process. In my production project I would prefer not to modify the enumeration process with this code and just simply use a ch9 call (as stated in the original post) to get the strings.

429 Views
Monica
Senior Contributor III

Thanks a lot for sharing.

I'll make sure your feedback goes through to improve our services.

Is great to have your contributions, Farhan!

Best,

Monica.

0 Kudos