I know this may be a duplicate of this: https://devzone.nordicsemi.com/f/nordic-q-a/37732/nrf52840-spi-clock-line-contention-causing-spi-driver-to-hang/145521#145521
I say that because my code is hanging in the same line of code. Buy my hardware is a little different:
We have two versions of hardware and each one of them has a different peripheral connected to the same SPI pins: one of them is an IMU and the other one is an Ethernet chip.
So, if we build the code for the HW version that has the ETH chip and load it into a board with the HW version that has the IMU, it will hang, probably for the same reason as in the linked topic.
But for my case just rebooting the SPI peripheral doesn't work because the code itself is expecting a different peripheral. So, is there a workaround for this that doesn't include changing the SDK?
The only solution that I can think of is: adding another flag to the loop, and then using a timer that will set this flag to false after a period of time, making the code jump out of the loop. Something like:
//setting up a timer outside of the SDK to set timer_flag to false after a while timer_flag = true; while ( !nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END) && timer_flag ) { }
Any thoughts on this problem would be appreciated.
Thank you so much!