probe-rs: Arm FaultResponse

Describe the bug Since 9eb1c2f, I’m unable to enumerate my CMSIS-DAP based probe with the nRF9160

The error:

thread 'main' panicked at modem_updater/src/lib.rs:373:44:
called `Result::unwrap()` on an `Err` value: Arm(AccessPort { address: FullyQualifiedApAddress { dp: Default, ap: V1(0) }, source: RegisterRead { address: 12, name: "DRW", source: Dap(FaultResponse) } })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

This snippet is the failure point:

    fn setup_device(&mut self) {
        let mut target = self.session.core(0).unwrap();

        // Init UICR.HFXOSR if necessary
        if target.read_word_32(0x00FF801C).unwrap() == 0xFFFFFFFF {
            log::info!("UICR.HFXOSR is not set, setting it to 0x0E");
            target.write_32(0x00FF801C, &[0x0000000E]).unwrap();
        }

The read in particular causes the exception.

I can also simply reproduce it by running probe-rs download --chip nRF9160_xxAA --binary-format hex ../_bin/v5-2-ga33aa1f-fast-blink.hex --allow-erase-all See full output below.

Expected behavior

To read and write to registers without access issues.

Stacktrace

modem_updater on  main [$!?⇡] is 📦 v0.1.0 via 🦀 v1.80.0
❯ probe-rs download --chip nRF9160_xxAA --binary-format hex ../_bin/v5-2-ga33aa1f-fast-blink.hex --allow-erase-all
 INFO probe_rs::config::target: Using sequence Arm(Nrf9160(()))
 INFO attach: probe_rs::probe::cmsisdap: Using protocol SWD
 INFO probe_rs::architecture::arm::sequences: Debug port Default is powered down, powering up
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Checking if core 0 is unlocked
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Core 0 is already unlocked
 INFO probe_rs::session: Core status: Running
 INFO probe_rs::session: Halting core...
 INFO probe_rs::session: Resuming core...
 INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }                                                                                                                                                          INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }                                                                                                                                                              INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack                                                                                                                                                                                                          INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778                                                                                                                                                                                                                                                   INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack
 INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778
 INFO session_drop: probe_rs::session: Core status: Halted(Exception)                                                                                                                                                                                                                                              INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                                                                                                                                                                     INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                                                                                                                                                                    Error: The flashing procedure failed for '../_bin/v5-2-ga33aa1f-fast-blink.hex'.

Caused by:
    0: Something during the interaction with the core went wrong
    1: An ARM specific error occurred.
    2: Error using access port FullyQualifiedApAddress { dp: Default, ap: V1(0) }.
    3: Failed to write register DRW at address 0x0c
    4: The debug probe encountered an error.
    5: An error which is specific to the debug probe in use occurred.
    6: CMSIS-DAP responded with an error

Desktop (please complete the following information):

PopOS 22.04

Edit: also tried it on Mac (Intel) (OSX 12.7.5) with the same result.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (32 by maintainers)

Commits related to this issue

Most upvoted comments

@jaredwolff & @felipebalbi would you mind testing that PR and let me know if that solves your issue ?

Same here.

❯ probe-rs --version
probe-rs 0.24.0 (git commit: v0.1.0-203-g6fee4b6c)
❯ git show --stat
commit 6fee4b6c51305efac4f00739c4911be16a321448 (HEAD, origin/master, origin/HEAD)
❯ probe-rs download --chip nRF9160_xxAA --binary-format hex _bin/merged_nrf91x1_g7c2eceb.hex --allow-erase-all --log-file trace.log
 INFO probe_rs::util::logging: Writing log to "trace.log"
 INFO probe_rs::config::target: Using sequence Arm(Nrf9160(()))
 INFO attach: probe_rs::probe::cmsisdap: Using protocol SWD
 INFO probe_rs::architecture::arm::sequences: Debug port Default is powered down, powering up
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Checking if core 0 is unlocked
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Core 0 is already unlocked
 INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }       INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }           INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack                                                       INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778                                                                                                INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack
 INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778
 INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                  INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                  INFO probe_rs::util::logging: Wrote log to "trace.log"                                                                                                        Error: The flashing procedure failed for '_bin/merged_nrf91x1_g7c2eceb.hex'.

