Details: SDK v15.2.0 using HX711 sample code copy-pasted over twi_master_using_nrf_twi_mngr example. Windows 8.1, uploading to nRF52 DK.
I am having a hard time understanding this section of code. I read the timer section in the product specs v1.4, but I am clearly still not understanding it fully.
- When I run it in the debugger, it loops through the do-while loop in the section of code below a lot and never increments any timer1 or timer2 register values. I added the NRF_LOG_INFO((int) NRF_TIMER2->CC[1]); line to try and readout the value but it just sends LOG: "blank"
- When I build and run it on the board, it tells me "stopped by vector catch"
When I read the code above, it tells me this:
- loop through until i equals the number of ADC bits desired
- capture timer2 value to CC[1] register
- if: CC[1] (set to timer2 value) is equal or greater than ADC bits then exit (but timer2 was never started, why??)
- else: logger
- continue to do this until timer1 events_compare[0] is not zero (but CC[0] was initialised to 1, and events_compare would only go high if timer1 was equal to the value in CC[0] so unless timer1 overflows, it's unlikely it will catch??)
- reset events_compare[0]
This code was written by Vidar so I'm sure it works fine. I feel like I'm doing something wrong
My main function looks like this: