Issue with flashing and debugging firmware on nRF52833 microcontroller with nRF Connect SDK and Visual Studio Code

Hello Nordic Semiconductor Support Team,

       I am currently facing an issue while working with the nRF52833 microcontroller, nRF Connect SDK, and Visual Studio Code. I have made modifications to the devicetree of the "nrf52833dk_nrf52833" to accommodate our custom board.

The problem I am encountering is related to the firmware development using the simple examples provided in the nRF Connect SDK, such as "blinky," "uart," and "gpio." While these examples work flawlessly in debug mode, I am facing difficulties when trying to flash the program onto the nRF52833. After flashing, the code does not execute as expected. Furthermore, when I attempt to operate in debug mode again, the following errors are generated:

[error] [Client] - Encountered error -102: Command erase_file executed for 59 milliseconds with result -102
[error] [nRF52] - The read access failed, but no cause could be determined.
[error] [nRF52] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue.
[error] [nRF52] - Failed while detecting device memory block protection status!
[error] [nRF52] - Failed while erasing device. -102: JLinkARM.dll Halt returned error 1.
[error] [Worker] - JLinkARM.dll Halt returned error 1.
ERROR: JLinkARM DLL reported an error. Please try again. If the error persists, run the same command again with the argument --log, and contact Nordic Semiconductor, providing the generated log.log file.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
FATAL ERROR: command exited with status 33: nrfjprog --program 'd:\NRF_Workspace\blinky_spi_test\build\zephyr\zephyr.hex' --sectoranduicrerase --verify -f NRF52 --snr 50128667

     To successfully operate the controller in debug mode, I have to erase the chip. After stopping debugging and resetting the microcontroller, the firmware runs as expected. However, when the power is turned off and then back on, the firmware does not work.(seems to corrupt the flash memory).

     However, this issue only arises when using the nRF Connect SDK with Visual Studio Code. Previously, when I was using Segger Embedded Studio and nRF5 SDK, the firmware worked perfectly fine without any issues.

     Could you kindly provide me with a solution or any guidance to address this issue? If there are any specific configurations or steps that need to be taken while using the nRF Connect SDK with Visual Studio Code, please let me know.

Thank you for your time and support. I look forward to your prompt response.

Regards,

Vitthal.

  • Hi,

    Which NCS version did you use when working with your board?

    Could you observe this behavior on any other board that you possibly have?

    Did all tested applications have the same behavior as you described?

    Is everything working fine from command line?

    Which versions of the tools do you use in your development?

    Best regards,
    Dejan

  • Hello dejan,

    Q1: Which NCS version did you use when working with your board?
    A: I am using the latest version, which is nrf connect sdk v2.4.0.

    Q2: Could you observe this behavior on any other board that you possibly have?
    A: Unfortunately, I don't have an nrf52 development board, so I couldn't observe the behavior on any other board. However, I have tested the applications on multiple custom boards, and they all exhibited the same result.

    Q3: Did all tested applications have the same behavior as you described?
    A: Yes, all the applications I tested exhibited the same behavior as described.

    Q4: Is everything working fine from the command line?
    A: Everything works fine from the command line, except for flashing. Unfortunately, I encountered an issue with flashing from the command line. However, all other commands are functioning properly. I also attempted using the programmer in nrf connect for desktop, but that also didn't work for me.

    Q5: Which versions of the tools do you use in your development?
    A: I use nrf connect sdk v2.4.0 for development and work with VS Code v1.80.0.

    Regards,

    Vitthal.

  • Hi Vitthal,

    I could not reproduce your issue on nrf52833-dk using blinky application in NCS v2.4.0. I built the sample both with and without debug options enabled and flashed the firmware to the board without issues. I could also debug without problems. With stopped debugging, I restarted the board by power cycling off/on and everything seems to be working as expected.

    Since this firmware was previously working, I guess something might be wrong with your testing environment.

    Is it only the problem with flashing and debugging but building with NCS v2,4,0 and VS Code works as expected?

    Have you tried flashing with "west flash" instead of "nrfjprog --program"?

    Best regards,
    Dejan


  • 7444.zephyr.hex

    Hello Dejan,

    can you please try this.

    this is blinky example which toggles pin 0.9 of nrf52833.

    Regards,

    Vitthal.

  • Hi Vitthal,

    Do you use external crystal on your custom board?

    When debugging internal RC oscillator is used as a clock source. It might be that your software enables external crystal which you might not have on your board. Could you try using these configuration options:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n


    Best regards,
    Dejan

Related