I am having problems flashing my custom board with a nrf5340 chip. Sometimes it works, sometimes it does not, but more often than not it doesn't work and I cannot figure out why. It also doesn't log consistently.
First, I do a pristine build with code which has worked. Then I try and flash and see this in the console:
-- west flash: using runner nrfjprog -- runners.nrfjprog: reset after flashing requested -- runners.nrfjprog: Flashing file: /Users/********/Projects/GitHub/********/blinky_custom_board/build_customboard/merged.hex [ #################### ] 4.274s | Erase file - Done erasing [error] [ Client] - Encountered error -102: Command program_file executed for 1237 milliseconds with result -102 [error] [ nRF53] - The write access failed, but no cause could be determined. [error] [ nRF53] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue. [error] [ nRF53] - Failed while performing Write operation on target address 114516. -102: An unknown error. [error] [ nRF53] - Failed while reading device information. [error] [ Worker] - An unknown error. ERROR: JLinkARM DLL reported an error. Try again. If error condition ERROR: persists, run the same command again with argument --log, contact Nordic ERROR: Semiconductor and provide the generated log.log file to them. 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 /Users/*********/Projects/GitHub/*********/blinky_custom_board/build_customboard/merged.hex --sectorerase --verify -f NRF53 --coprocessor CP_APPLICATION --snr *********
I have run it from the command line as well and get the log (as it recommends). It was recommeded that I try recover so I ran this command: nrfjprog --recover --log
and saw this in the terminal:
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
I try to reflash from the VS Code Add-In where it command exited with status 33
:-- west flash: using runner nrfjprog
-- runners.nrfjprog: reset after flashing requested
-- runners.nrfjprog: Flashing file: /Users/*********/Projects/GitHub/*********/blinky_custom_board/build_customboard/merged.hex
[ #################### ] 4.384s | Erase file - Done erasing
[error] [ Client] - Encountered error -102: Command program_file executed for 1617 milliseconds with result -102
[error] [ nRF53] - The write access failed, but no cause could be determined.
[error] [ nRF53] - It may be due to an unaligned access, accessing a nonexistent memory, or a communication issue.
[error] [ nRF53] - Failed while performing Write operation on target address 114516.
-102: An unknown error.
[error] [ nRF53] - Failed while reading device information.
[error] [ Worker] - An unknown error.
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: Semiconductor and provide the generated log.log file to them.
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 /Users/*********/Projects/GitHub/*********/blinky_custom_board/build_customboard/merged.hex --sectorerase --verify -f NRF53 --coprocessor CP_APPLICATION --snr *********
Sometimes I get this with a command exited with status 25
:-- west flash: using runner nrfjprog
-- runners.nrfjprog: reset after flashing requested
-- runners.nrfjprog: Flashing file: /Users/*********/Projects/GitHub/*********/blinky_custom_board/build_customboard/merged_CPUNET.hex
[ #################### ] 7.998s | Erase file - Done erasing
[ #################### ] 2.513s | Program file - Done programming
[error] [ Client] - Encountered error -160: Command verify_file executed for 1017 milliseconds with result -160
[error] [ nRF53] - Failed while performing Verify operation on target address 16925778.
-160: Data does not match in address range [0x01000000 - 0x01024451] (Network Flash)
Expected byte value 0xF8 but read 0xF0 at address 0x01001A43.
[error] [ nRF53] - Failed while verifying device. -160: Data does not match in address range [0x01000000 - 0x01024451] (Network Flash)
Expected byte value 0xF8 but read 0xF0 at address 0x01001A43.
[error] [ Worker] - Data does not match in address range [0x01000000 - 0x01024451] (Network Flash)
Expected byte value 0xF8 but read 0xF0 at address 0x01001A43.
ERROR: Write verify failed.
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 25: nrfjprog --program /Users/*********/Projects/GitHub/*********/blinky_custom_board/build_customboard/merged_CPUNET.hex --sectorerase --verify -f NRF53 --coprocessor CP_NETWORK --snr *********
I run this but it doesn't seem to work:nrfjprog --recover --log
Twice after trying this for a while and gtiving it a break I will flash it and it will take. I don't see the logging but eventually that starts as well.
My prj.conf looks like this:CONFIG_GPIO=y
CONFIG_PWM=y
CONFIG_LOG=y
#Bluetooth Settings
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Hello_World_Blinky"
#CONFIG_DEBUG_OPTIMIZATIONS=y
#CONFIG_DEBUG_THREAD_INFO=y
#Segger RTT Settings
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_UART_CONSOLE=n
#CONFIG_PRINTK=y
#CONFIG_LOG_PRINTK=y
CONFIG_LOG_INFO_COLOR_GREEN=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=128
CONFIG_LOG_BLOCK_IN_THREAD=y
CONFIG_CONSOLE=y
CONFIG_LOG_BACKEND_UART=n
My sysboot.conf:SB_CONFIG_NETCORE_HCI_IPC=y