nobodyguy / HX711_zephyr_driver

Out of tree HX711 weight sensor driver for Zephyr RTOS
Apache License 2.0
23 stars 13 forks source link

Getting 0.000 grams when using nrf52840dk with NRF Connect SDK (2.6.1) #11

Closed amudhan-rkr closed 2 weeks ago

amudhan-rkr commented 3 weeks ago

I am new to Embeded programming and starting with NRF connect SDK.

I followed the steps and configured this as a module in my project and able to compile. But the reading always comes a 0.00 grams.

I used 907 gram as a calibration weight.

This is the weight sensor setup.

20240821_122406

As this board don't have rate GPIO so here is my overlay file setting

/{ hx711 { compatible = "avia,hx711"; status = "okay"; //label = "HX711"; dout-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; sck-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; //rate-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; }; };

nobodyguy commented 3 weeks ago

Hello, NRF Connect SDK 2.6.1 (Zephyr 3.5.99) is not tested and supported. Can you post logs with CONFIG_SENSOR_LOG_LEVEL=4 configured?

amudhan-rkr commented 3 weeks ago

Here is the log:

[00:00:00.366,302] <dbg> HX711: hx711_init: Initialising HX711

[00:00:00.366,333] <dbg> HX711: hx711_init: SCK GPIO port : gpio@50000000

[00:00:00.366,363] <dbg> HX711: hx711_init: SCK Pin : 27

[00:00:00.366,394] <dbg> HX711: hx711_init: DOUT GPIO port : gpio@50000000

[00:00:00.366,424] <dbg> HX711: hx711_init: DOUT Pin : 26

[00:00:00.366,424] <dbg> HX711: hx711_init: Gain : 1

[00:00:00.366,455] <dbg> HX711: hx711_init: Offset : 0

[00:00:00.366,455] <dbg> HX711: hx711_init: Slope : 1.0

[00:00:00.366,485] <dbg> HX711: hx711_init: SCK pin controller is 0xa558, name is gpio@50000000

[00:00:00.366,546] <dbg> HX711: hx711_init: DOUT pin controller is 0xa558, name is gpio@50000000

[00:00:00.366,577] <dbg> HX711: hx711_init: Set DOUT pin : 26

*** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
[00:02:05.180,999] <inf> main: Device is 0xa580, name is hx711
[00:02:05.181,030] <inf> main: Calculating offset...
[00:02:05.522,979] <dbg> HX711: avia_hx711_tare: Average before division : 41943040
[00:02:05.523,010] <dbg> HX711: avia_hx711_tare: Average after division : 8388608
[00:02:05.523,040] <inf> main: Waiting for known weight of 100 grams...
[00:02:05.523,040] <inf> main:  10..
[00:02:06.523,162] <inf> main:  9..
[00:02:07.523,254] <inf> main:  8..
[00:02:08.523,437] <inf> main:  7..
[00:02:09.523,620] <inf> main:  6..
[00:02:10.523,803] <inf> main:  5..
[00:02:11.523,986] <inf> main:  4..
[00:02:12.524,169] <inf> main:  3..
[00:02:13.524,353] <inf> main:  2..
[00:02:14.524,536] <inf> main:  1..
[00:02:15.524,719] <inf> main:  0..
[00:02:16.524,902] <inf> main: Calculating slope...
[00:02:16.811,889] <dbg> HX711: avia_hx711_calibrate: Average before division : 41943040
[00:02:16.811,920] <dbg> HX711: avia_hx711_calibrate: Average after division : 8388608
[00:02:16.811,950] <dbg> HX711: avia_hx711_calibrate: Slope set to : 1.000000
[00:02:28.658,691] <inf> main: Weight: 0.000000 grams
[00:02:40.212,493] <inf> main: Weight: 0.000000 grams
[00:02:41.212,890] <inf> main: Weight: 0.000000 grams
[00:02:42.213,256] <inf> main: Weight: 0.000000 grams
[00:02:43.213,623] <inf> main: Weight: 0.000000 grams
[00:02:44.213,989] <inf> main: Weight: 0.000000 grams
[00:02:45.214,355] <inf> main: Weight: 0.000000 grams
[00:02:46.214,721] <inf> main: Weight: 0.000000 grams
[00:02:47.215,087] <inf> main: Weight: 0.000000 grams
[00:02:48.215,454] <inf> main: Weight: 0.000000 grams
[00:02:49.215,820] <inf> main: Weight: 0.000000 grams
[00:02:50.216,186] <inf> main: Weight: 0.000000 grams
[00:02:51.216,552] <inf> main: Weight: 0.000000 grams
[00:02:52.216,918] <inf> main: Weight: 0.000000 grams
[00:02:53.217,285] <inf> main: Weight: -65536.000000 grams
[00:02:54.217,651] <inf> main: Weight: 0.000000 grams
[00:02:55.218,017] <inf> main: Weight: 0.000000 grams
[00:02:56.218,383] <inf> main: Weight: 0.000000 grams
[00:02:57.218,750] <inf> main: Weight: 0.000000 grams
[00:02:58.219,116] <inf> main: Weight: 0.000000 grams
[00:02:59.219,482] <inf> main: Weight: 0.000000 grams
[00:03:00.219,848] <inf> main: Weight: 0.000000 grams
[00:03:01.220,214] <inf> main: Weight: 0.000000 grams
[00:03:02.220,581] <inf> main: Weight: 0.000000 grams
[00:03:03.220,947] <inf> main: Weight: 0.000000 grams
[00:03:04.221,313] <inf> main: Weight: 0.000000 grams
[00:03:05.221,679] <inf> main: Weight: 0.000000 grams
[00:03:06.222,045] <inf> main: Weight: 0.000000 grams
[00:03:07.222,412] <inf> main: Weight: 0.000000 grams
[00:03:08.222,778] <inf> main: Weight: 0.000000 grams
[00:03:09.223,144] <inf> main: Weight: 0.000000 grams
[00:03:10.223,510] <inf> main: Weight: 0.000000 grams
[00:03:11.223,876] <inf> main: Weight: 0.000000 grams
[00:03:12.224,243] <inf> main: Weight: 0.000000 grams
[00:03:13.224,609] <inf> main: Weight: 0.000000 grams
[00:03:14.224,975] <inf> main: Weight: 0.000000 grams
[00:03:15.225,341] <inf> main: Weight: 0.000000 grams
[00:03:16.225,708] <inf> main: Weight: 0.000000 grams
[00:03:17.226,074] <inf> main: Weight: 0.000000 grams
[00:03:18.226,440] <inf> main: Weight: 0.000000 grams
[00:03:19.226,806] <inf> main: Weight: 0.000000 grams
[00:03:20.227,172] <inf> main: Weight: 0.000000 grams
[00:03:21.227,539] <inf> main: Weight: 0.000000 grams
[00:03:22.227,905] <inf> main: Weight: 0.000000 grams
[00:03:23.228,271] <inf> main: Weight: 0.000000 grams
[00:03:24.228,637] <inf> main: Weight: 0.000000 grams
[00:03:25.229,003] <inf> main: Weight: 0.000000 grams
[00:03:26.229,370] <inf> main: Weight: 0.000000 grams
[00:03:27.229,736] <inf> main: Weight: 0.000000 grams
[00:03:28.230,102] <inf> main: Weight: 0.000000 grams
[00:03:29.230,468] <inf> main: Weight: 0.000000 grams
nobodyguy commented 3 weeks ago

Thank you. Can you describe your setup? (HW connection, other peripherals, basic firmware flow...) You can also try this config option if there are some higher priority interrupts (radio stack, etc.) messing up the HX711 communication: CONFIG_HX711_DISABLE_INTERRUPTS_WHILE_POLLING=y

nobodyguy commented 2 weeks ago

Feel free to reopen it with more info.