Caused by:
    0: Something during the interaction with the core went wrong
    1: An ARM specific error occurred.
    2: Error using access port FullyQualifiedApAddress { dp: Default, ap: V1(0) }.
    3: Failed to write register DRW at address 0x0c
    4: The debug probe encountered an error.
    5: An error which is specific to the debug probe in use occurred.
    6: CMSIS-DAP responded with an error.

trace.log

with latest git master including #2802?

Yup:

❯ git show --stat
commit 6fee4b6c51305efac4f00739c4911be16a321448 (HEAD -> master, origin/master, origin/HEAD)
Author: Wilfried Chauveau <wilfried.chauveau@ithinuel.me>
Date:   Tue Sep 10 16:35:33 2024 +0200

    arm: Set DbgSwEnable and some other flags on AP init. (#2802)

 probe-rs/src/architecture/arm/ap/memory_ap/amba_ahb3.rs       | 19 ++++++++++++-------
 probe-rs/src/architecture/arm/ap/memory_ap/amba_ahb5.rs       | 33 ++++++++++++++++++++++++---------
 probe-rs/src/architecture/arm/ap/memory_ap/amba_ahb5_hprot.rs | 47 +++++++++++++++++++++++++++++++++++------------
 probe-rs/src/architecture/arm/ap/memory_ap/amba_apb2_apb3.rs  |  5 +++--
 probe-rs/src/architecture/arm/ap/memory_ap/amba_apb4_apb5.rs  |  9 +++++----
 probe-rs/src/architecture/arm/ap/memory_ap/amba_axi3_axi4.rs  | 12 +++++++-----
 probe-rs/src/architecture/arm/ap/memory_ap/amba_axi5.rs       | 16 +++++++++-------
 7 files changed, 95 insertions(+), 46 deletions(-)

Sorry @ithinuel no dice.

❯ probe-rs download --chip nRF9160_xxAA --binary-format hex _bin/merged_nrf91x1_g7c2eceb.hex --allow-erase-all
 INFO probe_rs::config::target: Using sequence Arm(Nrf9160(()))
 INFO attach: probe_rs::probe::cmsisdap: Using protocol SWD
 INFO probe_rs::architecture::arm::sequences: Debug port Default is powered down, powering up
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Checking if core 0 is unlocked
 INFO probe_rs::vendor::nordicsemi::sequences::nrf: Core 0 is already unlocked
 INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }       INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }           INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack                                                       INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778                                                                                                INFO probe_rs::flashing::flash_algorithm: Chosen RAM to run the algo: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: Data will be loaded to: RamRegion { name: None, range: 20000000..20040000, cores: ["main"], access: None }
 INFO probe_rs::flashing::flash_algorithm: The flash algorithm will be configured with 512 bytes of stack
 INFO probe_rs::flashing::flash_algorithm: Stack top: 0x20002778
 INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                  INFO probe_rs::architecture::arm::sequences: Powering down debug port Default                                                                                 Error: The flashing procedure failed for '_bin/merged_nrf91x1_g7c2eceb.hex'.

Caused by:
    0: Something during the interaction with the core went wrong
    1: An ARM specific error occurred.
    2: Error using access port FullyQualifiedApAddress { dp: Default, ap: V1(0) }.
    3: Failed to write register DRW at address 0x0c
    4: The debug probe encountered an error.
    5: An error which is specific to the debug probe in use occurred.
    6: CMSIS-DAP responded with an error.

trace.log

Would you be able to get a before/after trace set? I think that’d help pinpoint which operation is missing.

You mean a working trace and a failing trace? Sure. I’ll try to get that tomorrow.

I have the same issue with MIMXRT685S. Trace attached. One extra piece of information is that if I reset to the commit right before 9eb1c2fe3ae5c836136ea3fc5ff39f5651b976ad to get a working run, then reset back to 9eb1c2fe3ae5c836136ea3fc5ff39f5651b976ad and run again without power cycling the board, then the “offending” commit works fine. As soon as I power cycle the board, it starts to fail again.

trace.log