SDK2.11.0 - SAI DMA Demo Broken

cancel
Showing results for 
Search instead for 
Did you mean: 

SDK2.11.0 - SAI DMA Demo Broken

Jump to solution
837 Views
variable_andrew
Senior Contributor I

Using MCUXpresso and the SDK2.11.0 for the RT1052, the SAI DMA that was working now isn't.

The rest of my peripherals are all working fine, so it seems the SAI (MQS) is the only thing affected.

In the below code segment, `SAI_UserCallback` is never getting called (used to get called

Could you provide some insight?

 

 

sai_handle_t g_saiHandle;
edma_handle_t g_TxDmaHandle;
sai_edma_handle_t g_saiTxDmaHandle;
sai_config_t user_config;
sai_transfer_t sendXfer;
volatile bool txFinished;

void SAI_UserCallback(I2S_Type *base, sai_edma_handle_t *handle, status_t status, void *userData) {
    if (kStatus_SAI_TxIdle == status)
    {
        txFinished = true;
    }
}

void buzzer_play_sound(uint32_t prediv, uint32_t div, soundclip_t sc){
  edma_config_t dmaConfig = {0};
  /*Clock setting for SAI1*/
  CLOCK_SetMux(kCLOCK_Sai3Mux, DEMO_SAI_CLOCK_SOURCE_SELECT);
  CLOCK_SetDiv(kCLOCK_Sai3PreDiv, prediv);
  CLOCK_SetDiv(kCLOCK_Sai3Div, div);
  /*Enable MCLK clock*/
  BOARD_EnableSaiMclkOutput(true);
  IOMUXC_MQSEnterSoftwareReset(IOMUXC_GPR, true);                             /* Reset MQS. */
  IOMUXC_MQSEnterSoftwareReset(IOMUXC_GPR, false);                            /* Release reset MQS. */
  IOMUXC_MQSEnable(IOMUXC_GPR, true);                                         /* Enable MQS. */
  IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate64, 0u);           /* 78.6432MHz/64/(0+1) = 1.2288MHz*/
  /* SAI init */
  SAI_Init(SAI3);

  SAI_TxGetDefaultConfig(&user_config);
  SAI_TxInit(SAI3, &user_config);


  // Sets up the DMA.
  DMAMUX_Init(DEMO_DMAMUX);
  DMAMUX_SetSource(DEMO_DMAMUX, DEMO_TX_EDMA_CHANNEL, DEMO_SAI_TX_SOURCE);
  DMAMUX_EnableChannel(DEMO_DMAMUX, DEMO_TX_EDMA_CHANNEL);
  EDMA_GetDefaultConfig(&dmaConfig);
  EDMA_Init(DEMO_DMA, &dmaConfig);

  /* Creates the DMA handle. */
  EDMA_CreateHandle(&g_TxDmaHandle, DMA0, DEMO_TX_EDMA_CHANNEL);

  SAI_TransferTxCreateHandleEDMA(SAI3,&g_saiTxDmaHandle, SAI_UserCallback, NULL, &g_TxDmaHandle);


  /* I2S mode configurations */
  sai_transceiver_t config;
  SAI_GetClassicI2SConfig(&config, kSAI_WordWidth8bits, kSAI_MonoRight, 1U << DEMO_SAI_CHANNEL);
  config.masterSlave = kSAI_Master;
  config.syncMode    = kSAI_ModeAsync;
  SAI_TransferTxSetConfigEDMA(SAI3, &g_saiTxDmaHandle, &config);

  // Prepares to send.
  sendXfer.data = soundclip_ptr(sc);
  sendXfer.dataSize = soundclip_size(sc);

  txFinished = false;
  // Sends out.
  SAI_TransferSendEDMA(SAI3, &g_saiTxDmaHandle, &sendXfer);
  // Waits for send to complete.
  while (!txFinished)
  {
  }


}

 

 

 

0 Kudos
1 Solution
809 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello,
Could you provide me more detailed information about how the SAI_edma is not working? Was there any code modification? Are the interruptions enabled? Regarding of I2S, did you see the I2S, is it working properly in an oscilloscope or data analyzer?

I suggest you referring to this post where you can find an example of SAI_edma with MQS below.
RT1064 MQS Driver Circuitary - NXP Community

Best regards,
Pavel

View solution in original post

0 Kudos
2 Replies
810 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello,
Could you provide me more detailed information about how the SAI_edma is not working? Was there any code modification? Are the interruptions enabled? Regarding of I2S, did you see the I2S, is it working properly in an oscilloscope or data analyzer?

I suggest you referring to this post where you can find an example of SAI_edma with MQS below.
RT1064 MQS Driver Circuitary - NXP Community

Best regards,
Pavel

0 Kudos
803 Views
variable_andrew
Senior Contributor I

Hi @Pavel_Hernandez ,

Thanks for the guidance - it turns out after the SDK 2.10 -> 2.11 update, when the SAI/MQS code stopped getting TX interrupts, I looked to the SAI interrupt (instead of the SAI eDMA) demo for guidance. After wiping that work and using the SAI eDMA demo - I'm up and running again.

 

For future reference, is there some public github site where the demos are released for each SDK release (so we can quickly reference what changed)?

 

Thanks again

0 Kudos