hi. i,d like to change audio serial bus from SAI1(SDK default) to SAI2.
i am using mimxrt106f controller.
this is what i have done:
1- change board pin config as below:
void BOARD_InitAudio(void) {
CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03U */
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_09_SAI2_TX_DATA,
0U);
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_05_SAI2_TX_BCLK,
0U);
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_04_SAI2_TX_SYNC,
0U);
IOMUXC_SetPinConfig(
IOMUXC_GPIO_AD_B0_09_SAI2_TX_DATA,
0xF0B0U);
}
2- change clock setting to sai2 as :
/*Clock setting for SAI2*/
CLOCK_SetMux(kCLOCK_Sai2Mux, BOARD_AMP_SAI_CLOCK_SOURCE_SELECT);
CLOCK_SetDiv(kCLOCK_Sai2PreDiv, BOARD_AMP_SAI_CLOCK_SOURCE_PRE_DIVIDER);
CLOCK_SetDiv(kCLOCK_Sai2Div, BOARD_AMP_SAI_CLOCK_SOURCE_DIVIDER);
3- change SAI definition on Board.h to SAI2:
#define BOARD_AMP_SAI SAI2
4- change interrupt definitions on Board.h:
#define BOARD_AMP_SAI_IRQ SAI2_IRQn
#define BOARD_AMP_SAI_IRQ_Handler SAI2_IRQHandler
and
#define BOARD_AMP_SAI_EDMA_TX_REQ kDmaRequestMuxSai2Tx
#define BOARD_AMP_SAI_EDMA_RX_REQ kDmaRequestMuxSai2Rx
is there anything else to do to change audio bus from SAI1 to SAI2?
my modifications run. but wait at:
xEventGroupWaitBits(s_DmaTxComplete, PCM_AMP_DMA_TX_COMPLETE_EVT_BIT, pdTRUE, pdTRUE, portMAX_DELAY);
and never pass
Hi @accatpaliz
You can use the RT106X SDK sai code and modify the SAI port, your mentioned point is enough, just make sure when you do the SAI call, the SAI port is changed to SAI2.
SDK_2_11_1_EVK-MIMXRT1060\boards\evkmimxrt1060\driver_examples\sai
I attach one of my SAI2 code, which is working on my side.
Best Regards,
Kerry