Extracting CS47L63 driver from nRF5340 Audio DK application

After some considerable effort, I have extracted the CS47L63 driver from the nrf5340_audio application, and finally have the absolute bare minimum proof of concept code that builds and functions exactly as expected.

But only if debug optimizations (-Og) are enabled in the build configuration.

Without those, the CS47L63 does not initialize correctly, and its driver tries to use I2C instead of SPI to communicate, which of course fails. Note that cs47l63_comm_init() does not produce any log errors, but does not return 0.

I don't know how to debug the issue because it works flawlessly when debug optimizations are enabled, but not without, and my Zephyr knowledge is too limited to discern my subtle mistake. I'm asking for a more experienced developer to please point me in the right direction.

The /src/drivers/ directory only contains 4 files copied verbatim from the nrf5340_audio repo, and my main.c is incredibly sparse, so it should be very easy to understand (it just briefly beeps the internal tone generator).

I have attached the project, and would greatly appreciate whatever assistance or guidance anyone can provide.

nrfadk_codec_test.zip

Related