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.
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:
Hope it can help you
BR
XiangJun Rong
__ALIGN_BEGIN uint8_t g_Music[] __ALIGN_END = {
0x00U, 0x00U, 0x00U, 0x00U, 0x71U, 0x07U, 0x71U, 0x07U, 0xDCU, 0x0EU, 0xDCU, 0x0EU, 0x39U, 0x16U, 0x39U, 0x16U,
0x84U, 0x1DU, 0x84U, 0x1DU, 0xB5U, 0x24U, 0xB5U, 0x24U, 0xC6U, 0x2BU, 0xC6U, 0x2BU, 0xB2U, 0x32U, 0xB2U, 0x32U,
0x71U, 0x39U, 0x71U, 0x39U, 0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