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. My Project
  3. nRF5 action!

nRF5 action!

Scheduled Pinned Locked Moved My Project
1.9k Posts 49 Posters 654.0k Views 44 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.
  • W waspie

    @ncollins

    throw this somewhere in your code:

    void reboot() {
      wdt_disable();
      wdt_enable(WDTO_15MS);
      while (1) {}
    }
    

    and then calling the reboot (in the entire loop):

    void loop() {
    
      if (motion_change) {
        motionDetected=!motionDetected;
        if (motionDetected) {
          send(msg.set("1"));  // motion detected
        }
        else {
          digitalWrite(LED_BUILTIN,LOW);  //turn-off LED to signify motion no longer detected
          send(msg.set("0"));  // send all-clear to prepare for future detections
        }    
        
        NRF_LPCOMP->EVENTS_CROSS=0;
        motion_change=false;
      }
      else { //must be a scheduled wake-up.  Time to report voltage as a heartbeat.
        batteryVoltage=((float)hwCPUVoltage())/1000.0;  //take voltage measurement after transmission to hopefully measure lowest voltage that occurs. 
        send(msg_S_MULTIMETER_V_VOLTAGE.set(batteryVoltage,3));  //send battery voltage with 3 decimal places
        time = millis();
        if (time > 14400000 ) {
          reboot();
        }
      }
      mySleep(1200000);  //sleep for 20 minutes
    }```
    N Offline
    N Offline
    ncollins
    wrote on last edited by
    #1812

    @waspie just to follow up, 24hr reboot() is working perfectly. Appreciate the help.

    W 1 Reply Last reply
    1
    • N ncollins

      @waspie just to follow up, 24hr reboot() is working perfectly. Appreciate the help.

      W Offline
      W Offline
      waspie
      wrote on last edited by waspie
      #1813

      @ncollins good news

      I wonder if this has anything to do with it?
      https://forum.mysensors.org/topic/10705/nrf52-watchdog-problem-myboardnrf5

      N 1 Reply Last reply
      1
      • W waspie

        @ncollins good news

        I wonder if this has anything to do with it?
        https://forum.mysensors.org/topic/10705/nrf52-watchdog-problem-myboardnrf5

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

        @waspie Given that all of my interrupt nodes stopped triggering after 36 hrs (before your reboot workaround), it has to be related. It’s just weird that my nodes would continue to wake up and broadcast battery level.

        Is the LPCOMP interrupt method dependent on the wdt? Maybe resetting/restarting the wdt every 24hrs would suffice? Or maybe you have to reactivate LPCOMP every 36 hr wdt cycle?

        1 Reply Last reply
        1
        • NeverDieN Offline
          NeverDieN Offline
          NeverDie
          Hero Member
          wrote on last edited by NeverDie
          #1815

          When are we going to see newer nRF52 modules featuring antenna diversity?

          Somewhere I still have this prototype module that I purchased a few years ago:

          alt text

          I got it working and wrote about it at the time, but I haven't seen any more up-to-date modules featuring antenna diversity since then. Definitely nothing featuring an nRF52840, for instance. What gives?

          1 Reply Last reply
          0
          • Calvin KhungC Offline
            Calvin KhungC Offline
            Calvin Khung
            wrote on last edited by
            #1816

            Hello guys. I wished I have found this forum earlier. I'm currently trying to extract/dump a firmware from nRF51. Using OpenOCD and ST-Link V2. I am facing some problems and have posted it on stackexchange and stackoverflow. Here are the posts:

            https://reverseengineering.stackexchange.com/questions/22897/blank-binwalk-and-binvis-io

            https://stackoverflow.com/questions/59710114/dumping-nrf51s-firmware

            Hopefully someone here could help me. Thanks in advance

            NeverDieN 1 Reply Last reply
            0
            • Calvin KhungC Calvin Khung

              Hello guys. I wished I have found this forum earlier. I'm currently trying to extract/dump a firmware from nRF51. Using OpenOCD and ST-Link V2. I am facing some problems and have posted it on stackexchange and stackoverflow. Here are the posts:

              https://reverseengineering.stackexchange.com/questions/22897/blank-binwalk-and-binvis-io

              https://stackoverflow.com/questions/59710114/dumping-nrf51s-firmware

              Hopefully someone here could help me. Thanks in advance

              NeverDieN Offline
              NeverDieN Offline
              NeverDie
              Hero Member
              wrote on last edited by
              #1817

              @Calvin-Khung a black magic probe would allow you to do that.

              1 Reply Last reply
              0
              • Calvin KhungC Offline
                Calvin KhungC Offline
                Calvin Khung
                wrote on last edited by
                #1818

                @NeverDie What is the difference with a ST-Link? I mean, I've read the features on GitHub but I don't really get the differences though :sweat_smile: Sorry, as stated in both links, I'm still a noob.

                1 Reply Last reply
                0
                • Calvin KhungC Offline
                  Calvin KhungC Offline
                  Calvin Khung
                  wrote on last edited by
                  #1819

                  Oh, is the command mass erase the same as dump image? If I mass erase, will the bin file appear in the bin folder?

                  mr_redM 1 Reply Last reply
                  0
                  • Calvin KhungC Calvin Khung

                    Oh, is the command mass erase the same as dump image? If I mass erase, will the bin file appear in the bin folder?

                    mr_redM Offline
                    mr_redM Offline
                    mr_red
                    wrote on last edited by
                    #1820

                    @Calvin-Khung Hi Calvin, I read your comments here and on Stackoverflow/exchange. I honestly think that you dont have the right skills to do this. The exploited vulnerability in the blog is quite sofisticated. I think you have to start getting your debugger configured correctly. Your say you have an st-link v2 which lets me to belive you have a cheap chinese clone.
                    This clone has not all debugging features included, as you might saw in my posts earlier. You are much better of with a Black magic probe or a J-Link.
                    Have you got a halted NRF51 yet?

                    Calvin KhungC 1 Reply Last reply
                    1
                    • mr_redM mr_red

                      @Calvin-Khung Hi Calvin, I read your comments here and on Stackoverflow/exchange. I honestly think that you dont have the right skills to do this. The exploited vulnerability in the blog is quite sofisticated. I think you have to start getting your debugger configured correctly. Your say you have an st-link v2 which lets me to belive you have a cheap chinese clone.
                      This clone has not all debugging features included, as you might saw in my posts earlier. You are much better of with a Black magic probe or a J-Link.
                      Have you got a halted NRF51 yet?

                      Calvin KhungC Offline
                      Calvin KhungC Offline
                      Calvin Khung
                      wrote on last edited by
                      #1821

                      @mr_red If it's a clone then that would probably explain why it wasn't successful. I've read a thing or two about the BMP. Do you think its a good idea to convert the cheap ST-Link V2 to a BMP? Found a blog about it.

                      http://blog.linuxbits.io/2016/02/15/cheap-chinese-st-link-v-2-programmer-converted-to-black-magic-probe-debugger/

                      J-Link is way too expensive so I won't even bother considering it. And I don't quite get what you mean but yeah, I did halt it during the process.

                      monteM JokgiJ 2 Replies Last reply
                      0
                      • Calvin KhungC Calvin Khung

                        @mr_red If it's a clone then that would probably explain why it wasn't successful. I've read a thing or two about the BMP. Do you think its a good idea to convert the cheap ST-Link V2 to a BMP? Found a blog about it.

                        http://blog.linuxbits.io/2016/02/15/cheap-chinese-st-link-v-2-programmer-converted-to-black-magic-probe-debugger/

                        J-Link is way too expensive so I won't even bother considering it. And I don't quite get what you mean but yeah, I did halt it during the process.

                        monteM Offline
                        monteM Offline
                        monte
                        wrote on last edited by
                        #1822

                        @Calvin-Khung you can convert st-link clone into BMP. The only problem would be if there is not enough flash on the chip. If I remember correctly, BMP firmware needs more than 64kb. But you will know for sure, if you'll try.

                        1 Reply Last reply
                        0
                        • Calvin KhungC Offline
                          Calvin KhungC Offline
                          Calvin Khung
                          wrote on last edited by
                          #1823

                          @monte For sure, I'll give it a try. Thanks for helping out guys!

                          1 Reply Last reply
                          1
                          • JokgiJ Offline
                            JokgiJ Offline
                            Jokgi
                            wrote on last edited by
                            #1824

                            Calvin, You cam buy a Nordic Development kit for about $50 dollars or less. It has the J-Link OB device on it for swd programming and debugging.

                            Nca78N 1 Reply Last reply
                            2
                            • JokgiJ Jokgi

                              Calvin, You cam buy a Nordic Development kit for about $50 dollars or less. It has the J-Link OB device on it for swd programming and debugging.

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

                              @Jokgi said in nRF5 action!:

                              Calvin, You cam buy a Nordic Development kit for about $50 dollars or less. It has the J-Link OB device on it for swd programming and debugging.

                              Best solution imho, never had a problem with it programming the nrf5 modules, just drag & drop from Windows file explorer.

                              1 Reply Last reply
                              1
                              • Calvin KhungC Calvin Khung

                                @mr_red If it's a clone then that would probably explain why it wasn't successful. I've read a thing or two about the BMP. Do you think its a good idea to convert the cheap ST-Link V2 to a BMP? Found a blog about it.

                                http://blog.linuxbits.io/2016/02/15/cheap-chinese-st-link-v-2-programmer-converted-to-black-magic-probe-debugger/

                                J-Link is way too expensive so I won't even bother considering it. And I don't quite get what you mean but yeah, I did halt it during the process.

                                JokgiJ Offline
                                JokgiJ Offline
                                Jokgi
                                wrote on last edited by Jokgi
                                #1826

                                @Calvin-Khung
                                Jokgi
                                Jokgi about 2 hours ago

                                Calvin, You can buy a Nordic Development kit for about $50 dollars or less. It has the J-Link OB device on it for SWD programming and debugging.

                                1 Reply Last reply
                                0
                                • NeverDieN Offline
                                  NeverDieN Offline
                                  NeverDie
                                  Hero Member
                                  wrote on last edited by
                                  #1827

                                  I agree with Jokgi, but nonetheless for anyone interested in the Black Magic Probe alternative, here's an article on how to make a BMP from a $2 Blue Pill board:
                                  https://medium.com/@paramaggarwal/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c

                                  1 Reply Last reply
                                  0
                                  • orhanyorO Offline
                                    orhanyorO Offline
                                    orhanyor
                                    wrote on last edited by
                                    #1828

                                    i use $10 replica Jlink from aliexpress works ok with the latest firmware without an issue. i use it just to flash bootloaders to cortex m0-m4 and nrf52's but it should work for any task that a genuine jlink can do.

                                    Calvin KhungC 1 Reply Last reply
                                    0
                                    • J Offline
                                      J Offline
                                      Jon Raymond
                                      wrote on last edited by
                                      #1829

                                      There also is an "Education" version of the Jlink for $20 if you want an official one with access to nRF Command Line Tools.

                                      JokgiJ 1 Reply Last reply
                                      1
                                      • J Jon Raymond

                                        There also is an "Education" version of the Jlink for $20 if you want an official one with access to nRF Command Line Tools.

                                        JokgiJ Offline
                                        JokgiJ Offline
                                        Jokgi
                                        wrote on last edited by
                                        #1830

                                        @Jon-Raymond Correct. It is a nice product for the price and the intended user. As Jon mentioned, you can use the command line tools as well as nRFconnect and also has direct hooks into the Segger Embedded Studio which is a fully functional IDE / compiler/ Debugger and is free when used with Nordic Semi devices.
                                        Plus there is no license conflict as there is when using one of these cheap overseas j-link knock offs. (Which could "break / brick" anytime doing a "official" Segger update on these clones.)

                                        1 Reply Last reply
                                        1
                                        • orhanyorO orhanyor

                                          i use $10 replica Jlink from aliexpress works ok with the latest firmware without an issue. i use it just to flash bootloaders to cortex m0-m4 and nrf52's but it should work for any task that a genuine jlink can do.

                                          Calvin KhungC Offline
                                          Calvin KhungC Offline
                                          Calvin Khung
                                          wrote on last edited by
                                          #1831

                                          @orhanyor good to hear! i ordered that as well since just to try it out in hope that it would work. now that you've said that, maybe i shouldn't worry too much then.

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


                                          22

                                          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