This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is Errata 109 occurrence related to SPI frequency?

I have been having issues with our Flash component (S25FL256S) over SPI with the nRF52832 using easyDMA. When reading out values of a peripheral, the returned contents are sometimes empty. This has been seen very often when using a low SPI frequency (256 kHz), and much less frequently at 8 MHz.

We init the flash with the nrf_drv_spi abstraction layer.

nrf_gpio_cfg_output( FLASHMEM_CS );
nrf_gpio_pin_set( FLASHMEM_CS );

nrf_delay_ms( 100 );

nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;

spi_config.ss_pin   = FLASHMEM_CS;
spi_config.miso_pin = FLASHMEM_SDO;
spi_config.mosi_pin = FLASHMEM_SDI;
spi_config.sck_pin  = FLASHMEM_SCK;
spi_config.frequency = NRF_DRV_SPI_FREQ_8M;

spi_config.irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY;

spi_config.bit_order = NRF_SPI_BIT_ORDER_MSB_FIRST;
spi_config.mode = NRF_SPI_MODE_0;  //CPHA = 0 CPOL = 0
LOG_FLASH( "Trying to init SPI\n" );
ret_code_t ret_code =  nrf_drv_spi_init( &spi, &spi_config, spi_event_handler, NULL /* p_context  */ );
LOG_FLASH( "nrf_drv_spi_init - ret_code %d\n", ret_code );
APP_ERROR_CHECK( ret_code );

and are making our spi calls through a function to abstrtact the nrf_drv_spi_transfer command

static bool spiXfer( spi_cmd_t * spiCmd ) {
    uint32_t rxLength = 0;
    ret_code_t ret_code;

    // if queue empty, return
    if ( spiCmd == &CUSTOM__EMPTY_SPI_CMD) return true;

    memset( spi_rx_buf, 0, CUSTOM__SPI_BFF_SIZE );

    logSpiCmdDetails(spiCmd);

    // nordic uses a shift buffer, rx must be length of tx+rx
    if(spiCmd->rxLength){
        rxLength += spiCmd->txLength;
        rxLength += spiCmd->rxLength;
    }

    ret_code = nrf_drv_spi_transfer( &spi,
                                     spiCmd->txData,
                                     spiCmd->txLength,
                                     spi_rx_buf,
                                     rxLength );

    APP_ERROR_CHECK( ret_code );
    return((ret_code == 0) ? true : false);
}

the values being passed into this function have been confirmed as correct.

Since this issue has a similar symptom of Errata 109, I was wondering if it could be related.

In this case, enabling the Errata 109 workaround is having no effect on the results.

Parents Reply
  • The specification for the device has only maximum speeds listed per command. For the read and write commands we are using, it has 50 MHz listed, so I do not believe this is the problem here.

    Since the time of posting I have also seen the problem with 8 MHz. I have updated the question accordingly.

Children
No Data
Related