Problem with RT1010EVK and DMA Audio Examples

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problem with RT1010EVK and DMA Audio Examples

1,366 次查看
victorcasado
Contributor II

Hi,

I want to implement an audio application, I have started with the sai_edma_record_playback example because I want DMA transfers, but from a MicroSD to the Audio Output.

I see that that example first initializes all the peripherals, and then in an infinite loop, first fills the xfer data structure, and then if plays, ok, but now:

How can I switch the audio rx source of the DMA interrupt from the MIC of the EVK board, to an SD connected trought I2C or SPI, and then how can I implement simple functions such as play, pause, go ahead and go back in the track?

I have the Audio data stored in WAV in the SD, I know the starting addresses of the files that I want to play and the size of the data.

Thank you so much

Best regards

标签 (2)
4 回复数

1,177 次查看
victorcasado
Contributor II

I've seen that the flexio_i2S_edma_transfer example code, could met my requirements better, I see n that example that the audio data is stored in an array called audioBuff[] of size 512, ok, but how can I put the data from the SD to the array?

0 项奖励

1,177 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Victor Casado,

   RT1010 doesn't have the SDHC interface, do you use the SPI interface to connect your external SD card?

   If yes, and you want to use the SD data as the audioBuff, you can use the SPI readout the SD card data to the internal audioBuff, then use it as your I2S data again. It is the SPI sd card operation.

Wish it helps you!

If you still have questions about it, please kindly let me know.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,177 次查看
victorcasado
Contributor II

Hi, thank you so much for your reply,

Yes, I will connect an SD reader to the SPI interface.

I have been looking for a easier way to do it, and I found the example "sai_interrupt_transfer", that does not use DMA but I can start with interrupts that are easier and then switch to DMA.

Then in the main() function, after initializing everything, the buffer is filled here:

            /*  xfer structure */
            temp          = (uint32_t)music;
            xfer.data     = (uint8_t *)temp;
            xfer.dataSize = MUSIC_LEN;
            SAI_TransferSendNonBlocking(DEMO_SAI, &txHandle, &xfer);
            /* Wait until finished */

The audio data is an array called music, ok, compiled and uploaded, and it is a simple sine wave that works perfect, now to start with something, I took an audio file and converted to a C header file with an array(as the music) and it makes strange noises, like saturated with a lot White Noise, I am now trying to solve that, but the problem is, when I call SAI_TransferSendNonBlocking(), it will start playing it, but what if I want to pause the sound? How can I stop it? I have thought of sending a "ZeroBuffer" so it won't play nothing audible, but when I set it to play again, how can I recover the last playing state?

Thank you so much

0 项奖励

1,177 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Victor Casado,

  You are welcome!

   You said the sine wave works perfectly, but your audio file can't work.

   I have a question, whether your audio file converted to the c header file is the valid data?

  If you want to pause the sound, do you debug the code, and add some breakpoint?

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励