-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
I'm going through the book with a V2.21 board at the moment, and enjoying it immensely, thank you!
I've now hit section 11.6, and discovered that the solution present in 11.6 does not work. In particular, execution gets stuck at this line:
sensor.init().unwrap(); |
I also discovered that I cannot gdb-attach to this one, and it took me a little while to realize that it was because of the different Embed.toml
configuration (may be worth calling that out somewhere in the docs?), so I arrived at ^ with print debugging 😅 After changing the config, I discovered that execution seems to be stuck in
nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>::wait<nrf52833_pac::TWIM0>
specifically with a backtrace of
#4 0x00004d02 in nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>::write_part<nrf52833_pac::TWIM0> (self=0x2001fcc3,
buffer=..., final_operation=true)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nrf-hal-common-0.18.0/src/twim.rs:416
#5 0x0000607e in nrf_hal_common::twim::{impl#2}::transaction<nrf52833_pac::TWIM0> (self=0x2001fcc3, address=25,
operations=...)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nrf-hal-common-0.18.0/src/twim.rs:548
#6 0x00004bbe in embedded_hal::i2c::I2c::write<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>, u8> (self=0x2001fcc3,
address=25, write=...)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/embedded-hal-1.0.0/src/i2c.rs:355
#7 0x00000a88 in lsm303agr::interface::{impl#2}::write_accel_register<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>, nrf_hal_common::twim::Error, lsm303agr::register_address::CtrlReg4A> (self=0x2001fcc3, reg=...)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lsm303agr-1.1.0/src/interface.rs:60
#8 0x0000104e in lsm303agr::Lsm303agr<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, lsm303agr::types::mode::MagOneShot>::acc_enable_bdu<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, nrf_hal_common::twim::Error, lsm303agr::types::mode::MagOneShot> (self=0x2001fcc2)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lsm303agr-1.1.0/src/device_impl.rs:89
#9 0x00001104 in lsm303agr::Lsm303agr<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, lsm303agr::types::mode::MagOneShot>::acc_enable_temp<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, nrf_hal_common::twim::Error, lsm303agr::types::mode::MagOneShot> (self=0x2001fcc2)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lsm303agr-1.1.0/src/device_impl.rs:98
#10 0x0000119c in lsm303agr::Lsm303agr<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, lsm303agr::types::mode::MagOneShot>::init<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, nrf_hal_common::twim::Error, lsm303agr::types::mode::MagOneShot> (self=0x2001fcc2)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lsm303agr-1.1.0/src/device_impl.rs:81
You can see that we never hit the breakpoint at the next line after init:
(gdb) list
38
39 write!(serial, "pre\r\n").unwrap();
40 let mut sensor = Lsm303agr::new_with_i2c(i2c);
41 write!(serial, "init\r\n").unwrap();
42 sensor.init().unwrap();
43 write!(serial, "set_accel\r\n").unwrap();
44 sensor
45 .set_accel_mode_and_odr(
46 &mut timer0,
47 AccelMode::HighResolution,
(gdb) b 42
Breakpoint 2 at 0x1d96: file mdbook/src/11-i2c/src/main.rs, line 42.
(gdb) b 44
Breakpoint 3 at 0x1e24: file mdbook/src/11-i2c/src/main.rs, line 45.
(gdb) c
Continuing.
Program received signal SIGINT, Interrupt.
i2c::__cortex_m_rt_main () at mdbook/src/11-i2c/src/main.rs:24
24 fn main() -> ! {
(gdb) c
Continuing.
Breakpoint 2, i2c::__cortex_m_rt_main () at mdbook/src/11-i2c/src/main.rs:42
42 sensor.init().unwrap();
(gdb) c
Continuing.
Program received signal SIGINT, Interrupt.
lsm303agr::Lsm303agr<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, lsm303agr::types::mode::MagOneShot>::init<lsm303agr::interface::I2cInterface<nrf_hal_common::twim::Twim<nrf52833_pac::TWIM0>>, nrf_hal_common::twim::Error, lsm303agr::types::mode::MagOneShot> (self=0x0)
at /Users/jon.gjengset/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lsm303agr-1.1.0/src/device_impl.rs:80
80 pub async fn init(&mut self) -> Result<(), Error<CommE>> {
(gdb) c
Continuing.
Metadata
Metadata
Assignees
Labels
No labels