External Stereo hardware codec with nrf5340 Audio DK

Hello team,

I am trying to build an audio LE application where I require a stereo output and microphone input. As an initial part of the project, I am trying to connect an external stereo audio codec (da7212 from Renesas) with nrf5340 Audio DK. I was learning the drivers and API used in the nrf5340 audio application. Most of the times I find it hard to figure out the drivers and API. Can you please shed some lights here so that I am on the correct track?

I can see that the application has used nrfx_i2s driver. It is included in the audio_i2s file. And from the firmware-architecture it is clear that the audio_i2s.c is used for the audio streaming from and to the codec using i2s bus. I am finding it hard to modify the application files so as to add an external stereo codec. Karl Ylvisaker has already provided me some useful information about the hardware connections in a private post. I am attaching the screenshots below. 

It would be really helpfull if you could inform me which files and functions (in general) are to be modified to add in the required functionality. I understand that I will have to remove all the calls for the cirrus logic codec (CS47L63) and remove its configurations from the prj.conf. Can you also please refere me some documentation to help me understand the audio_i2s.c driver / file?

Thank you for your time,

Best regards,

Adarsh

Parents
  • Hello Adarsh,

    I have contacted the developers and other than the things in that screenshot, they recommend you to look at the API in the hw_codec.h and make your own API implementation for the new codec.

    Remember to set hw_codec_sel_out to GPIO_OUTPUT_HIGH to make sure the external codec is selected

    I don't think I have any more documentation to link to currently other than the nRF5340 Audio page which you have already looked at.

    Best regards,
    Michal

  • Hai Michal,

    Thanks for the clarification. Since there are no documentation which explains the API, can you help me figure out few things?

    I cannot find information about the function "regmap_read" and "regmap_write". These are called inside "cs47163_read_reg" and "cs47163_write_reg" in cs47163.c file. Which file contains the definition for these functions? 

    Thanks for your time.

    Best regards,

    Adarsh

Reply
  • Hai Michal,

    Thanks for the clarification. Since there are no documentation which explains the API, can you help me figure out few things?

    I cannot find information about the function "regmap_read" and "regmap_write". These are called inside "cs47163_read_reg" and "cs47163_write_reg" in cs47163.c file. Which file contains the definition for these functions? 

    Thanks for your time.

    Best regards,

    Adarsh

Children
  • Hello Adarsh,

    Those functions are defined in modules/hal/cirrus-logic/common/regmap.c

    Assuming you are using VS Code with the nRF Connect extension you should also be able to select the function and click F12 to "Go to Definition", or right click it with your mouse and select that from the context menu.

    If that does not work, you may need to build the project first. It may be also be a good idea to create an unmodified sample to have on the side for the ease of digging into the code.

    Best regards,

    Michal

Related