I am debugging some USB audio stuff on imx1060 and just noticed that my --apparently-- HIGH speed USB device is only being interrupted 1kHz (every millisecond) rather than the expected 8kHz (every 125 usec). Any idea why that would be?
Solved! Go to Solution.
Hi EdSutter,
Although SOF is sent every 1ms in full speed mode and 0.125 ms in high speed mode, USB controller will not generate interrupt when receiving SOF. It will interrupt when a transaction is complete. Please see the USBSTS and USBINTR register.
Regards,
Jing
Just want to add a comment here, since I just noticed one major part of my confusion regarding the rate at which the interrupts occur...
I was changing the polling interval in the ENDPOINT descriptor and not seeing any change in the interrupt rate. I didn't realize that there is a function called at startup that overrides some of the descriptor settings based on whether the system is FULL or HIGH speed (USB_DeviceSetSpeed()).
As soon as I removed that call things started working as expected...
That call is useful to modify some points in the descriptor based on USB speed, but if your application is fixed to run at a particular speed, it seems to me, the best thing to do is just set them up in the initialized descriptor (as I was doing) and eliminate that call.
Hi Ed,
I have microframe polling going here in both directions with a hacked dev_composite_hid_audio_unified example.
You need the interval to be 0x01 and the packet size set to frameSize/8.
So for this example I changed:
#define HS_ISO_IN_ENDP_INTERVAL (0x04)
To:
#define HS_ISO_IN_ENDP_INTERVAL (0x01)
And changed :
#define HS_ISO_IN_ENDP_PACKET_SIZE (AUDIO_IN_TRANSFER_LENGTH_ONE_FRAME)
to:
#if (HS_ISO_IN_ENDP_INTERVAL < 4)
#if (HS_ISO_IN_ENDP_INTERVAL == 1U)
#define HS_ISO_IN_ENDP_PACKET_SIZE ((AUDIO_IN_TRANSFER_LENGTH_ONE_FRAME) / 8U)
#elif (HS_ISO_IN_ENDP_INTERVAL == 2U)
#define HS_ISO_IN_ENDP_PACKET_SIZE ((AUDIO_IN_TRANSFER_LENGTH_ONE_FRAME) / 4U)
#elif (HS_ISO_IN_ENDP_INTERVAL == 3U)
#define HS_ISO_IN_ENDP_PACKET_SIZE ((AUDIO_IN_TRANSFER_LENGTH_ONE_FRAME) / 2U)
#endif
#else
#define HS_ISO_IN_ENDP_PACKET_SIZE (AUDIO_IN_TRANSFER_LENGTH_ONE_FRAME)
#endif
Andy,
Yea after my original post I discovered the "bInterval" field of the endpoint (see my earlier reply).
The thing I didn't realize is that the initialized descriptor is modifed by USB_DeviceSetSpeed() to update the endpoint bInterval values based on the USB speed. I was incorrectly making the change in the initialized configuration descriptor.
Thanks...
Hi EdSutter,
Although SOF is sent every 1ms in full speed mode and 0.125 ms in high speed mode, USB controller will not generate interrupt when receiving SOF. It will interrupt when a transaction is complete. Please see the USBSTS and USBINTR register.
Regards,
Jing
Ok @jingpan , that makes sense...
Also, after posting this question, I noticed the 'bInterval' field of the endpoint descriptor (section 9.6.6 of USB spec rev 2) which apparently also has an effect on the rate (some multiple of the 1mS/125uS frame rate) at which the processor is interrupted. Is that correct?
Thanks