SAI3 & EDMA on IMXRT1010

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

SAI3 & EDMA on IMXRT1010

Jump to solution
1,030 Views
Syam_Krishnan
Contributor II
Hello,
I am trying to bring up SAI3 & EDMA on an IMXRT1010 custom board. To start with, I am using evkmimxrt1010_sai_edma_transfer example on IMXRT1010 EVK. I was able to run the demo with SAI 1. I can hear the stored tone. To check SAI3, I edited the code in evkmimxrt1010_sai_edma_transfer. I changed references of SAI1 to SAI3. The lines that I had edited are
 
Line 26,28, 29 in sai_edma_transfer.c : Changed references of macros from SAI1 to SAI3
41,43, 45 in sai_edma_transfer.c : Changed references of macros from SAI1 to SAI3
61 in sai_edma_tranfer.c : Changed references of macros from SAI1 to SAI3
138 & 142 : Changed references of MCLK output from SAI1 to SAI3
191, 192 & 193: Clock settings changed from SAI1 to SAI3
 
I am aware that the codec will not work in this case. However, I wanted to see the data transfer, with SAI3 taking in the data and completing the transfer. The code comiled and executed. However, the code gets stuck with 'kStatus_SAI_QueueFull' status message after 4 iterations. The MCU is not reaching the ISR for DMA. Code is not reaching  
WEAK void DMA0_IRQHandler(void)
{   DMA0_DriverIRQHandler();
}
in startup_mimxrt1011.c 
 
I had checked if the clock settings, NVIC settings ,  DMA settings & SAI3 settings are as per my understanding. I am unable to see anything amiss
 
CCM_CSCMR1: SAI3_CLK_SEL->SAI3_CLK_SEL_2
 
CCM_CS1CDR: SAI3_CLK_PRED->SAI3_CLK_PRED_3
 
TCD0_DADDR 0x401e8020 //this corresponds to the SAI3 TX register address.
TCR3 0x00010000 //this corresponds to the SAI3 TX en
 
I had spent ~ 2 days and i have ran out of possible solutions. Any leads on this will be highly helpful.
Attached is my modified sai_edma_transfer.c file. 
 
Thanks
Syam k
 
 
0 Kudos
Reply
1 Solution
1,013 Views
Syam_Krishnan
Contributor II

The catch was #define DEMO_SAI_MASTER_SLAVE kSAI_Slave defined in sai_edma_transfer.c  . With WM8960 Codec, the codec makes the BCLK and SAI accepts the clock. When i moved from SAI1 to SAI3, there is no BCLK to drive the SAI. When SAI3 was configured as master, I could see SAI3 taking in data and DMA generating interrupts. Now I will try this code in my custom board with TAS2780. 

View solution in original post

0 Kudos
Reply
1 Reply
1,014 Views
Syam_Krishnan
Contributor II

