Skip to content
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

Merged
merged 2 commits into from May 14, 2017

Conversation

Projects
None yet
5 participants
@d00616
Copy link
Contributor

commented Apr 23, 2017

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

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 23, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 23, 2017

Git commit message(s) look good!

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 23, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

@henrikekblad

This comment has been minimized.

Copy link
Member

commented Apr 23, 2017

Great job @d00616!

@d00616

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2017

@tekka007 tekka007 added the nRF5 label Apr 23, 2017

@fallberg

This comment has been minimized.

Copy link
Contributor

commented Apr 24, 2017

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.

@tekka007 tekka007 requested review from tekka007 and scalz Apr 29, 2017

@tekka007 tekka007 added this to the 2.2.0 milestone Apr 30, 2017

@tekka007
Copy link
Contributor

left a comment

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

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 30, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 30, 2017

Git commit message(s) look good!

@d00616

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2017

@tekka007 hwDebugPrint() is changed. I have added the hwCPUVoltage() functionality.

If nothing more to change, I merge my last commit with 2ae764b

// already be handled!
MY_CRITICAL_SECTION {
// Fix cppcheck "(style) Variable '__savePriMask' is assigned a value that is never used."
(void)__savePriMask;

This comment has been minimized.

Copy link
@d00616

d00616 Apr 30, 2017

Author Contributor

I don't have any better idea about getting rid this message. This needs a fix in MyHwNRF5.h and MyHwSAMD.h

This comment has been minimized.

Copy link
@fallberg

fallberg May 1, 2017

Contributor

(void) casting in these situations is an acceptable solution

@mysensors-jenkins

This comment has been minimized.

Copy link

commented Apr 30, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

@d00616 d00616 force-pushed the d00616:add_nrf5_platform branch from cbfafed to 3e02ec8 May 6, 2017

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Git commit message(s) and/or coding style not good enough. I have mailed the details to the PR author.

@d00616 d00616 force-pushed the d00616:add_nrf5_platform branch from 3e02ec8 to d0f1b29 May 6, 2017

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Git commit message(s) and/or coding style not good enough. I have mailed the details to the PR author.

Add NVRAM support
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.

@d00616 d00616 force-pushed the d00616:add_nrf5_platform branch from d0f1b29 to 9e9a03f May 6, 2017

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Git commit message(s) look good!

@d00616

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2017

Now I have merged the review changes into 9e9a03f, so there are two clear commits.

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 6, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

@tekka007
Copy link
Contributor

left a comment

@d00616 I've tested your port in greater detail, please see the comments


// build metadata
tx_buffer.len = len;
tx_buffer.noack = noACK;

This comment has been minimized.

Copy link
@tekka007

tekka007 May 7, 2017

Contributor

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;

This comment has been minimized.

Copy link
@d00616

d00616 May 7, 2017

Author Contributor

@tekka007 Changed. If you are fine with this change, I merge the Commit into the main commit.

tx_buffer.pid++;

// Calculate number of retries
tx_retries = ((recipient == BROADCAST_ADDRESS)?(NRF5_ESB_BC - 1):(NRF5_ESB_ARC - 1));

This comment has been minimized.

Copy link
@tekka007

tekka007 May 7, 2017

Contributor

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?

This comment has been minimized.

Copy link
@d00616

d00616 May 7, 2017

Author Contributor

I have added MY_NRF5_ESB_REVERSE_ACK

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Git commit message(s) look good!

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Git commit message(s) look good!

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

@tekka007
Copy link
Contributor

left a comment

@d00616 Thanks for your fast replies and correction, much appreciated 👍 - I've just tested your last modifications - comments, see below

@@ -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)

This comment has been minimized.

Copy link
@tekka007

tekka007 May 7, 2017

Contributor

if set to (1) BC msgs won't be sent (due to this)

This comment has been minimized.

Copy link
@d00616

d00616 May 7, 2017

Author Contributor

Thank you. It's fixed.

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Git commit message(s) look good!

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

Add NRF5 platform support
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.

@d00616 d00616 force-pushed the d00616:add_nrf5_platform branch from 9c223eb to 62cb88e May 7, 2017

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Will evaluate git discipline...

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Git commit message(s) look good!

@d00616

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2017

Commits merged.

@tekka007 Thank you for your review.

@mysensors-jenkins

This comment has been minimized.

Copy link

commented May 7, 2017

Core tests successful.
A member of the MySensors core team can ask me to verify this pull request more extensively by telling me "jenkins, build examples please".
But remember that I will only listen if you name me with a capital 'J'.

@tekka007 tekka007 merged commit 726a20d into mysensors:development May 14, 2017

3 checks passed

Gitler Git commit message(s) look good!
Details
Jenkins (test sketches) Core tests successful.
Details
clahub All contributors have signed the Contributor License Agreement.
Details

@d00616 d00616 deleted the d00616:add_nrf5_platform branch Aug 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.