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 630.8k 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.
  • M Offline
    M Offline
    Mike_Lemo
    wrote on last edited by
    #470

    Someone managed to get NFC to work with this IC on the arduino IDE?

    1 Reply Last reply
    0
    • NeverDieN NeverDie

      @NeverDie said in nRF5 Bluetooth action!:

      I think I have a better hypothesis as to what's going on in my situation: the ebyte module is getting hung-up trying to establish communication with the serial gateway. Looking at the output of the serial gateway, it looks as though it is receiving packets from the Ebyte module. However, looking at the Ebyte output, it thinks it is failing. So, the Ebyte never quite gets out of the "establish communication link" mode.

      This doesn't occur, though, if I use an nRF52 DK, instead of an Ebyte module.

      So, what might explain this is maybe the MISO pin on the Ebyte module isn't mapped right.

      @d00616 Would you please share the pin mappings and board type that you are using for your ebyte module? Since you are having success, I think that will fix the problem.

      Some further evidence in support of this hypothesis (from: https://github.com/mysensors/ArduinoHwNRF5):

      Most components, like UART, SPI, Wire Bus, of the nRF5 series chips don't have a fixed pin mapping.

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

      Does the nRF52 mcu communicate with its radio using SPI, or some other bus? Or are all the radio registers simply memory mapped?

      @NeverDie said in nRF5 Bluetooth action!:

      Some further evidence in support of this hypothesis (from: https://github.com/mysensors/ArduinoHwNRF5):

      Most components, like UART, SPI, Wire Bus, of the nRF5 series chips don't have a fixed pin mapping.

      Well, if the mcu uses SPI to communicate with the radio, then I simply need to define which SPI "pins" those are. Attached is the pin mapping file that I used to successfully map the pins for Rx and Tx.
      0_1501606355303_MyNRF5Board.cpp

      1 Reply Last reply
      0
      • Nca78N Offline
        Nca78N Offline
        Nca78
        Hardware Contributor
        wrote on last edited by
        #472

        @NeverDie if I'm not wrong you managed to connect the Ebyte module to your MySensors network, no ?
        I did it anyway and it received data.
        Radio is internally connected inside the nrf52 chip so I don't see how a module could have a different mapping ?

        NeverDieN 1 Reply Last reply
        2
        • Nca78N Nca78

          @NeverDie if I'm not wrong you managed to connect the Ebyte module to your MySensors network, no ?
          I did it anyway and it received data.
          Radio is internally connected inside the nrf52 chip so I don't see how a module could have a different mapping ?

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

          @Nca78 said in nRF5 Bluetooth action!:

          Radio is internally connected inside the nrf52 chip so I don't see how a module could have a different mapping ?

          Yeah, that's what I thought originally, and it probably is true. I'm just grasping at straws to understand why the "board" type seems to be affecting the radio communications. I'm also completely new to the mysensors way of handling radio, so that's getting in my way. I'm might have to try something more barebones before I can make sense of this.

          1 Reply Last reply
          0
          • TerrenceT Offline
            TerrenceT Offline
            Terrence
            wrote on last edited by
            #474

            Some Nordic guidance might help.

            Building Bluetooth-Connected IoT Wireless Sensor Prototypes with Minimal Effort

            https://www.digikey.com/en/articles/techzone/2017/jul/building-bluetooth-connected-iot-wireless-sensor-prototypes

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

              I've confirmed it now. Even if I comment out all apparent radio message sends, the mere act of including:

              #include <MySensors.h>
              

              results in a loss of control by the sketch itself to something within MySensors that wants to establish communication between the node and the gateway. Not even sure how that is happening. In any case, it is just overcomplicating the debugging, and I really don't want that right now because it is effectively hanging what I'm trying to do. :angry:

              For now, all I want is a simple send packet--like either the mirf or the twh20 libraries have for the nRF24L01--with no complicating factors. Is that too much to ask? I can probably find that somewhere within the library, but how do I turn-off this loop that it's in where it's repetitively trying to establish the initial communication with the serial gateway?

              1 Reply Last reply
              0
              • NeverDieN NeverDie

                @d00616 said in nRF5 Bluetooth action!:

                I have tried the hwCPUVoltage() function with an Ebyte and an RedBear module. Both modules are reporting the voltage.

                That's good news. There must be something wrong with how I'm doing it. Which board type are you using for the Ebyte module?

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

                @NeverDie said in nRF5 Bluetooth action!:

                That's good news. There must be something wrong with how I'm doing it. Which board type are you using for the Ebyte module?

                I have the equal module like yours.

                @NeverDie said in nRF5 Bluetooth action!:

                @d00616 Would you please share the pin mappings and board type that you are using for your ebyte module? Since you are having success, I think that will fix the problem.

                The module is connected to SWDIO/CLK, VCC and the GND near the radio. I don't remember which pin I used for Serial TX.

                @NeverDie said in nRF5 Bluetooth action!:

                Does the nRF52 mcu communicate with its radio using SPI, or some other bus? Or are all the radio registers simply memory mapped?

                The registers are memory mapped, the data transferred with "EasyDMA" into the memory.

                @NeverDie said in nRF5 Bluetooth action!:

                I've confirmed it now. Even if I comment out all apparent radio message sends, the mere act of including: '#include <MySensors.h>' results in a loss of control by the sketch itself to something within MySensors that wants to establish communication between the node and the gateway.

                The SecurityPersonalizer defines '#define MY_CORE_ONLY' before including 'MySensors.h'. In theory, you can use the radio functions defined in 'hal/transport/MyTransportHAL.h' directly. I had no luck with this, but I haven't invested time to debug this.

                NeverDieN 1 Reply Last reply
                1
                • M Mike_Lemo

                  From what I understand the NRF52832 has some kind of enforcer that allows different serial hardwares to be assigned to different pins

                  Now using the arduino IDE I want to use the I2C pins that are assigned hardwarely to different pins here is the situation

                  I have one PCB that has SCL connected to pin 20 and SDA to 21

                  and another PCB that has SCL connected to pin 11 and SDA to pin 12

                  I want to define the enforcer for the pins within their dedicated sketches without running around to the internal arduino files and change the pin assignment for each upload to each board.

                  How'd I do that? I assume you'd have to do some thing like that in the upper side of the personal code.

                  #define SDL...(Something else I don't know ) 11
                  #define SDA...(Something else I don't know ) 12

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

                  @Mike_Lemo said in nRF5 Bluetooth action!:

                  I want to define the enforcer for the pins within their dedicated sketches without running around to the internal arduino files and change the pin assignment for each upload to each board.
                  How'd I do that? I assume you'd have to do some thing like that in the upper side of the personal code.
                  #define SDL...(Something else I don't know ) 11
                  #define SDA...(Something else I don't know ) 12

                  You have to install the "MySensors nRF5 Boards" package. In the examples section for this package, you can find two files (MyNRF5Board.h + MyNRF5Board.cpp). Add these files to your sketch and compile it using "MyNRF5Board nRF52822" as you board.

                  @Mike_Lemo said in nRF5 Bluetooth action!:

                  Well apperantly this function uses a PWM pin at 50% duty but the frequency varies according to the functiong user parameter now I just know how to active a PWM pin at 50% duty but not how to acces the NRF52 registers to change the frequency of the PWM.

                  The registers are documented in the Infocenter and the bitfields.

                  I don't realy know how to access the registers you see at the product's PDF and the other process.

                  To access the registers, you have to add '#include <nrf.h>' to your code. Mostly the hardware is accesses by NRF_HWNAME->REGISTER

                  Doing PWM is a little bit complex. The code is different for nRF51 and nRF52. Look into wiring_analog_nRF51.c and (wiring_analog_nRF51.c)[https://github.com/sandeepmistry/arduino-nRF5/blob/c98a190eb34c0247eb8e0764a6367c7f9e51d2fc/cores/nRF5/wiring_analog_nRF52.c#L214]

                  If you clone this code, for nRF52 you have to use another timer, like TIMER2, because you can't define the interrupt routine twice.

                  M 1 Reply Last reply
                  1
                  • Nca78N Offline
                    Nca78N Offline
                    Nca78
                    Hardware Contributor
                    wrote on last edited by
                    #478

                    So I'm trying to program the S4AT modules and I have the ugly message

                    ** Programming Started **
                    auto erase enabled
                    Info : nRF51822-QFAA(build code: H0) 256kB Flash
                    Error: Cannot erase protected sector at 0x0
                    Error: failed erasing sectors 0 to 13
                    embedded:startup.tcl:454: Error: ** Programming Failed **
                    

                    I tried to use JLink programs but it says it cannot connect to the module, so I cannot unlock (ends with timeout message) and I cannot erase (fails with -1 return value)...
                    Does that mean I have to go the long hard way with a bluepill as programmer and openocd ? Anyone has other ideas to unlock and erase the device ?

                    d00616D 1 Reply Last reply
                    0
                    • Nca78N Nca78

                      So I'm trying to program the S4AT modules and I have the ugly message

                      ** Programming Started **
                      auto erase enabled
                      Info : nRF51822-QFAA(build code: H0) 256kB Flash
                      Error: Cannot erase protected sector at 0x0
                      Error: failed erasing sectors 0 to 13
                      embedded:startup.tcl:454: Error: ** Programming Failed **
                      

                      I tried to use JLink programs but it says it cannot connect to the module, so I cannot unlock (ends with timeout message) and I cannot erase (fails with -1 return value)...
                      Does that mean I have to go the long hard way with a bluepill as programmer and openocd ? Anyone has other ideas to unlock and erase the device ?

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

                      @Nca78 said in nRF5 Bluetooth action!:

                      Does that mean I have to go the long hard way with a bluepill as programmer and openocd ? Anyone has other ideas to unlock and erase the device ?

                      Select in to Tools menu "None" Softdevice and then "Burn Bootloader". This raises an error but the device is erased completely.

                      Nca78N NeverDieN sebiS 3 Replies Last reply
                      1
                      • d00616D d00616

                        @Nca78 said in nRF5 Bluetooth action!:

                        Does that mean I have to go the long hard way with a bluepill as programmer and openocd ? Anyone has other ideas to unlock and erase the device ?

                        Select in to Tools menu "None" Softdevice and then "Burn Bootloader". This raises an error but the device is erased completely.

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

                        @d00616 said in nRF5 Bluetooth action!:

                        Select in to Tools menu "None" Softdevice and then "Burn Bootloader". This raises an error but the device is erased completely.

                        Thank you it works ! :heart: :heart: :heart:
                        That's probably when trying to use this function that I managed to unlock&erase the EByte module "by mistake" :)

                        The only problem now is the range seems to be very bad :(
                        Less than 10m with just a brick wall and it fails to completely send the presentation messages.
                        EBytes nrf52832 module works well in the same conditions, same for their nrf24 modules.

                        [Edit] in fact not that bad, it works ok when changing the orientation of the module. Could be due to the funky wiring but my bet is it on the tiny antenna design. My gateway is an old through hole nrf24 clone so range should not be a problem in an appartment with a PA/LNA gateway.

                        1 Reply Last reply
                        1
                        • d00616D d00616

                          @NeverDie said in nRF5 Bluetooth action!:

                          That's good news. There must be something wrong with how I'm doing it. Which board type are you using for the Ebyte module?

                          I have the equal module like yours.

                          @NeverDie said in nRF5 Bluetooth action!:

                          @d00616 Would you please share the pin mappings and board type that you are using for your ebyte module? Since you are having success, I think that will fix the problem.

                          The module is connected to SWDIO/CLK, VCC and the GND near the radio. I don't remember which pin I used for Serial TX.

                          @NeverDie said in nRF5 Bluetooth action!:

                          Does the nRF52 mcu communicate with its radio using SPI, or some other bus? Or are all the radio registers simply memory mapped?

                          The registers are memory mapped, the data transferred with "EasyDMA" into the memory.

                          @NeverDie said in nRF5 Bluetooth action!:

                          I've confirmed it now. Even if I comment out all apparent radio message sends, the mere act of including: '#include <MySensors.h>' results in a loss of control by the sketch itself to something within MySensors that wants to establish communication between the node and the gateway.

                          The SecurityPersonalizer defines '#define MY_CORE_ONLY' before including 'MySensors.h'. In theory, you can use the radio functions defined in 'hal/transport/MyTransportHAL.h' directly. I had no luck with this, but I haven't invested time to debug this.

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

                          @d00616 said in nRF5 Bluetooth action!:

                          The registers are memory mapped, the data transferred with "EasyDMA" into the memory.

                          In this case I'm going to try a different Ebyte module. Maybe the one I'm using is defective or somehow became damaged.

                          1 Reply Last reply
                          0
                          • d00616D d00616

                            @Nca78 said in nRF5 Bluetooth action!:

                            Does that mean I have to go the long hard way with a bluepill as programmer and openocd ? Anyone has other ideas to unlock and erase the device ?

                            Select in to Tools menu "None" Softdevice and then "Burn Bootloader". This raises an error but the device is erased completely.

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

                            @d00616 said in nRF5 Bluetooth action!:

                            Select in to Tools menu "None" Softdevice and then "Burn Bootloader". This raises an error but the device is erased completely.

                            I'm happy to report this also worked when, just now, I programmed a new Ebyte module. Like d00616 said earlier, it's a much faster way to do a mass erase. :)

                            Unfortunately, and in contrast with the nRF52 DK, the new Ebyte module I just programmed is behaving the same as the Ebyte I've been experimenting with. No change.

                            1 Reply Last reply
                            1
                            • Nca78N Offline
                              Nca78N Offline
                              Nca78
                              Hardware Contributor
                              wrote on last edited by
                              #483

                              I will test tomorrow with the Ebyte module I have soldered, and the reset pin too.

                              NeverDieN 1 Reply Last reply
                              1
                              • d00616D d00616

                                @Mike_Lemo said in nRF5 Bluetooth action!:

                                I want to define the enforcer for the pins within their dedicated sketches without running around to the internal arduino files and change the pin assignment for each upload to each board.
                                How'd I do that? I assume you'd have to do some thing like that in the upper side of the personal code.
                                #define SDL...(Something else I don't know ) 11
                                #define SDA...(Something else I don't know ) 12

                                You have to install the "MySensors nRF5 Boards" package. In the examples section for this package, you can find two files (MyNRF5Board.h + MyNRF5Board.cpp). Add these files to your sketch and compile it using "MyNRF5Board nRF52822" as you board.

                                @Mike_Lemo said in nRF5 Bluetooth action!:

                                Well apperantly this function uses a PWM pin at 50% duty but the frequency varies according to the functiong user parameter now I just know how to active a PWM pin at 50% duty but not how to acces the NRF52 registers to change the frequency of the PWM.

                                The registers are documented in the Infocenter and the bitfields.

                                I don't realy know how to access the registers you see at the product's PDF and the other process.

                                To access the registers, you have to add '#include <nrf.h>' to your code. Mostly the hardware is accesses by NRF_HWNAME->REGISTER

                                Doing PWM is a little bit complex. The code is different for nRF51 and nRF52. Look into wiring_analog_nRF51.c and (wiring_analog_nRF51.c)[https://github.com/sandeepmistry/arduino-nRF5/blob/c98a190eb34c0247eb8e0764a6367c7f9e51d2fc/cores/nRF5/wiring_analog_nRF52.c#L214]

                                If you clone this code, for nRF52 you have to use another timer, like TIMER2, because you can't define the interrupt routine twice.

                                M Offline
                                M Offline
                                Mike_Lemo
                                wrote on last edited by
                                #484

                                @d00616 said in nRF5 Bluetooth action!:

                                MySensors nRF5 Boards

                                Thanks for the caring replay.

                                I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                Do you know where can the arduino library folder be found with all the arduino functions?

                                Nca78N d00616D 2 Replies Last reply
                                0
                                • M Mike_Lemo

                                  @d00616 said in nRF5 Bluetooth action!:

                                  MySensors nRF5 Boards

                                  Thanks for the caring replay.

                                  I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                  Do you know where can the arduino library folder be found with all the arduino functions?

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

                                  @Mike_Lemo it is here :
                                  https://github.com/mysensors/ArduinoHwNRF5

                                  Scroll up in this thread for more details, or read the documentation there.

                                  1 Reply Last reply
                                  1
                                  • M Mike_Lemo

                                    @d00616 said in nRF5 Bluetooth action!:

                                    MySensors nRF5 Boards

                                    Thanks for the caring replay.

                                    I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                    Do you know where can the arduino library folder be found with all the arduino functions?

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

                                    @Mike_Lemo said in nRF5 Bluetooth action!:

                                    I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                    Follow the instructions for ArduinoBoards and ArduinoHwNRF5

                                    Do you know where can the arduino library folder be found with all the arduino functions?

                                    The arduino-nrf5 port only implements functionality documented in the official Arduino Reference but mostly not more functionality available for SAMD :-(. Additional functionality like BLE or using included hardware must come from external libraries like MySensors.

                                    A good way to implement the tone commands is to fork the arduino-nRF5 repository at github. Change what you need and create an pull request with reference to the Arduino reference. If you inform me about your PR I comment it to increase the chance for acceptance otherwise it's time to maintain an separate fork of this repository.

                                    1 Reply Last reply
                                    1
                                    • Nca78N Nca78

                                      I will test tomorrow with the Ebyte module I have soldered, and the reset pin too.

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

                                      @Nca78 said in nRF5 Bluetooth action!:

                                      I will test tomorrow with the Ebyte module I have soldered, and the reset pin too.

                                      That would be great! :) Please try the BatteryPoweredSensor sketch when you do. I'm very curious if you will have the same or different result as what I'm getting.

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        Mike_Lemo
                                        wrote on last edited by
                                        #488

                                        @d00616 said in nRF5 Bluetooth action!:

                                        @Mike_Lemo said in nRF5 Bluetooth action!:

                                        I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                        Follow the instructions for ArduinoBoards and ArduinoHwNRF5

                                        Do you know where can the arduino library folder be found with all the arduino functions?

                                        The arduino-nrf5 port only implements functionality documented in the official Arduino Reference but mostly not more functionality available for SAMD :-(. Additional functionality like BLE or using included hardware must come from external libraries like MySensors.

                                        A good way to implement the tone commands is to fork the arduino-nRF5 repository at github. Change what you need and create an pull request with reference to the Arduino reference. If you inform me about your PR I comment it to increase the chance for acceptance otherwise it's time to maintain an separate fork of this repository.

                                        that actually caused more trouble won't even let me compile the blank included example code.

                                        NeverDieN 1 Reply Last reply
                                        0
                                        • M Mike_Lemo

                                          @d00616 said in nRF5 Bluetooth action!:

                                          @Mike_Lemo said in nRF5 Bluetooth action!:

                                          I couldn't find that exact "MySensors nRF5 Boards" library you were talking about also what is the purpose of this library anyways?

                                          Follow the instructions for ArduinoBoards and ArduinoHwNRF5

                                          Do you know where can the arduino library folder be found with all the arduino functions?

                                          The arduino-nrf5 port only implements functionality documented in the official Arduino Reference but mostly not more functionality available for SAMD :-(. Additional functionality like BLE or using included hardware must come from external libraries like MySensors.

                                          A good way to implement the tone commands is to fork the arduino-nRF5 repository at github. Change what you need and create an pull request with reference to the Arduino reference. If you inform me about your PR I comment it to increase the chance for acceptance otherwise it's time to maintain an separate fork of this repository.

                                          that actually caused more trouble won't even let me compile the blank included example code.

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

                                          @Mike_Lemo said in nRF5 Bluetooth action!:

                                          that actually caused more trouble won't even let me compile the blank included example code.

                                          Are you talking about the MyNRF5Board example? Arduino IDE compiles it for me without any complaints.

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


                                          4

                                          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