nRF5 action!
-
@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.
@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.
-
@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.
@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.
-
I will test tomorrow with the Ebyte module I have soldered, and the reset pin too.
-
@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 ) 12You 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.
@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?
-
@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?
@Mike_Lemo it is here :
https://github.com/mysensors/ArduinoHwNRF5Scroll up in this thread for more details, or read the documentation there.
-
@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?
@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.
-
@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.
-
@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.
-
@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.
@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.
-
@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.
-
-
At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.
If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).
-
At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.
If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).
@NeverDie said in nRF5 Bluetooth action!:
At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.
If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
-
@NeverDie said in nRF5 Bluetooth action!:
At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.
If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
@Mike_Lemo said in nRF5 Bluetooth action!:
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that. Once we get the basics ironed out, though, I expect things will go more smoothly. In fact, I think we're almost there. A lot of the work for sleeping, measuring source voltage, etc., has already been done, which is far better than starting from scratch. And there's even example code, which helps tremendously.
-
Good news! Interestingly enough, the MockMySensors sketch seems to work fine when I load it onto the Ebyte. What a relief! So, I may try hijacking that sketch to convey voltage measurements instead of the BatteryPoweredSensor sketch that mysteriously hasn't been working on my Ebyte modules.
-
@NeverDie said in nRF5 Bluetooth action!:
At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.
If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
@Mike_Lemo said in nRF5 Bluetooth action!:
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.
The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.
@NeverDie said in nRF5 Bluetooth action!:
It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that.
I can't change the way of Windows driver handling, but when there are Windows specific issues then they bust be fixed.
-
@Mike_Lemo said in nRF5 Bluetooth action!:
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.
The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.
@NeverDie said in nRF5 Bluetooth action!:
It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that.
I can't change the way of Windows driver handling, but when there are Windows specific issues then they bust be fixed.
@d00616 said in nRF5 Bluetooth action!:
@Mike_Lemo said in nRF5 Bluetooth action!:
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.
The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.
.
You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways
-
@d00616 said in nRF5 Bluetooth action!:
@Mike_Lemo said in nRF5 Bluetooth action!:
Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.
The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.
The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.
.
You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways
@Mike_Lemo said in nRF5 Bluetooth action!:
You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways
No. I mean if you want to use the Nordic MCU with BLE and you want to access the whole hardware without developing drivers, then the Nordic SDK is an option. For special requirements like tone() you have to develop your own routine for Arduino or SDK.
If you want write code which is compatible with other Vendors or want use MySensors then the SDK isn't the best choice.
The arduino-nrf5 targets to provide the Arduino language. I think this is mostly complete. MySensors brings additional support for enhanced pin output modes and the random number generator (no SoftDevice support here).
Accessing the internal MCU hardware must be added via Arduino libraries. With the new SDK license I think it's possible to put parts of the SDK into libraries supporting Hardware which is not specified in the Arduino reference.
If you want to develop BLE applications with portable code, there are open source implementations like http://mynewt.apache.org/ which are designed to be portable.
-
Good news! The hwCPUVoltage() function measures the Vcc voltage on the Ebyte module in millivolts. I'm able to send that as a barometer reading using the mocksensors sketch, and it arrives all the way into Domoticz, where it is logged and graphed. So, obviously I need to streamline that a bit, but the proof of concept works. :)
-
Good news! The hwCPUVoltage() function measures the Vcc voltage on the Ebyte module in millivolts. I'm able to send that as a barometer reading using the mocksensors sketch, and it arrives all the way into Domoticz, where it is logged and graphed. So, obviously I need to streamline that a bit, but the proof of concept works. :)
Quantization error on the hwCpuVoltage() function appears to about 14 millivolts, which is a nice little improvement over the atmega328p. Measurement accuracy appears to be well within those bounds.
Next step is to measure voltage on an analog pin using an AnalogRead. Not sure if the reference voltage is Vcc (as it typically is with the atmega328p) or something else for those measurements.