High speed USB audio interrupts should occur every 125uS right?

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

High speed USB audio interrupts should occur every 125uS right?

Jump to solution
1,638 Views
EdSutter
Senior Contributor II

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?  

0 Kudos
1 Solution
1,627 Views
jingpan
NXP TechSupport
NXP TechSupport

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

View solution in original post

0 Kudos
5 Replies
1,575 Views
EdSutter
Senior Contributor II

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.

 

0 Kudos
1,610 Views
AndyCapon
Contributor II

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

 

1,600 Views
EdSutter
Senior Contributor II

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...

0 Kudos
1,628 Views
jingpan
NXP TechSupport
NXP TechSupport

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

0 Kudos
1,624 Views
EdSutter
Senior Contributor II

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

0 Kudos