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. Hardware
  3. Everything nRF52840

Everything nRF52840

Scheduled Pinned Locked Moved Hardware
323 Posts 28 Posters 50.6k Views 33 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
    #8

    Here's some simple code for transmitting a 1 byte payload at 2mbps once every second:

    //This program sends a one byte payload in a packet once every second.
    #include "mbed.h"
    
    
    uint8_t txBuffer[200];  //buffer required for transmitting a payload.  
    uint8_t targetAddress[] = {0xAA, 0xDE, 0xAD, 0xBE, 0xEF};
    
    Serial pc(USBTX, USBRX); // tx, rx
    
    void initializeSerialOutput() {
    
      pc.baud (9600);
      pc.printf("Starting...\n");
    }
    
    void initializeHardware () { 
      NRF_POWER->DCDCEN=1;  //enable the DCDC voltage regulator 
    }
    
    void initializeClocks () {
        
      NRF_CLOCK->TASKS_HFCLKSTART=1;  //activate the high frequency crystal oscillator
      while (NRF_CLOCK->EVENTS_HFCLKSTARTED==0) {};  //wait until high frequency clock start is confirmed
    }
    
    void initializeRadio () {
      //No need to set the preamble.  For Nordic's proprietary radio modes, the preamble (either 0xAA or 0x55) is 1 byte long and is chosen by the hardware.  
      
      uint32_t theTargetBaseAddress;
      theTargetBaseAddress=(((uint32_t)targetAddress[1])<<24)|(((uint32_t)targetAddress[2])<<16)|(((uint32_t)targetAddress[3])<<8)|((uint32_t)targetAddress[4]);  //target base address
      pc.printf("The target address is 0x%X%lX\n",targetAddress[0],theTargetBaseAddress);
      NRF_RADIO->BASE0=theTargetBaseAddress;  //target base address
      NRF_RADIO->PREFIX0=targetAddress[0];   //target prefix address 
      
      NRF_RADIO->FREQUENCY=98; //2498Mhz.  value must be between 0 and 100
      NRF_RADIO->PCNF1 = 0x40101;  //Means: base address is 4 bytes long (possible range is 2 to 4) and max size of payload is 1,and 1 bytes of static length payload
      NRF_RADIO->PCNF0=0;  //S0,LENGTH, and S1 are all zero bits long.
      NRF_RADIO->MODE=1;  //set 2Mbps datarate.  
      NRF_RADIO->MODECNF0=1;  //enable fast ramp-up of radio from DISABLED state.
      NRF_RADIO->CRCCNF=3;  // CRC will be 3 bytes and is computed including the address field
      NRF_RADIO->PACKETPTR=(uint32_t)txBuffer;  //pointer to the payload in txBuffer
      NRF_RADIO->RXADDRESSES=1;  //receive on logical address 0.  Not important for transmitting.
      NRF_RADIO->TXPOWER=8;  //set to 8db transmit power, which is the maximum.
    
      NRF_RADIO->TASKS_DISABLE=1;  //DISABLE the radio to establish a known state.
      while (NRF_RADIO->STATE) {}; //wait until radio is DISABLED (i.e. STATE=0);
    
      NRF_RADIO->TASKS_TXEN=1;  //turn on the radio transmitter and shift into TXIDLE.
      while (!(NRF_RADIO->EVENTS_READY)) {}  //Busy-wait.  After event READY, radio shall be in state TXIDLE.
      
      NRF_RADIO->TASKS_START=1;  //Move from TXIDLE mode into TX mode.
    }
        
    
    int main() {
      initializeSerialOutput();
      initializeHardware();
      initializeClocks();
      initializeRadio();
    
      while (true) {
       
       if (NRF_RADIO->STATE!=11) { //if radio no longer in TX state, then it must have sent a packet
          wait_ms(1000);  //wait one second before sending next packet
       
          txBuffer[0]++;  //increment the payload value to send something different
          NRF_RADIO->TASKS_START=1;  //Move from TXIDLE mode into TX mode to transmit another packet
        }
      }
    }
    
    1 Reply Last reply
    1
    • NeverDieN Offline
      NeverDieN Offline
      NeverDie
      Hero Member
      wrote on last edited by NeverDie
      #9

      Here is the corresponding simple code for receiving each packet from the transmitter code above:

      //This program receives packets with a one byte payload.
      #include "mbed.h"
      
      uint8_t rxBuffer[200];  //required buffer for receiving packet
      uint8_t myAddress[] = {0xAA, 0xDE, 0xAD, 0xBE, 0xEF};
      
      Serial pc(USBTX, USBRX); // tx, rx
      
      void initializeSerialOutput() {
      
        pc.baud (9600);
        pc.printf("\n\nStarting...\n");
      }
      
      void initializeHardware () { 
        NRF_POWER->DCDCEN=1;  //enable the DCDC voltage regulator as the default. 
      }
      
      void initializeClocks () {
        NRF_CLOCK->TASKS_HFCLKSTART=1;  //activate the high frequency crystal oscillator
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED==0) {};  //wait until high frequency clock start is confirmed
      }
      
      void initializeRadio () {
       //No need to set the preamble.  For Nordic's proprietary radio modes, the preamble (either 0xAA or 0x55) is 1 byte long and is chosen by the hardware.  
         
        uint32_t myBaseAddress;
        myBaseAddress=(((uint32_t)myAddress[1])<<24)|(((uint32_t)myAddress[2])<<16)|(((uint32_t)myAddress[3])<<8)|((uint32_t)myAddress[4]);  //target base address
        pc.printf("My address is 0x%X%lX\n",myAddress[0],myBaseAddress);
        NRF_RADIO->BASE0=myBaseAddress;  //target base address
        NRF_RADIO->PREFIX0=myAddress[0];   //target prefix address 
          
        NRF_RADIO->FREQUENCY=98; //2498Mhz.  value must be between 0 and 100
        NRF_RADIO->PCNF1 = 0x40101;  //Means: base address is 4 bytes long (possible range is 2 to 4) and max size of payload is 1,and 1 bytes of static length payload
        NRF_RADIO->PCNF0=0;  //S0,LENGTH, and S1 are all zero bits long.
        NRF_RADIO->MODE=1;  //set 2Mbps datarate.  
        NRF_RADIO->MODECNF0=1;  //enable fast ramp-up of radio from DISABLED state.
        NRF_RADIO->CRCCNF=3;  // CRC is is 3 bytes and is computed including the address field
        NRF_RADIO->PACKETPTR=(uint32_t)rxBuffer;  //put the received payload in rxBuffer
        NRF_RADIO->RXADDRESSES=1;  //receive on logical address 0
      
        NRF_RADIO->TASKS_DISABLE=1;  //sleep the radio
        while (NRF_RADIO->STATE) {}; //wait until radio is DISABLED (i.e. STATE=0);
       
        NRF_RADIO->TASKS_RXEN=1;  //turn on the radio receiver and enter into state RXIDLE
        while (!(NRF_RADIO->EVENTS_READY)) {}  //Busy-wait.  After event READY, radio shall be in state RXIDLE.
        
        NRF_RADIO->TASKS_START=1;  //Move from RXIDLE mode into RX mode.
      }
          
      
      int main() {
        initializeSerialOutput();
        initializeHardware();
        initializeClocks();
        initializeRadio();
      
        while (true) {  
          if (NRF_RADIO->STATE!=3) {// if radio no longer in RX state, it must have received a packet.
            pc.printf("Payload Received!  Payload=%d\n",rxBuffer[0]); 
      
            NRF_RADIO->TASKS_START=1;  //Move from RXIDLE mode into RX mode so as to receive the next packet
          }
        }
      }
      

      These two example demo codes should be enough to get anyone started on using the nRF52840. :)

      Indeed, it relies very little on mbed (just the printf's and the wait function), so you could easily move it to a different tool chain if you wanted to.

      H 1 Reply Last reply
      1
      • NeverDieN NeverDie

        Here is the corresponding simple code for receiving each packet from the transmitter code above:

        //This program receives packets with a one byte payload.
        #include "mbed.h"
        
        uint8_t rxBuffer[200];  //required buffer for receiving packet
        uint8_t myAddress[] = {0xAA, 0xDE, 0xAD, 0xBE, 0xEF};
        
        Serial pc(USBTX, USBRX); // tx, rx
        
        void initializeSerialOutput() {
        
          pc.baud (9600);
          pc.printf("\n\nStarting...\n");
        }
        
        void initializeHardware () { 
          NRF_POWER->DCDCEN=1;  //enable the DCDC voltage regulator as the default. 
        }
        
        void initializeClocks () {
          NRF_CLOCK->TASKS_HFCLKSTART=1;  //activate the high frequency crystal oscillator
          while (NRF_CLOCK->EVENTS_HFCLKSTARTED==0) {};  //wait until high frequency clock start is confirmed
        }
        
        void initializeRadio () {
         //No need to set the preamble.  For Nordic's proprietary radio modes, the preamble (either 0xAA or 0x55) is 1 byte long and is chosen by the hardware.  
           
          uint32_t myBaseAddress;
          myBaseAddress=(((uint32_t)myAddress[1])<<24)|(((uint32_t)myAddress[2])<<16)|(((uint32_t)myAddress[3])<<8)|((uint32_t)myAddress[4]);  //target base address
          pc.printf("My address is 0x%X%lX\n",myAddress[0],myBaseAddress);
          NRF_RADIO->BASE0=myBaseAddress;  //target base address
          NRF_RADIO->PREFIX0=myAddress[0];   //target prefix address 
            
          NRF_RADIO->FREQUENCY=98; //2498Mhz.  value must be between 0 and 100
          NRF_RADIO->PCNF1 = 0x40101;  //Means: base address is 4 bytes long (possible range is 2 to 4) and max size of payload is 1,and 1 bytes of static length payload
          NRF_RADIO->PCNF0=0;  //S0,LENGTH, and S1 are all zero bits long.
          NRF_RADIO->MODE=1;  //set 2Mbps datarate.  
          NRF_RADIO->MODECNF0=1;  //enable fast ramp-up of radio from DISABLED state.
          NRF_RADIO->CRCCNF=3;  // CRC is is 3 bytes and is computed including the address field
          NRF_RADIO->PACKETPTR=(uint32_t)rxBuffer;  //put the received payload in rxBuffer
          NRF_RADIO->RXADDRESSES=1;  //receive on logical address 0
        
          NRF_RADIO->TASKS_DISABLE=1;  //sleep the radio
          while (NRF_RADIO->STATE) {}; //wait until radio is DISABLED (i.e. STATE=0);
         
          NRF_RADIO->TASKS_RXEN=1;  //turn on the radio receiver and enter into state RXIDLE
          while (!(NRF_RADIO->EVENTS_READY)) {}  //Busy-wait.  After event READY, radio shall be in state RXIDLE.
          
          NRF_RADIO->TASKS_START=1;  //Move from RXIDLE mode into RX mode.
        }
            
        
        int main() {
          initializeSerialOutput();
          initializeHardware();
          initializeClocks();
          initializeRadio();
        
          while (true) {  
            if (NRF_RADIO->STATE!=3) {// if radio no longer in RX state, it must have received a packet.
              pc.printf("Payload Received!  Payload=%d\n",rxBuffer[0]); 
        
              NRF_RADIO->TASKS_START=1;  //Move from RXIDLE mode into RX mode so as to receive the next packet
            }
          }
        }
        

        These two example demo codes should be enough to get anyone started on using the nRF52840. :)

        Indeed, it relies very little on mbed (just the printf's and the wait function), so you could easily move it to a different tool chain if you wanted to.

        H Offline
        H Offline
        heinzv
        wrote on last edited by heinzv
        #10

        @neverdie I have ordered 10x nRF52832 and also 5x nRF52840. Two of theme are in the E73... modul which is not really easy to solder with it's additional pads in inner rows under the modul and the company has no plans to change it for private makers.

        I have ordered 2 but it looks like they have discontinued that or working on an upgrade?
        https://www.aliexpress.com/item/nRF52840-Bluetooth-5-0-240MHz-RF-Transceiver-CDSENET-E73-2G4M08S1C-8dbm-Ceramic-Antenna-BLE-4-2/32906661666.html?spm=a2g0s.9042311.0.0.50784c4dZJ6WSY

        I have seen the dongles but they are still quite expensive:
        https://www.aliexpress.com/item/NRF52840-Dongle-Original/32890524949.html?spm=2114.search0104.3.1.dfe53098heRtmA&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=c3e31797-40ab-4a13-b99e-df32e618cf5c-0&algo_pvid=c3e31797-40ab-4a13-b99e-df32e618cf5c&transAbTest=ae803_2&priceBeautifyAB=0

        This modul is also makers friendly and around 10-11us$ (4 pieces for around 40us$)
        https://www.aliexpress.com/item/New-product-NRF52840-Bluetooth-5-MESH-Bluetooth-low-power-module-ZIGBEE-GT840A01/32909273516.html?spm=2114.search0104.3.43.bf083dad4DLBft&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd-6&algo_pvid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd&transAbTest=ae803_2&priceBeautifyAB=0
        0_1537102327744_77645b3c-f65e-48c8-ab21-9ade454a65d1-grafik.png

        I have also odered 3 nRF52840 dev boards from holyiot for 6us$ (which is quite ok).
        0_1537102018397_1f1e5b94-952b-4587-bc17-4fdce7ea3908-grafik.png
        0_1537102093205_e95dcd83-dcb1-46ad-8581-564e43181f21-grafik.png

        The question is, how far would be a reliable indoor distance which of course includes 3+ standard walls and how much difference is it compared to the nRF52832 (is the 840 really required)?
        And is/will there be a full protocoll support for BLE5.0 (or at least 4.2) or any other protocol which is good enoght to not require an additonal radio like LoRa?
        That would be great and very energy efficient for battery usage.

        At least it would solve my Flash/RAM problem for E-Paper (in comparison to the 328p) :-)
        Looking forward to the progress of this device/thread.

        NeverDieN 2 Replies Last reply
        0
        • H heinzv

          @neverdie I have ordered 10x nRF52832 and also 5x nRF52840. Two of theme are in the E73... modul which is not really easy to solder with it's additional pads in inner rows under the modul and the company has no plans to change it for private makers.

          I have ordered 2 but it looks like they have discontinued that or working on an upgrade?
          https://www.aliexpress.com/item/nRF52840-Bluetooth-5-0-240MHz-RF-Transceiver-CDSENET-E73-2G4M08S1C-8dbm-Ceramic-Antenna-BLE-4-2/32906661666.html?spm=a2g0s.9042311.0.0.50784c4dZJ6WSY

          I have seen the dongles but they are still quite expensive:
          https://www.aliexpress.com/item/NRF52840-Dongle-Original/32890524949.html?spm=2114.search0104.3.1.dfe53098heRtmA&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=c3e31797-40ab-4a13-b99e-df32e618cf5c-0&algo_pvid=c3e31797-40ab-4a13-b99e-df32e618cf5c&transAbTest=ae803_2&priceBeautifyAB=0

          This modul is also makers friendly and around 10-11us$ (4 pieces for around 40us$)
          https://www.aliexpress.com/item/New-product-NRF52840-Bluetooth-5-MESH-Bluetooth-low-power-module-ZIGBEE-GT840A01/32909273516.html?spm=2114.search0104.3.43.bf083dad4DLBft&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd-6&algo_pvid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd&transAbTest=ae803_2&priceBeautifyAB=0
          0_1537102327744_77645b3c-f65e-48c8-ab21-9ade454a65d1-grafik.png

          I have also odered 3 nRF52840 dev boards from holyiot for 6us$ (which is quite ok).
          0_1537102018397_1f1e5b94-952b-4587-bc17-4fdce7ea3908-grafik.png
          0_1537102093205_e95dcd83-dcb1-46ad-8581-564e43181f21-grafik.png

          The question is, how far would be a reliable indoor distance which of course includes 3+ standard walls and how much difference is it compared to the nRF52832 (is the 840 really required)?
          And is/will there be a full protocoll support for BLE5.0 (or at least 4.2) or any other protocol which is good enoght to not require an additonal radio like LoRa?
          That would be great and very energy efficient for battery usage.

          At least it would solve my Flash/RAM problem for E-Paper (in comparison to the 328p) :-)
          Looking forward to the progress of this device/thread.

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

          @heinzv Dongles cost just $10 each if you buy them through a regular Nordic retailer. I don't know where you live (I'm guessing Germany?), but if it's in Europe it should be easier to find a retailer who has them in stock. If you go to the Nordic dongle page and click buy, it will link you to a page with all the official online sellers. Easy.

          If you are concerned about range, then I would give #1 priority to picking a module which has a good antenna. Period. Full Stop. Read that again if you have to. Chip antennas are nicely compact, but they kill your range. The Nordic dongles seem to have pretty good range, so I think they are a good deal for $10.

          Nordic's answer to people who ask "what is the indoor range?" is basically, "buy it and try it yourself," because there are just too many variables to consider. So, $20 for two dongles, and you have your answer.

          It's my subjective impression that the indoor range on the nRF52840 at 1mbps or 2mbps may be roughly equal to an amplified nRF52832, such as the Fanstel BT832X. However, the nRF52840 can do a slower speed at 250kbps (using 802.11.15) that the nRF52832 can't do, and that should be able to have very noticeably longer range. I'm not at all sure about the 125Kbps long range that's only available through Bluetooth. I'm sure it's longer range, but Bluetooth seems not easy to program. Maybe a solution to that will be when someone does the inevitable module that can be controlled with simple AT commands. Better yet would be a highly simplified API to bluetooth.

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

            @heinzv yes, for the moment sandeep nrf5 core is not using latest softdevice (still s132). I don't remember about mbed (I imagine they use latest) but mysensors is not on mbed.
            Sure, subghz is not comparable with 2.4ghz. Like NeverDie said, there are many variables. The dongle have nice range when plugged in computer, it can be different if soldered on a different custom pcb, or using different software etc. Another point, is 2.4ghz can be crowded, depends where you live (no problem I live in rural area) but living in appartment in big cities I can imagine it's less quiet (coexistence&placement of wifi routers, phones, range extender, ble, zigbee, proprietary modes, more&more devices, not synced, channels overlap->selectivity&blocking etc..). Lot of variables for the real range.

            That said I'm not surprised that NeverDie has fun playing with this dongle. it looks sexy (although I decided to stop using nrf5).
            cool! keep the good work @NeverDie :+1:

            NeverDieN Nca78N H 3 Replies Last reply
            0
            • scalzS scalz

              @heinzv yes, for the moment sandeep nrf5 core is not using latest softdevice (still s132). I don't remember about mbed (I imagine they use latest) but mysensors is not on mbed.
              Sure, subghz is not comparable with 2.4ghz. Like NeverDie said, there are many variables. The dongle have nice range when plugged in computer, it can be different if soldered on a different custom pcb, or using different software etc. Another point, is 2.4ghz can be crowded, depends where you live (no problem I live in rural area) but living in appartment in big cities I can imagine it's less quiet (coexistence&placement of wifi routers, phones, range extender, ble, zigbee, proprietary modes, more&more devices, not synced, channels overlap->selectivity&blocking etc..). Lot of variables for the real range.

              That said I'm not surprised that NeverDie has fun playing with this dongle. it looks sexy (although I decided to stop using nrf5).
              cool! keep the good work @NeverDie :+1:

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

              @scalz Which radio do you prefer?

              I'm still a big fan of LoRa. If @heinzv wants guaranteed range today, he should go with LoRa. Once we better understand how to do 802.11.15 on the nRF52840, maybe that will also be compelling. I just can't say for sure, as I haven't yet tried it.

              1 Reply Last reply
              0
              • scalzS scalz

                @heinzv yes, for the moment sandeep nrf5 core is not using latest softdevice (still s132). I don't remember about mbed (I imagine they use latest) but mysensors is not on mbed.
                Sure, subghz is not comparable with 2.4ghz. Like NeverDie said, there are many variables. The dongle have nice range when plugged in computer, it can be different if soldered on a different custom pcb, or using different software etc. Another point, is 2.4ghz can be crowded, depends where you live (no problem I live in rural area) but living in appartment in big cities I can imagine it's less quiet (coexistence&placement of wifi routers, phones, range extender, ble, zigbee, proprietary modes, more&more devices, not synced, channels overlap->selectivity&blocking etc..). Lot of variables for the real range.

                That said I'm not surprised that NeverDie has fun playing with this dongle. it looks sexy (although I decided to stop using nrf5).
                cool! keep the good work @NeverDie :+1:

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

                @scalz said in Everything nRF52840:

                That said I'm not surprised that NeverDie has fun playing with this dongle. it looks sexy (although I decided to stop using nrf5).
                So, what do you use now ? @_@

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

                  I don't want to pollute this topic with another brand, or making people think it's a bad choice. Nrf5 is a nice arduino "compatible" mcu.
                  That just depends (in my case especially) on the application you want to build, the features available in frameworks, BOM etc.
                  @NeverDie I gave you hint in another thread ;)
                  it's not arduino compatible (and imho not a loss :) , except that needs to port some C sensors libs ). Same for mysensors, not compatible (at least not yet, but still some hope).

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

                    You can also improve range with data whitening, though I'm not sure by how much. To enable it, substitute this line into the above code examples:

                      NRF_RADIO->PCNF1 = 0x2040101;  //Means: data whitening enbled, base address is 4 bytes long (possible range is 2 to 4) and max size of payload is 1,and 1 bytes of static length payload
                    
                    

                    Then the hardware handles it automatically.

                    1 Reply Last reply
                    0
                    • alowhumA Offline
                      alowhumA Offline
                      alowhum
                      Plugin Developer
                      wrote on last edited by alowhum
                      #17

                      @heinzv
                      ST electronics has the dongle for 17 euros including shipping in the Netherlands/Europe.

                      It's slowly getting cheaper on Aliexpress too. $25 here:
                      https://www.aliexpress.com/item/nRF52840-Dongle-original-genuine/32922402227.html

                      1 Reply Last reply
                      0
                      • H heinzv

                        @neverdie I have ordered 10x nRF52832 and also 5x nRF52840. Two of theme are in the E73... modul which is not really easy to solder with it's additional pads in inner rows under the modul and the company has no plans to change it for private makers.

                        I have ordered 2 but it looks like they have discontinued that or working on an upgrade?
                        https://www.aliexpress.com/item/nRF52840-Bluetooth-5-0-240MHz-RF-Transceiver-CDSENET-E73-2G4M08S1C-8dbm-Ceramic-Antenna-BLE-4-2/32906661666.html?spm=a2g0s.9042311.0.0.50784c4dZJ6WSY

                        I have seen the dongles but they are still quite expensive:
                        https://www.aliexpress.com/item/NRF52840-Dongle-Original/32890524949.html?spm=2114.search0104.3.1.dfe53098heRtmA&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=c3e31797-40ab-4a13-b99e-df32e618cf5c-0&algo_pvid=c3e31797-40ab-4a13-b99e-df32e618cf5c&transAbTest=ae803_2&priceBeautifyAB=0

                        This modul is also makers friendly and around 10-11us$ (4 pieces for around 40us$)
                        https://www.aliexpress.com/item/New-product-NRF52840-Bluetooth-5-MESH-Bluetooth-low-power-module-ZIGBEE-GT840A01/32909273516.html?spm=2114.search0104.3.43.bf083dad4DLBft&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10547_10059_10548_10696_100031_5017615_10084_10083_10103_5017516_451_10618_452_10304_10307_5017416_10820_10821_10302_5017715,searchweb201603_60,ppcSwitch_4&algo_expid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd-6&algo_pvid=2fb40cd9-604f-47a8-b9f1-61d13e35e3cd&transAbTest=ae803_2&priceBeautifyAB=0
                        0_1537102327744_77645b3c-f65e-48c8-ab21-9ade454a65d1-grafik.png

                        I have also odered 3 nRF52840 dev boards from holyiot for 6us$ (which is quite ok).
                        0_1537102018397_1f1e5b94-952b-4587-bc17-4fdce7ea3908-grafik.png
                        0_1537102093205_e95dcd83-dcb1-46ad-8581-564e43181f21-grafik.png

                        The question is, how far would be a reliable indoor distance which of course includes 3+ standard walls and how much difference is it compared to the nRF52832 (is the 840 really required)?
                        And is/will there be a full protocoll support for BLE5.0 (or at least 4.2) or any other protocol which is good enoght to not require an additonal radio like LoRa?
                        That would be great and very energy efficient for battery usage.

                        At least it would solve my Flash/RAM problem for E-Paper (in comparison to the 328p) :-)
                        Looking forward to the progress of this device/thread.

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

                        @heinzv said in Everything nRF52840:

                        The question is, how far would be a reliable indoor distance which of course includes 3+ standard walls and how much difference is it compared to the nRF52832 (is the 840 really required)?

                        I think the short answer is that yes, it should be able to get through 3+ standard walls. There is some directionality to these antennas, so that can be a factor. You may not succeed if you aim the trace antennas in opposite directions, for instance. Using an external omni antenna might make the setup easier.

                        I think some of the claimed range for the nRF52840 is from coding gains added to the 125Kbps datarate. Without doing a lot of work, you might have to use bluetooth long-range to get those ranges. Not sure though.

                        1 Reply Last reply
                        0
                        • scalzS scalz

                          @heinzv yes, for the moment sandeep nrf5 core is not using latest softdevice (still s132). I don't remember about mbed (I imagine they use latest) but mysensors is not on mbed.
                          Sure, subghz is not comparable with 2.4ghz. Like NeverDie said, there are many variables. The dongle have nice range when plugged in computer, it can be different if soldered on a different custom pcb, or using different software etc. Another point, is 2.4ghz can be crowded, depends where you live (no problem I live in rural area) but living in appartment in big cities I can imagine it's less quiet (coexistence&placement of wifi routers, phones, range extender, ble, zigbee, proprietary modes, more&more devices, not synced, channels overlap->selectivity&blocking etc..). Lot of variables for the real range.

                          That said I'm not surprised that NeverDie has fun playing with this dongle. it looks sexy (although I decided to stop using nrf5).
                          cool! keep the good work @NeverDie :+1:

                          H Offline
                          H Offline
                          heinzv
                          wrote on last edited by heinzv
                          #19

                          @scalz you stopped because of what reason? And you did not want to tell why and what you're now using? It might be worth for us to know!
                          So far I plan to use ESP32 for most projects and trying to use the ultra low power nRF52 for battery powered devices. For the RF ranges I need to find out what is best. BLE or LoRa with RFM95 are my favorites now.
                          In a pure ESP environment ESPnow is also very good (we have tested it sucssfully within a 120m2 flat).
                          I have no better ideas so other HW devices far, but I'm always open for better ideas.

                          @NeverDie I'm not from Germany but from Austria :-) I'll do testing with the 15 modules I will get in the next 2 weeks. Regarding the indorr range: Of yourse I read all the statements also from Nordic. I thought you have already some practical experience.

                          In the battery wall sensors, I can only use a small sizes antenna and the gateway will have a better antenna.
                          So the typical distance in a flat is around 15m but through at least up to 3+ walls
                          Of course most todays flats/houses have many bluetooth and WLAN devices around.
                          But we need an appropriate mysensors radio/protocol library for the nRF52's. Any yes we can play around with lower data rates to extend the range based on the signal range and transmissison stability.

                          Looking forward to your experience and inputs.

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

                            Here's a simple sketch I wrote for the nRF52840-DONGLE that turns on, one at a time, each of the 4 programmable LED's on the dongle:

                            #include "mbed.h"
                            
                            #define BITMASK_LED1 64 //pin P0.06
                            #define BITMASK_LED2R  256 //PIN P0.08
                            #define BITMASK_LED2G  512 //PIN P1.09
                            #define BITMASK_LED2B  4096 //PIN P0.12
                            
                            
                            int main() {
                                NRF_P0->PIN_CNF[6]=0x701;  //Configure pin P0.6 as an output pin with high-drive '0' and disconnect '1'
                                NRF_P0->PIN_CNF[8]=0x701;  //Configure pin P0.8 as an output pin with high-drive '0' and disconnect '1'
                                NRF_P0->PIN_CNF[12]=0x701;  //Configure pin P0.12 as an output pin with high-drive '0' and disconnect '1'
                                NRF_P1->PIN_CNF[9]=0x701;  //Configure pin P1.09 as an output pin with high-drive '0' and disconnect '1'         
                                NRF_P0->DIR=BITMASK_LED1|BITMASK_LED2R|BITMASK_LED2B;  //Set LED's as output pins
                                NRF_P1->DIR=BITMASK_LED2G;  //set LED2G as an output pin.
                                
                                while (true) {
                                  NRF_P0->OUT=BITMASK_LED2R|BITMASK_LED2B;  //turn-on LED1.  Turn-ff LED2R and LED2B.
                                  NRF_P1->OUT=BITMASK_LED2G;  //Turn off LED2G
                                  wait(0.5);  //wait 500ms
                                  NRF_P0->OUT=BITMASK_LED1|BITMASK_LED2B; //turn on LED2R and turn off LED1 and LED2B
                                  wait(0.5);  //wait 500ms            
                                  NRF_P0->OUT=BITMASK_LED1|BITMASK_LED2R;  //Turn on LED2B and turn off LED1 and LED2R.
                                  wait(0.5);  //wait 500ms
                                  NRF_P0->OUT=BITMASK_LED1|BITMASK_LED2R|BITMASK_LED2B;  //turn off LED1 and LED2R and LED2B.
                                  NRF_P1->OUT=0;  //Turn on LED2G
                                  wait(0.5);  //wait 500ms
                                }
                            }
                            

                            The dongle per se isn't supported by mbed, which is why I'm doing it purely as register manipulations. Therefore, the code is completely portable and would transfer to whatever toolchain that you're using. I guess I'll write some support functions to make doing this easier in the future.

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

                              Good news. I just noticed that Fanstel will have a couple of amplified nRF52840, called the nRF52840X or nRF52840XE. They just aren't yet in production with them. At least to me, this will likely make a big difference in my level of satisfaction. Judging from the datasheet, it will have both a PA and an LNA, so even just having it on the gateway would be a worthwhile improvement.

                              H 1 Reply Last reply
                              0
                              • NeverDieN NeverDie

                                Good news. I just noticed that Fanstel will have a couple of amplified nRF52840, called the nRF52840X or nRF52840XE. They just aren't yet in production with them. At least to me, this will likely make a big difference in my level of satisfaction. Judging from the datasheet, it will have both a PA and an LNA, so even just having it on the gateway would be a worthwhile improvement.

                                H Offline
                                H Offline
                                heinzv
                                wrote on last edited by
                                #22

                                @neverdie said in Everything nRF52840:

                                nRF52840XE

                                If BLE5 alone works sufficient, that would be great. Worst case, I will use the nRF52 with RFM95 for the battery devices and an ESP32 + RFM95 for the gateway.
                                The new PCB's we plan with ranseyer will cover all possible combination and provides the mySX connector.

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

                                  Maybe by the time nRF52840X comes out (in 6 months to a year I'm guessing), maybe by then mbed will be fully supporting the nRF52840-DK. Or, maybe mbed never will. I need to find a tool chain different from mbed to adopt. I'm not sure whether mbed is nearly dead, slowly dying, or just slow, but I don't see a lot of activity on their forum given the vast scope of their projects. If they aren't on top of new developments,... it's just not a good sign. Also, I'm noticing that mbed comes with a large amount of code overhead (around 400Kbytes from what I've seen in my compilations on it), and although the nRF52840 can handle that and more...it seems strange given the small size of my test programs.

                                  So, I'm open to suggestions on an alternate toolchain, provided that it's up to date with respect to nRF52840.

                                  H 1 Reply Last reply
                                  0
                                  • NeverDieN NeverDie

                                    Maybe by the time nRF52840X comes out (in 6 months to a year I'm guessing), maybe by then mbed will be fully supporting the nRF52840-DK. Or, maybe mbed never will. I need to find a tool chain different from mbed to adopt. I'm not sure whether mbed is nearly dead, slowly dying, or just slow, but I don't see a lot of activity on their forum given the vast scope of their projects. If they aren't on top of new developments,... it's just not a good sign. Also, I'm noticing that mbed comes with a large amount of code overhead (around 400Kbytes from what I've seen in my compilations on it), and although the nRF52840 can handle that and more...it seems strange given the small size of my test programs.

                                    So, I'm open to suggestions on an alternate toolchain, provided that it's up to date with respect to nRF52840.

                                    H Offline
                                    H Offline
                                    heinzv
                                    wrote on last edited by heinzv
                                    #24

                                    @neverdie What speaks against platform.io with Visual Studio Code?
                                    https://platformio.org/platforms/nordicnrf52
                                    http://docs.platformio.org/en/latest/platforms/nordicnrf52.html (includes nRF52840 DK)
                                    and what about that:
                                    https://os.mbed.com/platforms/Nordic-nRF52-DK/
                                    and that:
                                    https://github.com/lpercifield/arduino-nRF5/tree/nrf52840

                                    NeverDieN 1 Reply Last reply
                                    0
                                    • H heinzv

                                      @neverdie What speaks against platform.io with Visual Studio Code?
                                      https://platformio.org/platforms/nordicnrf52
                                      http://docs.platformio.org/en/latest/platforms/nordicnrf52.html (includes nRF52840 DK)
                                      and what about that:
                                      https://os.mbed.com/platforms/Nordic-nRF52-DK/
                                      and that:
                                      https://github.com/lpercifield/arduino-nRF5/tree/nrf52840

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

                                      @heinzv said in Everything nRF52840:

                                      and what about that:
                                      https://os.mbed.com/platforms/Nordic-nRF52-DK/

                                      The mbed compiler doesn't seem to even recognize that there are new GPIO pins on the nRF52840 that don't exist on the nRF52832. For instance, P1.00, which is one of the pins on the Fanstel nRF52840 module. Plus, I'm not sure that printf works with anything other than USB. I've tried setting it to other pins, and it just hangs. I've written some custom code to do my own sserial communications over P1_00 (to handle a PCB backward compatability issue with the nRF52840 Fanstel modules), but if mbed is only half baked, it's not helping me like it should.

                                      Not sure about platform.io. Thanks for the lead. I'll look into it.

                                      H 1 Reply Last reply
                                      0
                                      • NeverDieN NeverDie

                                        @heinzv said in Everything nRF52840:

                                        and what about that:
                                        https://os.mbed.com/platforms/Nordic-nRF52-DK/

                                        The mbed compiler doesn't seem to even recognize that there are new GPIO pins on the nRF52840 that don't exist on the nRF52832. For instance, P1.00, which is one of the pins on the Fanstel nRF52840 module. Plus, I'm not sure that printf works with anything other than USB. I've tried setting it to other pins, and it just hangs. I've written some custom code to do my own sserial communications over P1_00 (to handle a PCB backward compatability issue with the nRF52840 Fanstel modules), but if mbed is only half baked, it's not helping me like it should.

                                        Not sure about platform.io. Thanks for the lead. I'll look into it.

                                        H Offline
                                        H Offline
                                        heinzv
                                        wrote on last edited by heinzv
                                        #26

                                        @neverdie take a look at platform.io, it supports al known SOC's. INstall it then from the Visual Studio Code IDE. Both together are a very professional IoT dev environment (also Web and other development).
                                        I was doing very complex development like ESPurna project build you would not like to do in the Arduino IDE.
                                        Let me know if you need further hints.
                                        VSC and Platform.IO includes not only all SOC HW families but also all kind of libraries you know from Arduino and it can also import Arduino project (*.INO Files).
                                        Give it a try and you will be suprrised once you get familar.
                                        It does also the flashing (upload), includes GIT nativly, has a command window, debugging etc etc.

                                        https://code.visualstudio.com/
                                        https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide
                                        https://marketplace.visualstudio.com/search?term=platform.io&target=VSCode&category=All categories&sortBy=Relevance

                                        Platforms: Atmel AVR, Atmel SAM, Espressif 32, Espressif 8266, Freescale Kinetis, Infineon XMC, Intel ARC32, Intel MCS-51 (8051), Lattice iCE40, Maxim 32, Microchip PIC32, Nordic nRF51, Nordic nRF52, NXP LPC, RISC-V, Samsung ARTIK, Silicon Labs EFM32, ST STM32, Teensy, TI MSP430, TI Tiva, WIZNet W7500

                                        Frameworks: Arduino, ARTIK SDK, CMSIS, Energia, ESP-IDF, libOpenCM3, mbed, Pumbaa, Simba, SPL, STM32Cube, WiringPi

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

                                          @heinzv platformio is nice for supporting lot of SOCs. But I think it still rely on sandeep arduino or mbed for nrf5, so, not sure if it adds stuff to the frameworks.. (regarding boards mapping, softdevices, etc). that's what NeverDie is searching I think.. an environment which allows to use all features of the SOC that he buy, ideally with myensors but we still can wait :)
                                          regarding what you asked me previously, this is one of my reason. As missing core features is not what I'm calling fast/easy to market/production for smarter features!
                                          That, and nrf is 2.4ghz only (area here is 9000m², few outbuildings with thick walls too), so increase of BOM&layout when using multiple modules (not a big problem for a gw, less nice for nodes). I don't want to use lora too..

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


                                          5

                                          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