I’m using a driver for the ak4619 codec ported to work with SPI and I’m having a clock issue. I’m testing with “aplay -D sysdefault taunt.wav”, and the first time through it appears to work, although I’m not sure I have actual audio. But there are no errors and it waits the length of the wavfile before giving me a cursor again.
The second time through I get an error:
[ 242.433224] fsl-sai 30c10000.sai: failed to derive required Tx rate: 705600
Using “cat /sys/kernel/debug/clk/clk_summary” I see the sai1_root clock starts at 24576000 initially, goes to 12288000 after the first playback, and then after the failed playback it reads 5617372.
I added a debug to the driver and during the first playback I see:
[ 108.877706] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 0 clk rate 400000000
[ 108.886069] fsl-sai 30c10000.sai: fsl_sai_set_bclk: look for 1536000 ratio 260 ret 640000
[ 108.894285] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 1 clk rate 12288000
[ 108.902677] fsl-sai 30c10000.sai: fsl_sai_set_bclk: look for 1536000 ratio 8 ret 0
And during the second (failing) playback I see:
[ 242.385482] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 0 clk rate 400000000
[ 242.393810] fsl-sai 30c10000.sai: fsl_sai_set_bclk: look for 705600 ratio 566 ret 630400
[ 242.401934] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 1 clk rate 5617372
[ 242.410061] fsl-sai 30c10000.sai: fsl_sai_set_bclk: look for 705600 ratio 7 ret 678172
[ 242.418004] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 2 clk rate 0
[ 242.425618] fsl-sai 30c10000.sai: fsl_sai_set_bclk: ‘30c10000.sai’ id 3 clk rate 0
[ 242.433224] fsl-sai 30c10000.sai: failed to derive required Tx rate: 705600
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello David,
Thank you for reaching out with your issue regarding the SAI clock on the Verdin iMX8M Plus. It seems like the clock configuration is not being restored correctly after the first playback, which is causing the failure during the second attempt. Here are some steps you can take to troubleshoot and potentially resolve this issue:
Clock Configuration: Double-check that the clock settings for the SAI interface are correctly configured in your driver. Ensure that the clock is set to the required frequency before each playback. The change in clock rate from 24.576 MHz to 12.288 MHz after the first playback suggests that the settings might not be properly restored for subsequent playbacks.
Driver Initialization: Review your driver code to ensure that the clock settings are re-initialized or reset before each playback. The debug logs indicate that the clock rate is not being set correctly for the second playback, which leads to the failure in deriving the required transmission rate.
Clock Source Stability: Verify that the clock source for the SAI interface is stable and correctly configured. Any instability or misconfiguration in the clock source between playbacks could contribute to the issue.
Codec Configuration: Ensure that the AK4619 codec configuration is compatible with the SAI interface settings. Any mismatch in expected clock rates or configurations could lead to errors during playback.
By following these steps, you should be able to identify and resolve the clock issue with your Verdin iMX8M Plus. If the problem persists, consider reviewing the driver and codec documentation for additional configuration details.
I hope this helps, and please feel free to reach out if you have further questions.
Best regards,
Toradex AI Assistant
Please, also check if these links can help you solve your problem:
To assist you effectively, we first need to be able to reproduce your issue.
At the moment, we only know that you are using an unspecified driver for the AK4619 codec, added to an unknown OS release, with the AK4619 IC connected in an unspecified way to an undisclosed SPI channel. Additionally, we do not have any details on how your codec and its SPI channel are configured in your Device Tree.
Without this crucial information, it is difficult for us to provide meaningful support. Could you please share more details about your setup? This will allow us to better understand the issue and guide you accordingly.
Thanks for responding, alex. I think the issue is that the clock rate of the wav file (22457 or so) wasn’t compatible with my MCLK frequency. It wasn’t really working the first time, either.
I’ve provided the device tree information via email on the thread “I2S Voltage levels for Verdin iMX8MP” from Ben.
Do you know if there’s any kind of user guide or other documentation on setting up device tree clocking for SAI? We need to source BCLK and FS from the CPU, and I’m assuming there must be pinctrl setting changes required since the default I2S setup sources them from the codec.