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

nrf_gpio_pin_write to SPI_MOSI

Hello,

In my board, nRF52832 is connected to other MCU.

And those two communicates via SPI. nRF52832 is master.

To synchronize two boards, MOSI pin has to be used.

But it seems like I can't write any value to MOSI pin.

Test code is like below.

    bool states = 0;

    while(1)
    {
      nrf_gpio_pin_write(PIN_NTM_SPI_MOSI, states);
      nrf_gpio_pin_write(PIN_NTM_SPI_SS, states);
      nrf_gpio_pin_write(PIN_LED3_ON, states);
      nrf_delay_ms(100);
      states ^= 1;
    }

LED is turned on/off correctly. And I checked that SPI_SS also works fine. 

But MOSI pin doesn't work.

Spi is configured like this.

nrf_drv_spi_config_t twi_config_ntm = NRF_DRV_SPI_DEFAULT_CONFIG;
    twi_config_ntm.sck_pin  = PIN_NTM_SPI_SCLK;
    twi_config_ntm.mosi_pin = PIN_NTM_SPI_MOSI;
    twi_config_ntm.miso_pin = PIN_NTM_SPI_MISO;
    //twi_config_motions.ss_pin = PIN_LSM_SPI_SS;
    twi_config_ntm.frequency = NRF_SPI_FREQ_8M;
    twi_config_ntm.mode      = NRF_DRV_SPI_MODE_0;
    twi_config_ntm.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;
    twi_config_ntm.irq_priority = APP_IRQ_PRIORITY_LOW;
    err_code = nrf_drv_spi_init(&m_spi_ntm, &twi_config_ntm, spi_event_handler1, NULL);
    RETURN_IF_ERROR(err_code);

Since other MCU that is connected to nRF is very old and tricky to change SW,

I wish to find a way to write MOSI pin.

Parents Reply Children
No Data
Related