미분류 항목

[NCS] nRF52 장치 VS Code 에서 flash 에러 해결하기

하니_즐거운하루 2023. 6. 12. 12:08

 : 별 내용은 없고 참고용 자료입니다.

    에러는 다음처럼 나오고

    Access protection is enabled, can't read device version

[error] [  nRF52] - Access protection is enabled, can't read device version.
ERROR: The operation attempted is unavailable due to readback protection in
ERROR: your device. Please use --recover to unlock the device.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.
ERROR: runners.nrfjprog: Flashing failed because the target must be recovered.
  To fix, run "west flash --recover" instead.
  Note: this will recover and erase all flash memory prior to reflashing.
FATAL ERROR: command exited with status 24: 
  nrfjprog --program '~~~\peripheral_hids_keyboard\build\zephyr\zephyr.hex' 
           --sectoranduicrerase 
           --verify 
           -f NRF52 
           --snr 1050365745

 

▶ 로그 내용에 보면  에러및 수정방법이 나오네요.

  west flash --recover

 

▶ west 명령은 직접 cmd 창을 열고 실행이 안되고 다음처럼 cmd 창을 열어야 합니다. ( PATH  지정 안됐을경우)

 

nRF Connect for Desktop 실행하기

 

▶ Toolchain Manager 열기 

 

▶ 설치된 SDK 찾기

 

▶ 아래 화살표 누르고 Open command prompt 실행하기

 

▶ 프로젝트 디렉토리 이동  ( 미이동시 다음처럼 에러가 발생합니다.)

   : --build-dir was not given, and ~~~

C:\NCS\v2.4.0>west flash --recover
FATAL ERROR: --build-dir was not given, and neither C:\NCS\v2.4.0 nor C:\NCS\v2.4.0\build are zephyr build directories.

 

▶ 프로젝트 디렉토리에서 "west flash --recover" 실행하기

C:\Project\nordic\myApps\peripheral_hids_keyboard\build>west flash --recover
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner nrfjprog
Using board 1050365745
-- runners.nrfjprog: Recovering and erasing all flash memory.
Recovering device. This operation might take 30s.
Erasing user code and UICR flash areas.
Writing image to disable ap protect.
-- runners.nrfjprog: Flashing file: C:\Project\nordic\myApps\peripheral_hids_keyboard\build\zephyr\zephyr.hex
[ #################### ]   2.336s | Erase file - Done erasing
[ #################### ]   3.669s | Program file - Done programming
[ #################### ]   1.373s | Verify file - Done verifying
Enabling pin reset.
Applying pin reset.
-- runners.nrfjprog: Board with serial number 1050365745 flashed successfully.

 

 

이후 NCS 의 flash 버튼 OK

 

 

그럼 수고하세요.

반응형