Zephyr I2S driver MCLK and i2s_state

Working with the nRF52840 and nRF Connect SDK 2.2.0 and developing for hardware with a codec that requires a clock supplied via the MCLK pin from the I2S0 peripheral.

We're using the Zephyr I2S peripheral driver:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/zephyr/hardware/peripherals/audio/i2s.html

It's working except there doesn't seem to be any way to set up or enable the MCLK signal on the I2S0 peripheral through the I2S API.  The MCLK pin does get assigned correctly from DTS, but when calling the API function i2s_trigger(), where the configuration is applied and the I2S0 peripheral started, MCLK is disabled.  Note that by writing directly to the CONFIG.MCKFREQ and CONFIG.MCKEN registers after the i2s_trigger() call MCLK turns on and runs correctly, and everything else works well through the API.

Is there a way to configure and enable the I2S0 MCLK through the Zephyr I2S API or another Zephyr API?

Second question - the Zephyr I2S API documentation (link above) and header file define the "enum i2s_state" with the states "I2S_STATE_NOT_READY", "I2S_STATE_READY", "I2S_STATE_RUNNING", ... etc.  The API documentation for the API functions says things like "If the interface is in READY state the number of bytes..." and "This trigger can be used in ERROR state only..." etc.

However, we don't see a way in the API to query what the present interface state is.  The enum "i2s_state" doesn't appear anywhere in the API header except for its declaration.

How is the I2S interface state queried?

Thanks & Regards,

Walt

Related