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

Add delay argument to spi_master_send_recv : Where does the Chipselect get pulled high?

Hello,

for my sensor I need to have a delay BEFORE pulling CS high. So I would like to add an argument to the

spi_master_send_recv()

function that give me exactly this possibility.

But I am not 100% sure where exactly the chipselect pin is triggered.. I tried my best with the debugger and found this line

nrf_gpio_pin_set(p_spi_instance->pin_slave_select);

inside this function:

spi_master_send_recv_irq()

But I have really no clue how this function is called and how I could add my argument to this call.

Parents
  • Yes, nrf_gpio_pin_set() trigger the SS pin. In spi_master_send_recv_irq() for IRQ and in spi_master_send_recv() otherwise. If you have no clue how these functions are called, I would suggest you to search through spi_master.c and see where the functions are called. You can simply add whatever arguments you want to these functions, as long as the arguments are the same as in the function declaration and the function definition.

    To add a delay you could simply put nrf_delay_us() (in nrf_delay.h) before nrf_gpio_pin_set()

Reply
  • Yes, nrf_gpio_pin_set() trigger the SS pin. In spi_master_send_recv_irq() for IRQ and in spi_master_send_recv() otherwise. If you have no clue how these functions are called, I would suggest you to search through spi_master.c and see where the functions are called. You can simply add whatever arguments you want to these functions, as long as the arguments are the same as in the function declaration and the function definition.

    To add a delay you could simply put nrf_delay_us() (in nrf_delay.h) before nrf_gpio_pin_set()

Children
Related