The catch was #define DEMO_SAI_MASTER_SLAVE kSAI_Slave defined in sai_edma_transfer.c  . With WM8960 Codec, the codec makes the BCLK and SAI accepts the clock. When i moved from SAI1 to SAI3, there is no BCLK to drive the SAI. When SAI3 was configured as master, I could see SAI3 taking in data and DMA generating interrupts. Now I will try this code in my custom board with TAS2780. 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2069621%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESAI3%20%26amp%3B%20EDMA%20on%20IMXRT1010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2069621%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3EHello%2C%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EI%20am%20trying%20to%20bring%20up%20SAI3%20%26amp%3B%20EDMA%20on%20an%20IMXRT1010%20custom%20board.%20To%20start%20with%2C%20I%20am%20using%20evkmimxrt1010_sai_edma_transfer%20example%20on%20IMXRT1010%20EVK.%20I%20was%20able%20to%20run%20the%20demo%20with%20SAI%201.%20I%20can%20hear%20the%20stored%20tone.%20To%20check%20SAI3%2C%20I%20edited%20the%20code%20in%20evkmimxrt1010_sai_edma_transfer.%20I%20changed%20references%20of%20SAI1%20to%20SAI3.%20The%20lines%20that%20I%20had%20edited%20are%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ELine%2026%2C28%2C%2029%20in%20sai_edma_transfer.c%20%3A%20Changed%20references%20of%20macros%20from%20SAI1%20to%20SAI3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E41%2C43%2C%2045%20in%20sai_edma_transfer.c%20%3A%20Changed%20references%20of%20macros%20from%20SAI1%20to%20SAI3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E61%20in%20sai_edma_tranfer.c%20%3A%20Changed%20references%20of%20macros%20from%20SAI1%20to%20SAI3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E138%20%26amp%3B%20142%20%3A%20Changed%20references%20of%20MCLK%20output%20from%20SAI1%20to%20SAI3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E191%2C%20192%20%26amp%3B%20193%3A%20Clock%20settings%20changed%20from%20SAI1%20to%20SAI3%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3EI%20am%20aware%20that%20the%20codec%20will%20not%20work%20in%20this%20case.%20However%2C%20I%20wanted%20to%20see%20the%20data%20transfer%2C%20with%20SAI3%20taking%20in%20the%20data%20and%20completing%20the%20transfer.%20The%20code%20comiled%20and%20executed.%20However%2C%20the%20code%20gets%20stuck%20with%20'kStatus_SAI_QueueFull'%20status%20message%20after%204%20iterations.%20The%20MCU%20is%20not%20reaching%20the%20ISR%20for%20DMA.%20Code%20is%20not%20reaching%26nbsp%3B%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EWEAK%20void%20DMA0_IRQHandler(void)%3C%2FDIV%3E%3CDIV%3E%7B%26nbsp%3B%20%26nbsp%3BDMA0_DriverIRQHandler()%3B%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CDIV%3Ein%20startup_mimxrt1011.c%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EI%20had%20checked%20if%20the%20clock%20settings%2C%20NVIC%20settings%20%2C%26nbsp%3B%20DMA%20settings%20%26amp%3B%20SAI3%20settings%20are%20as%20per%20my%20understanding.%20I%20am%20unable%20to%20see%20anything%20amiss%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3ECCM_CSCMR1%3A%20SAI3_CLK_SEL-%26gt%3BSAI3_CLK_SEL_2%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3ECCM_CS1CDR%3A%20SAI3_CLK_PRED-%26gt%3BSAI3_CLK_PRED_3%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3ETCD0_DADDR%200x401e8020%20%2F%2Fthis%20corresponds%20to%20the%20SAI3%20TX%20register%20address.%3C%2FDIV%3E%3CDIV%3ETCR3%200x00010000%20%2F%2Fthis%20corresponds%20to%20the%20SAI3%20TX%20en%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EI%20had%20spent%20~%202%20days%20and%20i%20have%20ran%20out%20of%20possible%20solutions.%20Any%20leads%20on%20this%20will%20be%20highly%20helpful.%3C%2FDIV%3E%3CDIV%3EAttached%20is%20my%20modified%26nbsp%3Bsai_edma_transfer.c%20file.%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThanks%3C%2FDIV%3E%3CDIV%3ESyam%20k%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2070438%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20SAI3%20%26amp%3B%20EDMA%20on%20IMXRT1010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070438%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20catch%20was%26nbsp%3B%3CSPAN%3E%23define%20DEMO_SAI_MASTER_SLAVE%20kSAI_Slave%20defined%20in%20sai_edma_transfer.c%26nbsp%3B%20.%20With%26nbsp%3BWM8960%20Codec%2C%20the%20codec%20makes%20the%20BCLK%20and%20SAI%20accepts%20the%20clock.%20When%20i%20moved%20from%20SAI1%20to%20SAI3%2C%20there%20is%20no%20BCLK%20to%20drive%20the%20SAI.%20When%20SAI3%20was%20configured%20as%20master%2C%20I%20could%20see%20SAI3%20taking%20in%20data%20and%20DMA%20generating%20interrupts.%20Now%20I%20will%20try%20this%20code%20in%20my%20custom%20board%20with%20TAS2780.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E