2018-03-19 01:37 PM
2018-03-19 11:14 PM
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..
2018-03-21 03:57 AM
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;
FIG1: 20ms/div
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 thewhile (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:
Thanks for your support.
2018-03-21 07:38 AM
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?