ferrous-systems / CO2-Device

16 stars 3 forks source link

Program gets stuck, maybe wrong Pins are used. #1

Open Mirabellensaft opened 5 years ago

Mirabellensaft commented 5 years ago

The when using any of the functions of the SCD30 driver on the sensor instance, the program gets stuck. This may be related to using the wrong pins to instantiate the sensor. The result is the same, if the current pins for scl and sda are used, or if the accelerometer pins.

Backtracing in gdb shows this:

(gdb) bt
#0  0x00002312 in nrf52832_pac::twim0::events_lasttx::<impl nrf52832_pac::twim0::EVENTS_LASTTX>::read (self=0x40003160)
    at /Users/tanks/.cargo/registry/src/github.com-1ecc6299db9ec823/nrf52832-pac-0.8.0/src/twim0/events_lasttx.rs:26
#1  0x00001e74 in nrf52_hal_common::twim::Twim<T>::write (self=0x2000ffe6, address=97, buffer=...)
    at /Users/tanks/.cargo/registry/src/github.com-1ecc6299db9ec823/nrf52-hal-common-0.8.1/src/twim.rs:160
#2  0x0000205c in <nrf52_hal_common::twim::Twim<T> as embedded_hal::blocking::i2c::Write>::write (self=0x2000ffe6, addr=97, bytes=...)
    at /Users/tanks/.cargo/registry/src/github.com-1ecc6299db9ec823/nrf52-hal-common-0.8.1/src/twim.rs:381
#3  0x00000b2a in scd30::scd30::Scd30<T>::soft_reset (self=0x2000ffe6) at /Users/tanks/.cargo/git/checkouts/scd30-rs-24cca21ab41f2a0f/0ae24d2/src/scd30.rs:66
#4  0x00000da4 in main () at src/main.rs:50
(gdb) 
Mirabellensaft commented 5 years ago

using a logic analyser: once the program gets stuck calling the soft_reset function, the scl signal is erratic and shows ERROR, sda is silent.

if no function is called on the sensor instance, the both signals are regular but in ERROR at most times and occasionally this for a fraction of a second:

Screenshot 2019-09-27 at 12 04 49