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
  • Where is this code you're seeing, because I'm looking at the driver in my directory and it correctly clears the pin

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

    I don't see a line like you have above, it looks to me like the clear, which is correct, was commented out and replaced with a set.

    So what exact line of what file are you looking at and you might want to redownload the SDK and check the code didn't get changed by mistake.

Reply
  • Where is this code you're seeing, because I'm looking at the driver in my directory and it correctly clears the pin

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

    I don't see a line like you have above, it looks to me like the clear, which is correct, was commented out and replaced with a set.

    So what exact line of what file are you looking at and you might want to redownload the SDK and check the code didn't get changed by mistake.

Children
No Data
Related