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

spi_event_handler can not be triggered after button is pushed.

hi

I write a function getT() to read spi thermalcouple chip. if the function getT() is called in main() function, it will work correctly. Hence, I think that getT() is correct essentially.

if the function getT() is called when BSP_EVENT_KEY4 is triggered(in function bsp_event_handler), the function getT() does not work correclty.

Trace the codes, I find the function spi_event_handler() does not be called and causes err_code = NRF_ERROR_BUSY in function nrf_drv_spi_xfer.

I.E. the funtion spi_event_handler() will not be called after the funtion bsp_event_handler() is called.

The following is part of my codes:

int main(void)
{ ....
  spi_config();
  getT();
  ....
}

In above code, the function getT() in the main() block is work correctly.

static void bsp_event_handler(bsp_event_t event)
{ .....
  switch (event) {
     ....
     case BSP_EVENT_KEY_4:
     getT();
  }
  ....
}

In above code, the function getT() can not work correctly when it is put in the bsp_event_handler block.(The spi_event_handler does not be called)

How can I fixed this issue?

Thank you for your help. Best Wishes

Related