i2s using LPCXpresso55S69

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i2s using LPCXpresso55S69

224 Views
scoottroop
Contributor I

Currently I'm trying to remake the example and create a ping-pong buffer using DMA. I am however unsure of how to interpret the data. It is 400 bytes which I would guess is 200 16-bit samples, 100 left and 100 right. so my questions are:

How should I interpret the buffer? I want to perform DSP operations such as oversampling, and filtering (Before ultimately outputting through PWM) but first, I need to interpret the data correctly, but I am unsure what data type the bytes include. My first thought is to add bytes at index (i&i+1) to left and (i+2&i+3) and fill a new array to get left and right samples, but that doesn't really get me anywhere and I figure there must be an ''easier way''

Secondly, I do not need to playback the audio, I only need the audio data. Can I simply remove the Tx functions? when I did this myself the program did not enter RXCallback

From what I understand from the examples in the SDK, the digital loopback initiates everything, RX callback is called when an operation is finished, so should I perform signal processing in main after filling a buffer with values either from the ping/pong, while the complimentary buffer is filled with a new line of data from i2s?

 

I tried making the i2s myself, but had no luck, and i guess i cannot use the pins directly associated to the codec if i want to use the codec myself

 

Hope my question is clear, have a good day.

0 Kudos
2 Replies

203 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question "How should I interpret the buffer?", I suppose you refer to the lpcxpresso55s69_i2s_interrupt_record_playback project in SDK, the audio buffer is

uint8_t g_Music[].

As the following data, the PCM data bit width is 16, so this is the data

Left channel:0x0000U,0x0771U,0x0EDC,...

Right channel:0x0000U,0x0771U,0x0EDC,....

The left and right data are interleaved.

For the PCM to PWM conversion, you have to convert it yourself with software.

But the i.mxrt10xx for example i.mxrt1064 has MQS module, which can convert the PCM to PWM

by hardware MQS module.

On the PWM pin side, you have to connect inductor/capacitor to do analog filter.

This is i.mxrt1064 link:

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-...

 

Hope it can help you

BR

XiangJun Rong

 

 

__ALIGN_BEGIN uint8_t g_Music[] __ALIGN_END = {

0x00U, 0x00U, 0x00U, 0x00U, 0x71U, 0x07U, 0x71U, 0x07U, 0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xD6U, 0x57U, 0xD6U

0 Kudos

160 Views
scoottroop
Contributor I
Hello again, i've changed the DMA_Playback example to use Ping pong buffers. Currently I'm doing the signal processing in main but my first question is:
1. should I do it in call back or main? i need to interpolate the data etc, and I'm not sure if it would cause a big delay in the callback function. Also, if I use the PWM timers later on, I probably should use main right? i'm not sure of how the callback function actually works/ what flag to use to correctly perform operations in main, since now it switches from ping to pong quite poorly.

2. From what I understand is that I receive 400 bytes of data, where the first two bytes are combined as a left sample, and the two after that are right samples (Since i2s are 16-bit samples). Is my way of thinking correct? i can always share my project if you need to have a look.

Thank you!
0 Kudos