New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nrf5 platform #830
Add nrf5 platform #830
Conversation
Will evaluate git discipline... |
Git commit message(s) look good! |
Core tests successful. |
Great job @d00616! |
Great job @d00616 [1]!
Thank you. It was a long way for me to implement an open source
compatible version without using Nordic's SDK with it's own license.
|
Nice work! Once submitted I'll at some point update jenkins to do some sanity checking on this variant so we get static code analysis and doxygen validation on it fully covered. I might make various patches to the code at that point to get rid of the typical issues but they are usually confined to comment blocks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done @d00616 - worked out of the box :)
(Port tested using nRF51-DK dongle and nRF52-DK)
Please update hwDebugPrint() to include the most recent changes (timestamp), see here for reference https://github.com/mysensors/MySensors/blob/development/hal/architecture/MyHwAVR.cpp#L269-L295
Will evaluate git discipline... |
Git commit message(s) look good! |
// already be handled! | ||
MY_CRITICAL_SECTION { | ||
// Fix cppcheck "(style) Variable '__savePriMask' is assigned a value that is never used." | ||
(void)__savePriMask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any better idea about getting rid this message. This needs a fix in MyHwNRF5.h and MyHwSAMD.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(void) casting in these situations is an acceptable solution
Core tests successful. |
Will evaluate git discipline... |
Git commit message(s) and/or coding style not good enough. I have mailed the details to the PR author. |
Will evaluate git discipline... |
Git commit message(s) and/or coding style not good enough. I have mailed the details to the PR author. |
This is an EEPROM replacement based on MCU's internal Flash memory. The NVRAM class is designed to be stateless. Each operation is written to flash immediately. The last 16k(nRF51)/32k(nRF52) of Flash memory are managed by the VirtualPage class. This class allows writing a single emulated 4k page up 40,000 times. The NVRAM class is a log based byte-wise storage allowing up to 40,000,000 writes depending on the number of used addresses. Each four allocated addresses from the beginning of the NVRAM reduce the write log by one. When first 256 bytes of the emulated storage are used, there is an average writing capacity of 145,000 cycles per byte. When the write log is full, the NVRAM is compressed into a new flash page. After a new page is ready, the old page is released. This process can take up to 4500 ms and cannot be interrupted. The NVRAM functionality can easily be ported to ESP8266 or SAMD by providing a Flash interface.
Will evaluate git discipline... |
Git commit message(s) look good! |
Now I have merged the review changes into 9e9a03f, so there are two clear commits. |
Core tests successful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@d00616 I've tested your port in greater detail, please see the comments
drivers/NRF5/Radio_ESB.cpp
Outdated
|
||
// build metadata | ||
tx_buffer.len = len; | ||
tx_buffer.noack = noACK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RF24 driver sets the NOACK flag either for broadcasted messages or if the noACK parameter is set (used for passive node mode) - I suggest this change:
tx_buffer.noack = noACK || recipient==BROADCAST_ADDRESS;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tekka007 Changed. If you are fine with this change, I merge the Commit into the main commit.
drivers/NRF5/Radio_ESB.cpp
Outdated
tx_buffer.pid++; | ||
|
||
// Calculate number of retries | ||
tx_retries = ((recipient == BROADCAST_ADDRESS)?(NRF5_ESB_BC - 1):(NRF5_ESB_ARC - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC / noACK messages should be sent once.
A general thought: Many users have nRF24L01+ counterfeits with flipped noACK bits - this should be taken into consideration in a mixed (genuine/counterfeit) network, i.e. the SW ESB/RF24 noACK implementation should be adjustable, maybe as preprocessor switch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added MY_NRF5_ESB_REVERSE_ACK
Will evaluate git discipline... |
Git commit message(s) look good! |
Will evaluate git discipline... |
Git commit message(s) look good! |
Core tests successful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@d00616 Thanks for your fast replies and correction, much appreciated 👍 - I've just tested your last modifications - comments, see below
drivers/NRF5/Radio_ESB.h
Outdated
@@ -53,7 +53,7 @@ | |||
#define NRF5_ESB_ARC (15) | |||
|
|||
// How often broadcast messages are send | |||
#define NRF5_ESB_BC (4) | |||
#define NRF5_ESB_BC (1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if set to (1) BC msgs won't be sent (due to this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. It's fixed.
Will evaluate git discipline... |
Git commit message(s) look good! |
Core tests successful. |
This is the support of the Nordic Semiconductor NRF51 (nrf51822, nrf51422) and NRF52 (nrf52832) platform. Based on arduino-nRF5 (https://github.com/sandeepmistry/arduino-nRF5). The included radio driver is compatible with the NRF24 devices. Using a SoftDevice (BLE)is not supported and must be removed before flashing MySensors with a "mass_erase" operation.
Will evaluate git discipline... |
Git commit message(s) look good! |
Commits merged. @tekka007 Thank you for your review. |
Core tests successful. |
This is the support of the Nordic Semiconductor NRF51 (nrf51822, nrf51422) and NRF52 (nrf52832) platform. Based on arduino-nRF5(https://github.com/sandeepmistry/arduino-nRF5).
The Radio is working in an NRF24 compatible mode. Other protocols can implemented. SoftDevice (BLE) is not supported and must be removed before flashing MySensors.
The included "NVM" driver allows an EEPROM like access to the last 16/32k of Flash pages. It can easily ported to ESP8266 or SAMD by providing an Flash interface.
Documentation about using this code: https://www.openhardware.io/view/376/MySensors-NRF5-Platform