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

SPI CS not toggled during transfer

Hello,

I want to connect one board trough SPI to my nRF51-DK. Using SDK11 and SD130, the nRF51-DK is the SPI master, I call the function nrf_drv_spi_transfer() but the CS Pin is never toggled. To solve this I changed it manually before and after the transfer, but this is not a good solution. I dug into the functions and discovered that this should be done automatically by this part of the code (from what I understood):

    if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
    {
        nrf_gpio_pin_clear(p_cb->ss_pin);
    }

and after the transfer

    if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
    {
       nrf_gpio_pin_set(p_cb->ss_pin);
    }

The NRF_DRV_SPI_PIN_NOT_USEDis defined as 0xFF, do I need to change it? Is there any other way to do this?

Thank you for the help,

Jorge Costa

Parents
  • The pin selected now it's the pin 3, but I already tried others with same results. What happens is that the CS pin just goes low and goes back to high right after. So my slave can't send or receive anything because the CS is always high when the CLK is active. I can't debug on the nRF side because I need an external supply of 2 V to be able to connect to the other board. So I'm measuring the signals with an oscilloscope and there I can see that the behavior of the CS pin isn't correct. Can't understand why is not clearing the CS pin for the duration of the CLK.

Reply
  • The pin selected now it's the pin 3, but I already tried others with same results. What happens is that the CS pin just goes low and goes back to high right after. So my slave can't send or receive anything because the CS is always high when the CLK is active. I can't debug on the nRF side because I need an external supply of 2 V to be able to connect to the other board. So I'm measuring the signals with an oscilloscope and there I can see that the behavior of the CS pin isn't correct. Can't understand why is not clearing the CS pin for the duration of the CLK.

Children
No Data
Related