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

Advertisements

Adding MIDI interface

The next step is to add MIDI interface. Algoriddim Djay did not recognized my device as Reloop Beatpad after cloning VID and PID. Maybe after cloning the MIDI interface it will.

I cloned the MIDI descriptor part from Beatpad. I added EP1 IN and EP2 OUT Bulk endpoints. The addresses are different from the Beatpad endpoint addresses, but as I mentioned earlier I cannot set the endpoint addresses in the FS USB core. I hope the software is not too picky about addresses.

Continue reading