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

    Does anybody know why the function tone() doesn't work for the nrf52?

    mfalkviddM d00616D 2 Replies Last reply
    0
    • M Mike_Lemo

      Does anybody know why the function tone() doesn't work for the nrf52?

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

      @Mike_Lemo could you be slightly more specific than "doesn't work"?

      M 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @Mike_Lemo could you be slightly more specific than "doesn't work"?

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

        @mfalkvidd said in nRF5 Bluetooth action!:

        @Mike_Lemo could you be slightly more specific than "doesn't work"?

        apparently it doesn't recognize it says tone wasn't declared in this scope

        That's how the line looks tone(BUZZER_PIN, BUZZER_TONE);
        BUZZER_PIN = 26
        BUZZER_TONE = 3000

        mfalkviddM 1 Reply Last reply
        0
        • M Mike_Lemo

          @mfalkvidd said in nRF5 Bluetooth action!:

          @Mike_Lemo could you be slightly more specific than "doesn't work"?

          apparently it doesn't recognize it says tone wasn't declared in this scope

          That's how the line looks tone(BUZZER_PIN, BUZZER_TONE);
          BUZZER_PIN = 26
          BUZZER_TONE = 3000

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

          @Mike_Lemo if you mean the stuff described at https://www.arduino.cc/en/Reference/Tone it's because it only supports the following mcus:
          ATmega8
          ATmega168/328
          ATmega1280

          M 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @Mike_Lemo if you mean the stuff described at https://www.arduino.cc/en/Reference/Tone it's because it only supports the following mcus:
            ATmega8
            ATmega168/328
            ATmega1280

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

            @mfalkvidd said in nRF5 Bluetooth action!:

            @Mike_Lemo if you mean the stuff described at https://www.arduino.cc/en/Reference/Tone it's because it only supports the following mcus:
            ATmega8
            ATmega168/328
            ATmega1280

            How is it possible to make it copatible with the NRF52?

            mfalkviddM 1 Reply Last reply
            0
            • M Mike_Lemo

              @mfalkvidd said in nRF5 Bluetooth action!:

              @Mike_Lemo if you mean the stuff described at https://www.arduino.cc/en/Reference/Tone it's because it only supports the following mcus:
              ATmega8
              ATmega168/328
              ATmega1280

              How is it possible to make it copatible with the NRF52?

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

              @Mike_Lemo it (the tone library) would need to be ported

              M 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @Mike_Lemo it (the tone library) would need to be ported

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

                @mfalkvidd said in nRF5 Bluetooth action!:

                @Mike_Lemo it would need to be ported

                No idea what you are talking about.

                mfalkviddM 1 Reply Last reply
                0
                • M Mike_Lemo

                  @mfalkvidd said in nRF5 Bluetooth action!:

                  @Mike_Lemo it would need to be ported

                  No idea what you are talking about.

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

                  @Mike_Lemo look it up? https://en.wikipedia.org/wiki/Software_portability#Effort_to_port_source_code

                  M 1 Reply Last reply
                  0
                  • NeverDieN NeverDie

                    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.

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

                    @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 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @Mike_Lemo look it up? https://en.wikipedia.org/wiki/Software_portability#Effort_to_port_source_code

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

                      @mfalkvidd said in nRF5 Bluetooth action!:

                      @Mike_Lemo look it up? https://en.wikipedia.org/wiki/Software_portability#Effort_to_port_source_code

                      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.

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

                      1 Reply Last reply
                      0
                      • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          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