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

Timer Issue With HX711 - Stopped By Vector Catch Error

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:

Parents
  • which pins of your nrf dev kit did you use, cause I'm using Arduino pin 5 and 4 and I only seem to be reading 0 values. any help would be greatly appreciated.

  • It shouldn't be a problem to use pin 5 and 4 as long as they are not used for anything else in your code. Have you tried compiling with code optimization enabled? It may be necessary to read out the DOUT pin fast enough. Are you powering the hx711 through another GPIO?

  • I am using optimization level -o3and I am powering the hx711 through the 5V pin provided by the nrf52840

Reply Children