Why does a laptop (MacBook Pro, 2019, macOS Catalina) lose connections with a nRF52840 DK so often? When I try to Build and Debug I often see such kind of errors:
Sometimes SES doesn't see a board and proposes to use a simulator, sometimes it starts to upload a firmware and after a while at some stage it propose to use the simulator, because the connection has failed. I tried to use various USB cables and ports, but the problem remains. Also I tried to flash using west flash
command:
> west flash -- west flash: rebuilding ninja: no work to do. -- west flash: using runner nrfjprog Using board 683707495 -- runners.nrfjprog: Flashing file: /Users/PATH_TO_PROJECT/build/zephyr/zephyr.hex 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. FATAL ERROR: command exited with status 33: nrfjprog --program /Users/PATH_TO_PROJECT/build/zephyr/zephyr.hex --sectoranduicrerase -f NRF52 --snr 683707495
And some logs after executing a command nrfjprog --program /Users/PATH_TO_PROJECT/build/zephyr/zephyr.hex --sectoranduicrerase -f NRF52 --snr 683969587 --log
:
[2021-Aug-11 23:11:56] [ info] -------------------------------------------------------------------------------- [2021-Aug-11 23:11:56] [ info] nrfjprog --program /Users/PATH_TO_PROJECT/build/zephyr/zephyr.hex --sectoranduicrerase -f NRF52 --snr 683969587 --log [2021-Aug-11 23:11:56] [ info] nrfjprog version 10.12.1 [2021-Aug-11 23:11:56] [ info] -------------------------------------------------------------------------------- [2021-Aug-11 23:11:56] [debug] [ nRF0x0] - open_dll [2021-Aug-11 23:11:56] [ info] [ nRF0x0] - Load library at /Applications/Nordic Semiconductor/nrfjprog/libjlinkarm_nrf52_nrfjprogdll.dylib. [2021-Aug-11 23:11:56] [ info] [ nRF0x0] - Library loaded, loading member functions. [2021-Aug-11 23:11:56] [ info] [ nRF0x0] - Member functions succesfully loaded. [2021-Aug-11 23:11:56] [ info] [Backend] - Logger callback at 0x1095b1300 registered in Segger backend logger. [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] Logger callback at 0x1095b1300 registered in JLink logger. [2021-Aug-11 23:11:56] [debug] [nRF520x0] - open [2021-Aug-11 23:11:56] [debug] [Backend] - open_dll [2021-Aug-11 23:11:56] [ info] [Backend] - No J-Link DLL path was provided. Attempting to auto detect. [2021-Aug-11 23:11:56] [ info] [Backend] - Load library at /Applications/SEGGER/JLink/libjlinkarm.dylib. [2021-Aug-11 23:11:56] [ info] [Backend] - Library loaded, loading member functions. [2021-Aug-11 23:11:56] [ info] [Backend] - Member functions succesfully loaded. [2021-Aug-11 23:11:56] [debug] [Backend] - dll_version [2021-Aug-11 23:11:56] [ info] [Backend] - Segger dll version 6.88.a loaded. [2021-Aug-11 23:11:56] [debug] [ nRF0x0] - enum_emu_snr [2021-Aug-11 23:11:56] [debug] [nRF520x0] - enum_emu_snr [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [debug] [Backend] - enum_emu_snr [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_enum_emu_snr [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_get_num_emus [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [debug] [ nRF0x0] - connect_to_emu_with_snr [2021-Aug-11 23:11:56] [debug] [nRF520x0] - connect_to_emu_with_snr [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [debug] [Backend] - connect_to_emu_with_snr [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_enum_emu_snr [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_get_num_emus [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_connect_to_emu_with_snr [2021-Aug-11 23:11:56] [debug] [Backend] - ---just_connect_to_emu_without_snr [2021-Aug-11 23:11:56] [ info] [Backend] - Segger logging enabled. [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] ***** Error: [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] Cannot connect to J-Link. [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] - 14.884ms returns "Cannot connect to J-Link." [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_HasError() [2021-Aug-11 23:11:56] [ info] [Backend] - JLinkARM.dll Open returned error 'Cannot connect to J-Link.' [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_IsOpen() [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] - 0.006ms returns 0x00 [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_HasError() [2021-Aug-11 23:11:56] [debug] [ nRF0x0] - close_dll [2021-Aug-11 23:11:56] [debug] [nRF520x0] - close [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_IsOpen() [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] - 0.006ms returns 0x00 [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_HasError() [2021-Aug-11 23:11:56] [debug] [Backend] - close [2021-Aug-11 23:11:56] [debug] [Backend] - disconnect_from_emu [2021-Aug-11 23:11:56] [debug] [Backend] - is_connected_to_emu [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_IsOpen() [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] - 0.007ms returns 0x00 [2021-Aug-11 23:11:56] [ info] [ JLink] - [Info ] [JLink ] JLINK_HasError() [2021-Aug-11 23:11:56] [debug] [Backend] - Segger Backend closed. [2021-Aug-11 23:11:56] [debug] [nRF520x0] - nRF family DLL closed
And to flash a chip I need to physically unplug and plug boards from USB port several times until it works.
Also this it a log with a successful flashing, maybe it will be useful:
And I would like to mention that sometimes I see a foolish behaviour, when I have two boards connected to a laptop. I have one board connected (683707495) and I want to flash another board (683969587) from SES. Although I choose a correct USB Identification (SN) of the second board (683969587), but somehow the first board is flashed (683707495). And even when I try to flash again and I choose USB Identification (SN) of the first board (683707495), then the first board (683707495) is flashed. So there's no difference which USB Identification (SN) I choose. I already faced this problem many times today, while I was struggling with the original problem with losing connection with the board. Perhaps these two problems are related.
Sometimes after unplugging and plugging DK I have such messages:
Sometimes it couldn't be updated:
Sometimes the firmware is updated successfully:
And I don't change anything, I merely plug and unplug USB cables from boards.
I have the same problems with two boards, which I have right now, 683707495 and 683969587 are their USB Identifications (SN). It worth to mention that Nordic chips on the DK, it seems, work properly, according to LED blinking and Bluetooth connections. And problems are with J-Link debugger chips PCA10056 2.0.1 2020.43, which are located on the DKs.
What's wrong with DK, laptop or anything else? How is it possible to fix the problems with failed connections? Because now it's impossible to work with nRF52840 DKs.