Scheduling Audio, MIDI and HID

In my previous post I mentioned that my audio interface crashes after a while. I also mentioned that my guess it is because of the non-scheduling my different USB transefers. So I did it.

I used the SOF (Start-of-frame) interrupt as my 1ms timebase.This interrupt has to be enabled in the USB device configuration part, because it’s disabled by default. In other words simply replaced my HAL_GetTick() function which is based on the counter incremented each 1ms in the SysTick interrupt. My similar function is the USB_GetTick() which is based on the counter incremented each 1ms in the USB SOF interrup.

This is the new waveform I have. The start of the HID report transfer is in a fixed time slot. It comes after 718us always. And it completes of course in the end of the frame.

hid_sof_sync

Continue reading