I am trying to use the SAI2 interface on the iMX8 QM to receive audio from a radio tuner module. The radio module only supports I2S master configuration, so I have configured SAI2 as I2S slave. When in such configuration, I am unable to record any audio from the SAI2 interface in Linux.
For purposes of testing, I have made a loopback interface between SAI0 and SAI2 by making the following connections:
I have then tried to make two tests, one with SAI0 as I2S master, the other one with SAI2 as I2S master. In both tests, I used aplay to output audio from SAI0 (hw:3,0 in Linux) and arecord to record it from SAI2 (hw:4,0):
How were you setting the devices into master of slave mode? Any reference?
Thanks
Hi Igor
Unfortunately, I don't know how to do what you proposed. I only have Yocto set up on the iMX8 CPU, and I am unable to get the SAI2 to work as slave. I have tried to do the same with sai0 connected to sai3, ran into the same problem. Enabling SAI2 with the M4 cores does little help, as I need the audio on the A cores.
The drivers present in the SDK you mentioned are significantly different from the drivers present in yocto, and are of little help for my use case.
Hi tlugaric
one can debug it using AN12631
Normal and Secure Debug for i.MX8/8X Family of Applications Processors
since slave configuration is supported in SDK, one can check sai registers, then
compare them with linux driver.
May be useful to look at suggestions provided on:
Best regards
igor
Hi tlugaric
one can try to test sai slave with M4 SDK_MEK-MIMX8QM available on
https://mcuxpresso.nxp.com/en/welcome
there are several sai examples, in particular in fsl_sai.c:
/* Set master or slave */
if (config->masterSlave == kSAI_Master)
..drivers/fsl_sai.h
/*! @brief Master or slave mode */
typedef enum _sai_master_slave
{
kSAI_Master = 0x0U, /*!< Master mode include bclk and frame sync */
kSAI_Slave = 0x1U, /*!< Slave mode include bclk and frame sync */
kSAI_Bclk_Master_FrameSync_Slave = 0x2U, /*!< bclk in master mode, frame sync in slave mode */
kSAI_Bclk_Slave_FrameSync_Master = 0x3U, /*!< bclk in slave mode, frame sync in master mode */
} sai_master_slave_t;
Best regards
igor