Upgrading audio playback

Now I have a very noisy output, because I am sending the 4 channels to the DAC as it would be only a stereo. So channel 3&4 is interleaved with channel 1&2. I did some modifications, to at least hear one of the two stereo streams.

Continue reading


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

Rewrite data handling

I introduced some new definitions in usbd_conf.h file, because I have to modify the whole project from stereo to 4 channels later.
/* AUDIO Class Config */
#define USBD_AUDIO_FREQ                       48000
#define USBD_AUDIO_CHANNELS                   2
#define USBD_AUDIO_BYTES              2

Continue reading

Something is wrong with the STM32 USB Audio Class driver

After I had a working demo, I studied the code, to understand how does it work in details. Here is a simplified description:

1) Initialize EP 1 OUT which is the ISO endpoint, and preapare it for receiving.

2) When it receives something in Data_Out, It starts to Play it in the DAC by sending the data to I2S interface with DMA.

3) During the DMA transfer, we have a HalfComlete and a Complete interrupt. They invoke a simple audio synchronization part, which compensates the clock difference between the USB clock and I2S clock. Here I read a bunch of standards and literature about the clock syncronization possibilities of USB Audio Class.

4) While DMA is sending the data to I2S, the USB still receives the packets and stores them in a buffer.

Continue reading