This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I2S SDOUT On GPIO19 Not Working

Hi,

I'm having difficulties driving SDOUT when it's configured to pin 19 on the NRF52840. I can operate the peripheral and see output data when my WS2812_PIN macro is assigned to NRF_GPIO_PIN_MAP(0, 27). 

I've confirmed the peripheral itself is still running - I continue to see LRCK and SCK on pins 26, and 25 respectively. 

Any suggestions why Pin 19 may be causing me such troubles? 

I've attached a copy of my I2S Initialization function.

Thanks,

Hayden

 

#define WS2182B_PIN NRF_GPIO_PIN_MAP(0, 27) // V0.9 Hw uses incompatible Pin NRF_GPIO_PIN_MAP(0, 19)

// Configure I2S to Appropriate Data Rate and Start It
uint8_t initializeI2S(void) {
    // Populate I2S Tx Buffer with all Blanks initially
    memset(m_buffer_tx, 0x00, sizeof(m_buffer_tx));

    // Set Pin as Output
    nrf_gpio_cfg_output(WS2182B_PIN);    
    
    // Setup I2S Peripheral. DON'T CHANGE THESE VALUES
    nrf_drv_i2s_config_t config = NRF_DRV_I2S_DEFAULT_CONFIG;
    
    // Unused Pins Conflict with ADC Pins
    // I2S Will not Operate w/o lrck and sck routed to pins
    config.lrck_pin = 26;
    config.sck_pin = 25;
    config.mck_pin = 0xFF;
    config.sdin_pin = 0xFF;

    // Assign Values we Care About
    config.sdout_pin = WS2182B_PIN;
    config.sample_width = NRF_I2S_SWIDTH_16BIT;
    config.mck_setup = NRF_I2S_MCK_32MDIV10; // 3.2Mhz / Bit. 800Khz for 4bit words
    config.ratio     = NRF_I2S_RATIO_32X;    // IDEK?
    config.channels  = NRF_I2S_CHANNELS_STEREO;

    // Initialize the Hardware
    ret_code_t err_code = nrf_drv_i2s_init(&config, data_handler);
    if (err_code != NRF_SUCCESS) {
        SEGGER_RTT_WriteString(0, "Can't configure the I2S Peripheral\r\n");
        return AXXS_FAILURE;
    }
    
    // Start Driving the WS2812B-B
    err_code = nrf_drv_i2s_start(&i2sbuf, sizeof(m_buffer_tx), 0);
    if (err_code != NRF_SUCCESS) {
        SEGGER_RTT_WriteString(0, "Can't Start the I2S Peripheral\r\n");
        return AXXS_FAILURE;
    }

    // Return Success if we Get Here
    return AXXS_SUCCESS;
}

Related