SAI interface on RT1064

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

SAI interface on RT1064

1,166 Views
kl
Contributor III

Hi,

We are interfacing the RT1064 to a TLV320ADC3140 ADC-converter using the TDM protokol.

 Everything setting up the ADC and the serial interface (ASI) works fine, as you see on this screen shot:

Screenshot 2020-12-08 134012.png

We are using 4 channels @ 24bit resolution with an Fs @ 24kHz.

But we have one problem. No data seems to arrive in the SAI receive register, and the DMA channel configured for sample data reception is not generating any interrupts, as the buffer is never filled.

When running as shown above on the oscilloscope screenshot, the SFR looks like this:

Screenshot 2020-12-08 134201.pngScreenshot 2020-12-08 134214.png

There is some of the sittings that is unclear to me, which might be wrong. 

E.g. RCR5.FBT is 24 (First bit shifted = 25 in the config tool), but it should probably be decremented.

Mex file attached.

Besides the code generated from the config tool I have written following code:

 

void SAI2_RX_Callback(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData)
{
buffers_compleated++;
sai_transfer_t xfer;
xfer.dataSize = audio_buffer_size * sizeof(uint32_t);
xfer.data = audio_buffer1;
SAI_TransferReceiveEDMA(SAI2_PERIPHERAL, &SAI2_SAI_Rx_eDMA_Handle, &xfer);
}
void audio_start(void)
{
  sai_transfer_t xfer;
  xfer.dataSize = audio_buffer_size * sizeof(uint32_t);
  xfer.data = audio_buffer1;

  SAI_TransferReceiveEDMA(SAI2_PERIPHERAL, &SAI2_SAI_Rx_eDMA_Handle, &xfer);
}

I now I loose some data, that must be solved later.

I'm using SDK version 2.8.6, and MCUXpresso version 11.2.0, Config tools from 20200707 (Various version numbers)

Please help locating the problem.

 

Regards

Kasper

Labels (1)
Tags (1)
0 Kudos
3 Replies

1,121 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Kasper, 

Within the RT1064-EVK SDK, we provide an example named sai_edma_transfer. I recommend you using this example as a base to see how to configure the SAI module along with the DMA and compare what configurations are you missing in your application. 

You mentioned the following: "E.g. RCR5.FBT is 24 (First bit shifted = 25 in the config tool), but it should probably be decremented." Could you please provide more information about this? I'm not sure that I understood this correctly.

Regards,
Victor 

0 Kudos

1,114 Views
kl
Contributor III

Hi,

All examples includes playback, and our application only uses the record facilities. But I used the record part of the example sai_edma_record_playback for inspiration for my code (i.e. cut'n'paste of the essential parts not delivered by the config tool). But it should be possible to configure the SAI peripheral to work in record mode only. I noticed that the config tool complains that there is no TX.BCLK and TX.SYNC pin defined. Should this be a problem? Hopefully not, I have no spare pins available for the TX pins.

Regarding the RCR5.FBT parameter I just asked which number I shall write in the config tool, when I got a 24 bit ADC.

Kasper

0 Kudos

1,074 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Kasper, 

If you only want to use the SAI module to record, you shouldn't have any problems if you don't have the TX.BCLK and TX.SYNC signals. 

Regarding the value of FBT, will you receive MSB first or LSB? 

Regards,
Victor

0 Kudos