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

SPIM3 Issue On MOSI Using NRF52840

Hello,

I'm currently using SDK v17.0.2 with the NRF52840 on nRF52840-DK Board. After going through the example code of "nrfx_spim" I was able to get up and running.  I'm using the SPIM3 instance (for the D/CX pin), attempting to talk to an E-Ink display with the following code. Once nrfx_spim_xfer_dcx() is called, nothing happens. As you can see from my logic analyzer trace, SCLK seems to be working and so does Chip Select. However, MOSI has no activity on it. Surely my code has some sort of configuration setting that I'm missing. I also have BLE initialized and advertising as well (code not shown below). Perhaps there' something in sdk_config.h that I also need to enable/disable in order to get this to function correctly?

#define EINK_XFER_BUF_LEN 5
static uint8_t m_tx_buf[EINK_XFER_BUF_LEN] = { 0 };

    // SPIM3, E-Ink Display, initialization:
    nrfx_spim_config_t spim3_config = NRFX_SPIM_DEFAULT_CONFIG;
    spim3_config.frequency      = NRF_SPIM_FREQ_1M; // NRF_SPIM_FREQ_4M, NRF_SPIM_FREQ_2M, NRF_SPIM_FREQ_1M, NRF_SPIM_FREQ_8M, NRF_SPIM_FREQ_16M
    // Pin designation:
    spim3_config.ss_pin         = E_INK_DISPLAY_CS_PIN;
    spim3_config.miso_pin       = NRFX_SPIM_PIN_NOT_USED;
    spim3_config.mosi_pin       = E_INK_DISPLAY_MOSI_PIN;
    spim3_config.sck_pin        = E_INK_DISPLAY_SCLK_PIN;
    spim3_config.dcx_pin        = E_INK_DCX_PIN;
    spim3_config.use_hw_ss      = true;  // Indication to use software or
                                         // hardware controlled chip select pin.
    spim3_config.ss_active_high = false; // Chip select is active low.
 
    spiCtx_t *einkXsferCtx = &m_thisSpimCtx;
    APP_ERROR_CHECK( nrfx_spim_init( &spim_eink, &spim3_config, eink_spim_event_handler, einkXsferCtx ) );
    
    
    // Select 4-wire SPI protocol (3-wire: high, 4-wire: low)
    nrf_gpio_pin_write( E_INK_BUS_SEL_WIRE_PIN, 0 );
    nrf_delay_us( 100 ); // as prescribed by sample code
    
    
    // Macro for setting up the TX transfer command buffer.
    nrfx_spim_xfer_desc_t xfer_desc_cmd_buf = NRFX_SPIM_XFER_TX( m_tx_buf, 1 );
    
     m_tx_buf[0] = POF;  // Command
    einkXsferCtx->commandSent = POF;
    einkXsferCtx->isCommand = true;
    // Signal to the EPD that this is a command
    APP_ERROR_CHECK( nrfx_spim_xfer_dcx( &spim_eink, &xfer_desc_cmd_buf, 0, 1 ) );
    nrf_delay_us( TEST_DELAY_US );
    
    
    



















Parents Reply Children
Related