Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. GUIDE - NRF5 / NRF51 / NRF52 for beginners

GUIDE - NRF5 / NRF51 / NRF52 for beginners

Scheduled Pinned Locked Moved Development
102 Posts 26 Posters 18.3k Views 26 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Sancho119

    Hello
    it's a E73 2G4M04S1B from EBYTE
    When i switch SWDIO and SWCLK, i can see the led of STLink V2 changing from red to blue, but when i try to uplod empty sketch (MyBoardNRF5), i have this error :

    C:\Users\Sancho\AppData\Local\Arduino15\packages\sandeepmistry\tools\openocd\0.10.0-dev.nrf5/bin/openocd.exe -d2 -f interface/stlink-v2.cfg -c transport select hla_swd; set WORKAREASIZE 0x4000; -f target/nrf52.cfg -c program {{C:\Users\Sancho\AppData\Local\Temp\arduino_build_432557/MyBoardNRF5.ino.hex}} verify reset; shutdown;
    Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-10-10:13)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    debug_level: 2
    0x4000
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 10000 kHz
    Info : Unable to match requested speed 10000 kHz, using 4000 kHz
    Info : Unable to match requested speed 10000 kHz, using 4000 kHz
    Info : clock speed 4000 kHz
    Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748
    Info : using stlink api v2
    Info : Target voltage: 3.283200
    Info : nrf52.cpu: hardware has 0 breakpoints, 2 watchpoints
    Error: timed out while waiting for target halted
    TARGET: nrf52.cpu - Not halted
    in procedure 'program'
    in procedure 'reset' called at file "embedded:startup.tcl", line 478
    in procedure 'ocd_bouncer'

    embedded:startup.tcl:454: Error: ** Unable to reset target **
    in procedure 'program'
    in procedure 'program_error' called at file "embedded:startup.tcl", line 479
    at file "embedded:startup.tcl", line 454
    le port série sélectionné at file "embedded:startup.tcl", line 454
    n'existe pas ou votre Arduino n'est pas connectée

    N Offline
    N Offline
    ncollins
    wrote on last edited by
    #33

    @sancho119 No matter what I tried, I could not unlock the E73 with the STLink.

    I had to buy a jlink clone, download a bunch of segger debugging tools, use the segger tools to override the lock flag. After that I could flash the bootloader.

    https://github.com/micooke/arduino-nRF5-smartwatches/blob/master/nrf52_disable_read_protection.txt

    #To share my experience with the nRF52832.
    #I was unable to disable the read protection / flash lock with a BMP or ST-Link V2, but i was successful with a J-Link.
    
    #When nRF52832 chip is read protected / locked, the first step is to try:
    nrfjprog –recover -f nrf52
    
    #This performs the same task as:
    Jlink -if swd -device nrf52
    J-Link>SWDSelect
    J-Link>SWDWriteDP 1, 0x50000000
    J-Link>SWDWriteDP 2, 0x01000000
    J-Link>SWDWriteAP 1, 0x00000001
    
    #Wait until AP 2 is 0, and the operation is complete
    J-Link>SWDReadAP 2
    
    #If two successive reads from AP 3 produce 0, then 1 then protection is disabled
    J-Link>SWDReadAP 3
    J-Link>SWDReadAP 3
    
    #Tested with JLink v6.20b
    
    monteM 1 Reply Last reply
    0
    • N ncollins

      @sancho119 No matter what I tried, I could not unlock the E73 with the STLink.

      I had to buy a jlink clone, download a bunch of segger debugging tools, use the segger tools to override the lock flag. After that I could flash the bootloader.

      https://github.com/micooke/arduino-nRF5-smartwatches/blob/master/nrf52_disable_read_protection.txt

      #To share my experience with the nRF52832.
      #I was unable to disable the read protection / flash lock with a BMP or ST-Link V2, but i was successful with a J-Link.
      
      #When nRF52832 chip is read protected / locked, the first step is to try:
      nrfjprog –recover -f nrf52
      
      #This performs the same task as:
      Jlink -if swd -device nrf52
      J-Link>SWDSelect
      J-Link>SWDWriteDP 1, 0x50000000
      J-Link>SWDWriteDP 2, 0x01000000
      J-Link>SWDWriteAP 1, 0x00000001
      
      #Wait until AP 2 is 0, and the operation is complete
      J-Link>SWDReadAP 2
      
      #If two successive reads from AP 3 produce 0, then 1 then protection is disabled
      J-Link>SWDReadAP 3
      J-Link>SWDReadAP 3
      
      #Tested with JLink v6.20b
      
      monteM Offline
      monteM Offline
      monte
      wrote on last edited by
      #34

      @ncollins have you tried this: https://github.com/AndruPol/nrf52832-recover ?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        ncollins
        wrote on last edited by
        #35

        At the time, I did not have a BMP or any STM32 capable of being flashed as a programmer.

        I figured the jlink clone might be useful in the future, but I definitely think the BMP / diy programmer is the way I would have gone if I had one sitting around.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sancho119
          wrote on last edited by
          #36

          @ncollins
          @monte
          thx for these advices.
          I think i will try with BMP clone (STM32F103C8T6), cheaper than J-link (i must only wait 1 month to have it, buying it in china...)
          is it possible to erase E73 with BMP in win10 ?

          1 Reply Last reply
          0
          • berkseoB Offline
            berkseoB Offline
            berkseo
            wrote on last edited by berkseo
            #37

            https://translate.google.ru/translate?sl=auto&tl=en&u=http%3A%2F%2Fmysensors.ru%2Fforum%2Fviewtopic.php%3Ff%3D5%26t%3D456

            https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRFgo-Studio/Download#infotabs

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Sancho119
              wrote on last edited by
              #38

              Hello,

              Some news !
              i buy a Jlink, and success in erase my nrf52832 with nrf prog, using method of berkseo.

              Next i try to upload a basic sketch (blink) :

              #define MY_RADIO_NRF5_ESB
              #include <nrf.h>
              #include <MySensors.h>

              void setup() {
              Serial.begin(9600);
              hwPinMode(LED_BUILTIN,OUTPUT_H0H1);
              }

              void loop() {
              digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
              delay(1000); // wait for a second
              digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
              delay(1000); // wait for a second
              }

              I have this :

              Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-10-10:13)
              Licensed under GNU GPL v2
              For bug reports, read
              http://openocd.org/doc/doxygen/bugs.html
              debug_level: 2
              0
              adapter speed: 10000 kHz
              cortex_m reset_config sysresetreq
              Info : No device selected, using first device.
              Info : J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
              Info : Hardware version: 7.00
              Info : VTarget = 3.300 V
              Info : clock speed 10000 kHz
              Info : SWD IDCODE 0x2ba01477
              Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
              nrf52.cpu: target state: halted
              target halted due to debug-request, current mode: Thread
              xPSR: 0x01000000 pc: 0x0000051c msp: 0x20010000
              ** Programming Started **
              auto erase enabled
              Warn : Unknown device (HWID 0x00000139)
              Warn : not enough working area available(requested 32)
              Warn : no working area available, falling back to slow memory writes
              wrote 12288 bytes from file C:\Users\Sancho\AppData\Local\Temp\arduino_build_76789/NRF5_blink_led8.ino.hex in 4.155332s (2.888 KiB/s)
              ** Programming Finished **
              ** Verify Started **
              Warn : not enough working area available(requested 52)
              verified 10812 bytes in 0.165932s (63.632 KiB/s)
              ** Verified OK **
              ** Resetting Target **
              shutdown command invoked

              I think its good, but when i put a led with a resistance on P0.08, nothing :(

              could you help me more ?

              T 1 Reply Last reply
              0
              • S Sancho119

                Hello,

                Some news !
                i buy a Jlink, and success in erase my nrf52832 with nrf prog, using method of berkseo.

                Next i try to upload a basic sketch (blink) :

                #define MY_RADIO_NRF5_ESB
                #include <nrf.h>
                #include <MySensors.h>

                void setup() {
                Serial.begin(9600);
                hwPinMode(LED_BUILTIN,OUTPUT_H0H1);
                }

                void loop() {
                digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
                delay(1000); // wait for a second
                digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
                delay(1000); // wait for a second
                }

                I have this :

                Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-10-10:13)
                Licensed under GNU GPL v2
                For bug reports, read
                http://openocd.org/doc/doxygen/bugs.html
                debug_level: 2
                0
                adapter speed: 10000 kHz
                cortex_m reset_config sysresetreq
                Info : No device selected, using first device.
                Info : J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
                Info : Hardware version: 7.00
                Info : VTarget = 3.300 V
                Info : clock speed 10000 kHz
                Info : SWD IDCODE 0x2ba01477
                Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
                nrf52.cpu: target state: halted
                target halted due to debug-request, current mode: Thread
                xPSR: 0x01000000 pc: 0x0000051c msp: 0x20010000
                ** Programming Started **
                auto erase enabled
                Warn : Unknown device (HWID 0x00000139)
                Warn : not enough working area available(requested 32)
                Warn : no working area available, falling back to slow memory writes
                wrote 12288 bytes from file C:\Users\Sancho\AppData\Local\Temp\arduino_build_76789/NRF5_blink_led8.ino.hex in 4.155332s (2.888 KiB/s)
                ** Programming Finished **
                ** Verify Started **
                Warn : not enough working area available(requested 52)
                verified 10812 bytes in 0.165932s (63.632 KiB/s)
                ** Verified OK **
                ** Resetting Target **
                shutdown command invoked

                I think its good, but when i put a led with a resistance on P0.08, nothing :(

                could you help me more ?

                T Offline
                T Offline
                Toyman
                wrote on last edited by
                #39

                @sancho119 said in GUIDE - NRF5 / NRF51 / NRF52 for beginners:

                Hello,

                Some news !
                i buy a Jlink, and success in erase my nrf52832 with nrf prog, using method of berkseo.

                Next i try to upload a basic sketch (blink) :

                #define MY_RADIO_NRF5_ESB
                #include <nrf.h>
                #include <MySensors.h>

                void setup() {
                Serial.begin(9600);
                hwPinMode(LED_BUILTIN,OUTPUT_H0H1);
                }

                void loop() {
                digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
                delay(1000); // wait for a second
                digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
                delay(1000); // wait for a second
                }

                I have this :

                Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-10-10:13)
                Licensed under GNU GPL v2
                For bug reports, read
                http://openocd.org/doc/doxygen/bugs.html
                debug_level: 2
                0
                adapter speed: 10000 kHz
                cortex_m reset_config sysresetreq
                Info : No device selected, using first device.
                Info : J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
                Info : Hardware version: 7.00
                Info : VTarget = 3.300 V
                Info : clock speed 10000 kHz
                Info : SWD IDCODE 0x2ba01477
                Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
                nrf52.cpu: target state: halted
                target halted due to debug-request, current mode: Thread
                xPSR: 0x01000000 pc: 0x0000051c msp: 0x20010000
                ** Programming Started **
                auto erase enabled
                Warn : Unknown device (HWID 0x00000139)
                Warn : not enough working area available(requested 32)
                Warn : no working area available, falling back to slow memory writes
                wrote 12288 bytes from file C:\Users\Sancho\AppData\Local\Temp\arduino_build_76789/NRF5_blink_led8.ino.hex in 4.155332s (2.888 KiB/s)
                ** Programming Finished **
                ** Verify Started **
                Warn : not enough working area available(requested 52)
                verified 10812 bytes in 0.165932s (63.632 KiB/s)
                ** Verified OK **
                ** Resetting Target **
                shutdown command invoked

                I think its good, but when i put a led with a resistance on P0.08, nothing :(

                could you help me more ?

                LED_BUILTIN corresponds to po17

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  p359
                  wrote on last edited by
                  #40

                  Hi. Are the steps in first post still valid please?

                  I'm trying without luck to get first nrf52 programmed. I get a weird error"Error resolving FQBN: missing" in Arduino IDE when I try to verify any basic sketch, even blink. Thanks for any thoughts

                  N 1 Reply Last reply
                  0
                  • P p359

                    Hi. Are the steps in first post still valid please?

                    I'm trying without luck to get first nrf52 programmed. I get a weird error"Error resolving FQBN: missing" in Arduino IDE when I try to verify any basic sketch, even blink. Thanks for any thoughts

                    N Offline
                    N Offline
                    ncollins
                    wrote on last edited by
                    #41

                    @p359 Which version of Arduino IDE are you using? I was seeing that with 1.8.10, but I ended up downgrading to 1.8.6 to test and it worked.

                    P 1 Reply Last reply
                    0
                    • N ncollins

                      @p359 Which version of Arduino IDE are you using? I was seeing that with 1.8.10, but I ended up downgrading to 1.8.6 to test and it worked.

                      P Offline
                      P Offline
                      p359
                      wrote on last edited by
                      #42

                      @ncollins 1.8.10 also. I'll try then 1.8.6 tonight. Cheers for the idea!

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        MartinC
                        wrote on last edited by
                        #43

                        Hi,

                        Is it possible to get Serial output in Arduino IDE for nRF52 boards with J-Link OB 7.0? Or do I need a newer programmer? Or maybe I can get it with ST-Link v2/v2.1 somehow?

                        alowhumA 1 Reply Last reply
                        1
                        • M MartinC

                          Hi,

                          Is it possible to get Serial output in Arduino IDE for nRF52 boards with J-Link OB 7.0? Or do I need a newer programmer? Or maybe I can get it with ST-Link v2/v2.1 somehow?

                          alowhumA Offline
                          alowhumA Offline
                          alowhum
                          Plugin Developer
                          wrote on last edited by
                          #44

                          @martinc said in GUIDE - NRF5 / NRF51 / NRF52 for beginners:

                          Hi,

                          Is it possible to get Serial output in Arduino IDE for nRF52 boards with J-Link OB 7.0? Or do I need a newer programmer? Or maybe I can get it with ST-Link v2/v2.1 somehow?

                          The answer is actually in the first post.

                          1 Reply Last reply
                          1
                          • M Offline
                            M Offline
                            MartinC
                            wrote on last edited by
                            #45

                            @alowhum said in GUIDE - NRF5 / NRF51 / NRF52 for beginners:

                            The answer is actually in the first post.

                            Thanks, I've seen it before. In my case a programmer is easier solution - I don't know yet how to re-assign TX&RX pins in Arduino on my EByte 52840 module and in specs for that module there is no info about UART connectivity.
                            Maybe you know how can I re-assign TX&RX pins in Arduino? Then I can solder wires to assigned TX&RX pins and connect them to USB-UART. What I've found is in Forth language ...

                            1 Reply Last reply
                            0
                            • I Offline
                              I Offline
                              idanronen
                              wrote on last edited by
                              #46

                              Does anyone know what settings I need to use for this development board with arduino ide?
                              Ebyte E104-BT5032A-TB
                              https://a.aliexpress.com/_dT5dMb8

                              It has a cp2102 on board which I have the driver for. I've installed the arduino ide nrf52 board, but I can't find a programmer, board, or any other settings which will let me flash it without a Java exception or a timeout. Maybe I need to set the jumpers differently but there's no documentation on that.
                              OTA works fine though.

                              Nca78N 2 Replies Last reply
                              0
                              • I idanronen

                                Does anyone know what settings I need to use for this development board with arduino ide?
                                Ebyte E104-BT5032A-TB
                                https://a.aliexpress.com/_dT5dMb8

                                It has a cp2102 on board which I have the driver for. I've installed the arduino ide nrf52 board, but I can't find a programmer, board, or any other settings which will let me flash it without a Java exception or a timeout. Maybe I need to set the jumpers differently but there's no documentation on that.
                                OTA works fine though.

                                Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by
                                #47

                                @idanronen this is a UART to BT module, and from what I understand in the documentation the CP2102 is only here to give you access to the serial port of the module, but not to program it ?

                                To program it you will have to use the SWDIO/SWDCLK pins I suppose, and I'm interested to know if it can be reprogrammed because that would make a tiny NRF52832 module for boards that don't require many IOs.

                                I 2 Replies Last reply
                                0
                                • Nca78N Nca78

                                  @idanronen this is a UART to BT module, and from what I understand in the documentation the CP2102 is only here to give you access to the serial port of the module, but not to program it ?

                                  To program it you will have to use the SWDIO/SWDCLK pins I suppose, and I'm interested to know if it can be reprogrammed because that would make a tiny NRF52832 module for boards that don't require many IOs.

                                  I Offline
                                  I Offline
                                  idanronen
                                  wrote on last edited by
                                  #48

                                  @Nca78 I feared that might be the case. my task for today was to dig up my st-link and try that, though I hoped I might have done something wrong and the cp2102 can be used to program and not just debug.
                                  That module is pretty cheap and from what I see with the naked eye, you can disconnect the cp2102 with the jumpers so the power consumption might actually be good enough to use as-is.
                                  I'll report back to let you know once I've succeeded

                                  1 Reply Last reply
                                  1
                                  • A Offline
                                    A Offline
                                    Avamander
                                    wrote on last edited by Avamander
                                    #49

                                    I tried flashing MySensors onto my nRF52840 Adafruit Feather board but it fails, I opened an issue on GH about it https://github.com/mysensors/MySensors/issues/1424, maybe someone here has any ideas how to get it running on those boards?

                                    1 Reply Last reply
                                    0
                                    • Nca78N Nca78

                                      @idanronen this is a UART to BT module, and from what I understand in the documentation the CP2102 is only here to give you access to the serial port of the module, but not to program it ?

                                      To program it you will have to use the SWDIO/SWDCLK pins I suppose, and I'm interested to know if it can be reprogrammed because that would make a tiny NRF52832 module for boards that don't require many IOs.

                                      I Offline
                                      I Offline
                                      idanronen
                                      wrote on last edited by idanronen
                                      #50

                                      @Nca78 no luck with the st-link v2, though i doubt it is related to the board, but rather my inability. i've tried every option in zadig, installed the st-link driver from their website, and nothing works.
                                      i get this in arduino ide:

                                      debug_level: 0
                                      0x4000
                                      adapter speed: 10000 kHz
                                      Error: init mode failed (unable to connect to the target)
                                      in procedure 'program' 
                                      in procedure 'init' called at file "embedded:startup.tcl", line 473
                                      in procedure 'ocd_bouncer'
                                      ** OpenOCD init failed **
                                      shutdown command invoked
                                      
                                      the selected serial port 
                                       does not exist or your board is not connected
                                      
                                      1 Reply Last reply
                                      0
                                      • N Offline
                                        N Offline
                                        ncollins
                                        wrote on last edited by
                                        #51

                                        With all the NRF52 modules from EBYTE I've tried, the only way I can flash them is over SWDIO, SWCLK, GND, VCC via JLink clone.

                                        And, before flashing is possible, I have to unlock the module by following these directions: https://github.com/micooke/arduino-nRF5-smartwatches/blob/master/nrf52_disable_read_protection.txt

                                        I 1 Reply Last reply
                                        2
                                        • N ncollins

                                          With all the NRF52 modules from EBYTE I've tried, the only way I can flash them is over SWDIO, SWCLK, GND, VCC via JLink clone.

                                          And, before flashing is possible, I have to unlock the module by following these directions: https://github.com/micooke/arduino-nRF5-smartwatches/blob/master/nrf52_disable_read_protection.txt

                                          I Offline
                                          I Offline
                                          idanronen
                                          wrote on last edited by
                                          #52

                                          @ncollins I've been working on turning an stm32f030f4p6 into a blackmagic probe for a few days now. Hit a wall when the compiled firmware came out to 83kb which is over the 64kb on board. Found someone who shrunk it down so it'd fit, and someone claiming it has another 64kb which can be unlocked. I'm just looking for the patience to get back in there, as this whole thing has been a major ordeal

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          16

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular