cancel
Showing results for 
Search instead for 
Did you mean: 

USB Audio Device over QSPI problem

Anna Maria Nestorov
Associate II
Posted on March 19, 2018 at 21:37

The original post was too long to process during our migration. Please click on the attachment to read the original post.
3 REPLIES 3
T J
Lead
Posted on March 20, 2018 at 07:14

Try to play 1KHz first.

Do you have a scope ?

Did you see the waveform changing ?

You will need to check the output timing and the data you sent is being played, much easier on a scope.

( I use this old one,  TDS2024 color 4ch, I think it's the least you need.)

did you get the example code to play the audio ?

test your 1khz tone in here..

Posted on March 21, 2018 at 10:57

Hi T J, thanks for your reply.

I have tested the example code with both a sine wave and songs, and it is able to play correctly both of them.

As you suggested, I have check the optputs of my code with a scope. The following figures show the obtained results:

CH1(yellow): sine wave @1KHz;

CH2(pink): FPGA's almost full flag;

CH3(blue): this signal change polarity every time the program enters in the 

HAL_SAI_Transmit_DMA function;

0690X0000060AAzQAM.png

FIG1: 20ms/div

0690X0000060ACBQA2.png

FIG2: 1ms/div

The main problems of these results, in my opinion, are:

1) the sine wave is periodically truncated;

2) CH3 change polarity every 40ms. However, 

the 

HAL_SAI_Transmit_DMA function would be called by the interrupt handler every 20ms (because USB host @48KHz produce 384byte/ms and the half buffer is 

7680 byte (7680/384 = 20ms)

). So it seems like the 

while (HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_15) == GPIO_PIN_SET); is asserted too  often such that  the BSP_QSPI_Write function is not able to sent enough data in 20ms.

However, I have already tested both the FPGA side and the  BSP_QSPI_Write function with the SPDIF interface, which is actually working correctly.

NOTE: in the previous post, I have linked the wrong git repository. The example design I have used can be found in:

https://github.com/PaxInstruments/STM32CubeF4/tree/master/Projects/STM32446E_EVAL/Applications/USB_Device/AUDIO_Standalone

 

Thanks for your support.

Posted on March 21, 2018 at 14:38

I don't have a SAI solution running myself, so its hard to help.

I don't understand CH3 should be what ?

did you write the function, HAL_QSPI_Transmit_8 ?

This is an 8 byte x 8 bit transfer , yes ?

just to be sure, I like to &0x0ff

  *(__IO uint32_t *) data_reg = *hqspi->pTxBuffPtr  &0x0ff ;   // to be sure only 8 bits is going across

Also, I can see an issue in the waiting structure,

but I cant see exactly where you are sending the data to the QSPI, which line sends the data ?

maybe someone else can add some insight,   guys?