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 631.5k 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.
  • NeverDieN Offline
    NeverDieN Offline
    NeverDie
    Hero Member
    wrote on last edited by NeverDie
    #783

    Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

    Here's a close-up of the current drawn during that roughly 1ms interval:
    0_1504214970391_NewFile8.jpg

    I ran this just now, and my solar setup can easily handle this load during the daytime, even from deep indoors far from the windows. This was the scenario that really stressed the RFM69+atmega328p combo when I tried doing it using the RFM69's listen mode. I'll see tonight how the 10F supercap handles the load without any solar assist. :)

    Because of the nRF52839's 2Mbps datarate, I can probably cut the listen window down substantially from 1ms to much less (much less than would be possible with an RFM69, due to its maximum of 300kbps datarate), but for ease of programming I'm starting with this.

    d00616D 1 Reply Last reply
    2
    • NeverDieN NeverDie

      Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

      Here's a close-up of the current drawn during that roughly 1ms interval:
      0_1504214970391_NewFile8.jpg

      I ran this just now, and my solar setup can easily handle this load during the daytime, even from deep indoors far from the windows. This was the scenario that really stressed the RFM69+atmega328p combo when I tried doing it using the RFM69's listen mode. I'll see tonight how the 10F supercap handles the load without any solar assist. :)

      Because of the nRF52839's 2Mbps datarate, I can probably cut the listen window down substantially from 1ms to much less (much less than would be possible with an RFM69, due to its maximum of 300kbps datarate), but for ease of programming I'm starting with this.

      d00616D Offline
      d00616D Offline
      d00616
      Contest Winner
      wrote on last edited by d00616
      #784

      @NeverDie said in nRF5 Bluetooth action!:

      Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

      When you take a look into the PPI section, you are able to let the CPU sleep until a radio packet is received. With PPI, the listen mode can be activated and deactivated without CPU interaction.

      The nRF5 MCUs are able to to a lot of things without waking up the CPU. That's a really cool feature.

      NeverDieN 1 Reply Last reply
      2
      • d00616D d00616

        @NeverDie said in nRF5 Bluetooth action!:

        Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

        When you take a look into the PPI section, you are able to let the CPU sleep until a radio packet is received. With PPI, the listen mode can be activated and deactivated without CPU interaction.

        The nRF5 MCUs are able to to a lot of things without waking up the CPU. That's a really cool feature.

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

        @d00616 said in nRF5 Bluetooth action!:

        @NeverDie said in nRF5 Bluetooth action!:

        Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

        When you take a look into the PPI section, you are able to let the CPU sleep until a radio packet is received. With PPI, the listen mode can be activated and deactivated without CPU interaction.

        The nRF5 MCUs are able to to a lot of things without waking up the CPU. That's a really cool feature.

        Sounds like it has potential. Any demo code for this? The datasheet seems a bit sketchy.

        d00616D 1 Reply Last reply
        0
        • NeverDieN NeverDie

          @d00616 said in nRF5 Bluetooth action!:

          @NeverDie said in nRF5 Bluetooth action!:

          Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

          When you take a look into the PPI section, you are able to let the CPU sleep until a radio packet is received. With PPI, the listen mode can be activated and deactivated without CPU interaction.

          The nRF5 MCUs are able to to a lot of things without waking up the CPU. That's a really cool feature.

          Sounds like it has potential. Any demo code for this? The datasheet seems a bit sketchy.

          d00616D Offline
          d00616D Offline
          d00616
          Contest Winner
          wrote on last edited by
          #786

          @NeverDie said in nRF5 Bluetooth action!:

          @d00616 said in nRF5 Bluetooth action!:

          @NeverDie said in nRF5 Bluetooth action!:

          Here's the mode that I'm most interested in: Putting the radio into Rx for about 1ms per 100ms interval to listen for remote commands. The rest of the time everthing (both radio and mcu) are in deep sleep waiting for the RTC to wake them up.

          When you take a look into the PPI section, you are able to let the CPU sleep until a radio packet is received. With PPI, the listen mode can be activated and deactivated without CPU interaction.
          The nRF5 MCUs are able to to a lot of things without waking up the CPU. That's a really cool feature.

          Sounds like it has potential. Any demo code for this? The datasheet seems a bit sketchy.

          These are some snippets of the radio code. There are fully useable PPI and some predefined. For fully useable PPI into the EEP register, you put the address of an EVENT register and in the TEP register, you put the pointer to an TASK register.

             /** Configure PPI (Programmable peripheral interconnect) */
              // Start timer on END event
              NRF_PPI->CH[NRF5_ESB_PPI_TIMER_START].EEP = (uint32_t)&NRF_RADIO->EVENTS_END;
              NRF_PPI->CH[NRF5_ESB_PPI_TIMER_START].TEP = (uint32_t)&NRF5_RADIO_TIMER->TASKS_START;
              // Disable Radio after CC[0]
              NRF_PPI->CH[NRF5_ESB_PPI_TIMER_RADIO_DISABLE].EEP = (uint32_t)&NRF5_RADIO_TIMER->EVENTS_COMPARE[0];
              NRF_PPI->CH[NRF5_ESB_PPI_TIMER_RADIO_DISABLE].TEP = (uint32_t)&NRF_RADIO->TASKS_DISABLE;
              ...
              // Set PPI
               NRF_PPI->CHENSET = NRF5_ESB_PPI_BITS;
              ...
            // Clear PPI
              NRF_PPI->CHENCLR = NRF5_ESB_PPI_BITS;
          

          Then you have to enable or disable the register. It could be necessary to reset the events. You can use the NRF_RESET_EVENT macro to do this job.

           NRF_RESET_EVENT(NRF5_RADIO_TIMER->EVENTS_COMPARE[0]);
          
          1 Reply Last reply
          1
          • NeverDieN Offline
            NeverDieN Offline
            NeverDie
            Hero Member
            wrote on last edited by NeverDie
            #787

            I have a brute force version of "listen mode" working using just the libraries, but I have to re-initialize the radio after each cycle because it appears to lose its settings every time I sleep it.

            Anyway, finding a way to add DCDC mode to these modules will probably have the biggest near-term impact on current consumption. That said, I'm sure plenty of energy savings can also be found by honing the code.

            NeverDieN 1 Reply Last reply
            0
            • NeverDieN NeverDie

              I have a brute force version of "listen mode" working using just the libraries, but I have to re-initialize the radio after each cycle because it appears to lose its settings every time I sleep it.

              Anyway, finding a way to add DCDC mode to these modules will probably have the biggest near-term impact on current consumption. That said, I'm sure plenty of energy savings can also be found by honing the code.

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

              Actually, even just sleeping the MCU with a simple command like:

              sleep(100);
              

              is apparently enough to require a re-init of the radio afterward. Not sure why that would be.

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

                Comparing Figures 169 and 170 in the nRF52832 datasheet, it looks as though simply adding two inductors in series between DCC and DEC4 should be all that's needed to provide the needed hardware support for DC/DC. Looks as though the 10uH inductor also needs to be able to support a minimum of 50ma, according to the BOM (Table 145).

                So, is it as simple as that together with enabling register DCDCEN? Or, is there anything more to it?

                1 Reply Last reply
                0
                • scalzS Offline
                  scalzS Offline
                  scalz
                  Hardware Contributor
                  wrote on last edited by
                  #790

                  Yes. This is like that. I use 2 inductors (better) in serie. Why more complicated ;)

                  1 Reply Last reply
                  3
                  • NeverDieN NeverDie

                    Actually, even just sleeping the MCU with a simple command like:

                    sleep(100);
                    

                    is apparently enough to require a re-init of the radio afterward. Not sure why that would be.

                    d00616D Offline
                    d00616D Offline
                    d00616
                    Contest Winner
                    wrote on last edited by
                    #791

                    @NeverDie said in nRF5 Bluetooth action!:

                    Actually, even just sleeping the MCU with a simple command like:
                    sleep(100);

                    is apparently enough to require a re-init of the radio afterward. Not sure why that would be.

                    sleep() deinitializes the transport with transportDisable(). This results in power down the radio.

                    At the moment I review the ESB code. I think the nRF5 is 12-13µs after an nRF24 in RX mode and 432µs before an nRF24 in TX. This can result in unstable connections when debug messages are disabled.

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

                      Sort-of working. Here's a screen shot with the DC/DC modification. Compare to the earlier one above:
                      0_1504447563700_NewFile1.jpg
                      Probably non-optimal placement of the inductors: between the DCC and DEC4 pins on my breakout board for the nRF52832.

                      This is reason enough to do an new version of the breakout for the Ebyte module to improve the inductor positioning.

                      Here's the enable code:

                        NRF_POWER->DCDCEN=1;  //enable the DCDC voltage regulator as the default.
                      

                      If it's this easy, I'm just surprised that the module makers haven't included it. The difference in build cost is de minimus, but the difference in delivered value is huge.

                      Also, it sounds like I'll have to write a variant of sleep that sleeps just the MPU while leaving the radio in receive mode. That's an easy win to improve the current consumption.

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

                        Good news! I went back and re-rechecked using an un-modified Ebyte module, and, indeed, this time I'm sure that the DCDC inductors are already on it! What follows is the proof. Here is the current drawn when the above DCDCEN is enabled on an unmodified Ebyte module:

                        0_1504461945615_NewFile2.jpg

                        Now, here is the current drawn with the exact same script on the exact same unmodified Ebyte module, but with the DCDCEN line of code commented out:

                        0_1504461988147_NewFile3.jpg

                        QED.

                        As you can see, the savings in current consumption are considerable with the DCDC enabled!

                        [Edit: although looking at it again, the timescale seems way off. Argh. Something still isn't right.]

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

                          Scratch the preceeding post. I redid it more carefully this time, and I believe it confirms that the Ebyte module does not have the two inductors required for DC/DC mode.

                          Here is the current drawn by an unmodified Ebyte nRF52832 module which is programmed to be receiving for about 1.5ms every 100ms:
                          0_1504472450738_NewFile1.jpg
                          0_1504472465572_NewFile2.jpg

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

                            Here is what happens with exactly the same hardware (no inductors yet added), but with DCDCEN enabled:
                            0_1504472667206_NewFile3.jpg

                            0_1504472696820_NewFile4.jpg
                            It basically seems caught in a boot loop.

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

                              Now, adding the two inductors between DCC and DEC4, and re-measuring, we get:
                              0_1504472770946_NewFile1.jpg

                              0_1504472782958_NewFile2.jpg

                              No less importantly, it does receive and decode packets!

                              Conclusion: Ebyte nRF52832 modules don't come with the DC/DC inductors already installed. However, they can be added, resulting in some current reduction.

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

                                I've baked these findings into a new breakout board for the Ebyte nRF52832:
                                https://www.openhardware.io/view/471
                                The new breakout board will enable the module to work in DC/DC mode.

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

                                  I may have found a clue as to why the reset pin (pin0.21) on the nRF52832 isn't working.

                                  On the nRF52832 DK, I read the following register values:
                                  PSELRESET[0]=21
                                  PSELRESET[1]=21

                                  which is as expected. However, on the Ebyte nRF52832 module, I read those register values as:
                                  PSELRESET[0]=4294967295
                                  PSELRESET[1]=4294967295

                                  which makes no sense. The values match, but they don't correspond to a pin number that can represent RESET.

                                  These two registers are described in the nRF52832 datasheet.

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • NeverDieN NeverDie

                                    I may have found a clue as to why the reset pin (pin0.21) on the nRF52832 isn't working.

                                    On the nRF52832 DK, I read the following register values:
                                    PSELRESET[0]=21
                                    PSELRESET[1]=21

                                    which is as expected. However, on the Ebyte nRF52832 module, I read those register values as:
                                    PSELRESET[0]=4294967295
                                    PSELRESET[1]=4294967295

                                    which makes no sense. The values match, but they don't correspond to a pin number that can represent RESET.

                                    These two registers are described in the nRF52832 datasheet.

                                    mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by
                                    #799

                                    @NeverDie not sure if you've already noticed, but 4294967295 is the maximum value for an unsigned 32-bit integer. So the value is 0xFFFFFFFF. That often means uninitialized. I don't know why it would be uninitialized though.

                                    NeverDieN 2 Replies Last reply
                                    3
                                    • mfalkviddM mfalkvidd

                                      @NeverDie not sure if you've already noticed, but 4294967295 is the maximum value for an unsigned 32-bit integer. So the value is 0xFFFFFFFF. That often means uninitialized. I don't know why it would be uninitialized though.

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

                                      @mfalkvidd

                                      Maybe because they just never were?
                                      Those particular registers are "The user information configuration registers (UICRs) are non-volatile memory (NVM) registers for configuring user specific settings." So, it would seem that initializing them just once would be enough, since they're non-volatile.

                                      In any case, good catch! It explains both why they are that value and also why they match.

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

                                        @NeverDie said in nRF5 Bluetooth action!:

                                        4294967295

                                        Also, since 4294967295 equals 0xFFFFFFFF, then bit 31 is a '1', which, according to the datasheet, means the pin is disconnected (see section 14.1.60 PSELRESET[0] of the datasheet for the detail].

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM mfalkvidd

                                          @NeverDie not sure if you've already noticed, but 4294967295 is the maximum value for an unsigned 32-bit integer. So the value is 0xFFFFFFFF. That often means uninitialized. I don't know why it would be uninitialized though.

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

                                          @mfalkvidd said in nRF5 Bluetooth action!:

                                          So the value is 0xFFFFFFFF. That often means uninitialized. I don't know why it would be uninitialized though.

                                          There's a chance we may have unwittingly done it ourselves! Remember back to when we were doing an explicit "Erase All"? From the datasheet:

                                          11.5 Erase all
                                          When erase is enabled, the whole Flash and UICR can be erased in one operation by using the ERASEALL
                                          register.

                                          Furthermore, from page 29 of the datasheet:

                                          After erasing UICR all bits in UICR are set to '1'.

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


                                          12

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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