Error in nRF5340 Audio DK sample application

I've been studying the CS47L63 register configuration file (cs47l63_reg_conf.h) included with the nr5340_audio application in extremely fine detail, and have discovered what I believe is an error.

The CS47L63 features two separate Audio Serial Ports (ASP1 and ASP2) on eight of its GPIO pins. ASP1 is correctly configured on pins 1-4 by setting each of their function registers to GPn_FN=0 (alternate pin-specific functions).

However the ASP2 GPIO pins 5-8 are seemingly incorrectly configured with their registers set to GPn_FN=1 (logic-level outputs), meaning that even if ASP2 is enabled, the P11 connector pins on the nRF5340 Audio DK labeled "Aux I2S" will never transceive their documented signals.

Shouldn't the ASP2 GPIO pins be configured to GPn_FN=0 just like the ASP1 GPIO? Is there a reason they've been disconnected from ASP2? I understand that they can be repurposed to output other interrupt and status signals, but shouldn't their default configuration match their labels and documentation?

Am I missing something, or did Nordic?

  • Here's a detail from "Figure 7: nRF5340 Audio DK codec" in the nRF5340 Audio DK User Guide, clearly stating that pins 5-8 are designated as AUX_I2S on ASP2.

    nRF5340 Audio DK codec schematic

    And here's another detail from "Figure 10: Interface connectors for onboard hardware codec" showing the P11 header labels for the AUX_I2S connector.

    nRF5340 Audio DK P11 AUX_I2S connecter

    Yet the register configuration file containing the CS47L63 codec's default settings in the nrf5340_audio application does not apply the correct values for these GPIO pins at all.

    cs47l63_reg_conf.h line 46:

    /* Set up GPIOs */
    const uint32_t GPIO_configuration[][2] = {
        { CS47L63_GPIO6_CTRL1, 0x61000001 },
        { CS47L63_GPIO7_CTRL1, 0x61000001 },
        { CS47L63_GPIO8_CTRL1, 0x61000001 },
        
        /* Enable CODEC LED */
        { CS47L63_GPIO10_CTRL1, 0x41008001 }
    };

    The values for GPIO 6-8 above set the following register labels:

    GPn_FN =      1 (logic level output)
    GPn_POL =     0 (polarity active high)
    GPn_DB =      0 (debounce disabled)
    GPn_OP_CFG =  0 (output config CMOS)
    GPn_LVL =     0 (output level low)
    GPn_DBTIME =  0 (debounce time 100µs)
    GPn_DRV_STR = 1 (drive strength 8mA)
    GPn_PD =      1 (pulldown enabled)
    GPn_PU =      1 (pullup enabled)
    GPn_DIR =     0 (direction output)

    That configuration does NOT match the schematic, the documentation, nor the silkscreen on the physical board. Since this is literally the only working code provided for the nRF5340 Audio DK, it is inarguably wrong.

    The ASP1 GPIO are correctly configured a few lines later, though for some inexplicable reason GPIO 5 has been grouped here and is also configured incorrectly.

    cs47l63_reg_conf.h line 115:

    /* Set up ASP1 (I2S) */
    const uint32_t asp1_enable[][2] = {
    	/* Enable ASP1 GPIOs */
    	{ CS47L63_GPIO1_CTRL1, 0x61000000 },
    	{ CS47L63_GPIO2_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO3_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO4_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO5_CTRL1, 0x61000001 },

    To actually match the intended and documented functionality of the development kit, the GPIOn_CTRL1 registers for pins 1-8 should all be set to 0xE1000000, which configures each label to its default value, except for GPn_FN=0 which configures dedicated ASP1/2 functions and overrides individual label values as required.

    Here's how the code, in my opinion, SHOULD read:

    /* Set up GPIOs (Aux I2S, repurpose as needed) */
    const uint32_t GPIO_configuration[][2] = {
        { CS47L63_GPIO5_CTRL1, 0xE1000000 },
        { CS47L63_GPIO6_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO7_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO8_CTRL1, 0xE1000000 },

    /* Set up ASP1 (I2S) */
    const uint32_t asp1_enable[][2] = {
    	/* Enable ASP1 GPIOs */
    	{ CS47L63_GPIO1_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO2_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO3_CTRL1, 0xE1000000 },
    	{ CS47L63_GPIO4_CTRL1, 0xE1000000 },

    Is this not an error in need of correction?

  • Hi,

    Thank you for providing additional information. We will look into this internally. 

    Best regards,
    Dejan

  • Seriously, it is somewhat concerning that an absolute rank amateur like myself was able to spot such an egregious configuration error in Nordic's flagship BLE Audio development kit.

    Do I at least win a bug bounty t-shirt? :)

  • This is no longer my problem, as I've already replaced Nordic's woefully inadequate cs47l63_reg_conf.h file with my own that not only configures the Audio DK as the circuit designers intended, but also enables features such as tone/noise test signals, parametric/shelving EQ, and dynamic compression/expansion.

    But since Nordic's nr5340_audio application is the only working code example for the Audio DK, you might consider replacing lines 46-54 with the following (I've documented each register label's changed values from default):

    /* Set up GPIOs */
    const uint32_t GPIO_configuration[][2] = {
    	/* ASP1 */
    	{ CS47L63_GPIO1_CTRL1,   0xE1000000 },  // FN=0(ASP1_DOUT)
    	{ CS47L63_GPIO2_CTRL1,   0xE1000000 },  // FN=0(ASP1_DIN)
    	{ CS47L63_GPIO3_CTRL1,   0xE1000000 },  // FN=0(ASP1_BCLK)
    	{ CS47L63_GPIO4_CTRL1,   0xE1000000 },  // FN=0(ASP1_FSYNC)
    	/* ASP2 */
    	{ CS47L63_GPIO5_CTRL1,   0xE1000000 },  // FN=0(ASP2_DOUT)
    	{ CS47L63_GPIO6_CTRL1,   0xE1000000 },  // FN=0(ASP2_DIN)
    	{ CS47L63_GPIO7_CTRL1,   0xE1000000 },  // FN=0(ASP2_BCLK)
    	{ CS47L63_GPIO8_CTRL1,   0xE1000000 },  // FN=0(ASP2_FSYNC)
    	/* Enable CODEC LED */
    	{ CS47L63_GPIO10_CTRL1,  0x41008001 },  // FN=1(logic), LVL=1, PD=0, DIR=0(out)
    	/* I2C2 */
    	{ CS47L63_GPIO11_CTRL1,  0xE1000000 },  // FN=0(I2C2_SCL)
    	{ CS47L63_GPIO12_CTRL1,  0xE1000000 },  // FN=0(I2C2_SDA)
    	{ CS47L63_CIF_PAD_CTRL1, 0x00000011 },  // SPI_I2C_MST_SEL=0(I2C)
    };

    The above at least demonstrates the proper GPIO configuration in one reference location that matches the schematic, documentation, and board silkscreen.

    It still leaves the actual setup of the ASP2 and I2C2 peripherals to the user, but consolidates the GPIO settings making it easier to study and understand, and does not affect the existing nr5340_audio application's functionality in any way.

    You're welcome.

  • Hello,

    Dejan is out, but I am just pitching in some background to the way it is.

    The ASP2 port is not used by the default audio application. So, the use of this port is up to the user, and as such I guess there is no right or wrong configuration of it. As you rightly argue, the silk screen and schematic does label this as an ASP port, but as this can be both GPIO in, GPIO out, ASP in and ASP out, we opted for the labeling that we have.  Please configure this port as you like in your application.

    ace.johnny said:
    Do I at least win a bug bounty t-shirt? :)

    Ohhh... that could be a interesting thing to have. I will take a note of whether this could be something we could have.

    Kenneth

Related