Skip to content

Add support for nRF52810 #46

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

Merged
merged 8 commits into from
Jun 23, 2024
Merged

Conversation

positron96
Copy link
Contributor

@positron96 positron96 commented Jun 18, 2024

Fixes #45
Uses info from #17
Also needs patch to PlatformIO python script (it adds FPU compiler flags), see h2zero/platform-n-able#1

I was able to compile blink and basic BLE example (BLE-server-test).

Here are some comparisons with other cores (neither work without modifications):

blink:
n-able:

RAM:   [==        ]  20.3% (used 4988 bytes from 24576 bytes)
Flash: [=         ]   9.1% (used 17896 bytes from 196608 bytes)

zephyr (probably contains BLE stack, as numbers are not much different from below):

RAM:   [======    ]  60.1% (used 14778 bytes from 24576 bytes)
Flash: [===       ]  31.1% (used 61228 bytes from 196608 bytes)

official PlatformIO RF52 core (no RTOS gives you these numbers, yes):

RAM:   [          ]   0.6% (used 140 bytes from 24576 bytes)
Flash: [          ]   1.1% (used 2156 bytes from 196608 bytes)

basic BLE example
The examples are different for each core, BLE beacon in zephyr, BLE-controlled LED in RF52, BLE-server-test for n-able.
Though I don't expect much different resources requirements.

n-able:

RAM:   [========  ]  77.3% (used 19004 bytes from 24576 bytes)
Flash: [======    ]  62.6% (used 123080 bytes from 196608 bytes)

zephyr:

RAM:   [======    ]  63.6% (used 15628 bytes from 24576 bytes)
Flash: [===       ]  33.2% (used 65308 bytes from 196608 bytes)

RF52 (need to add softdevice size, 114kb flash + 8kb RAM):

RAM:   [          ]   4.4% (used 1076 bytes from 24576 bytes)
Flash: [=         ]   8.2% (used 16120 bytes from 196608 bytes)

I'd be fine with n-able using 62% of flash (there is still plenty left), but I am concerned that it uses 77% or RAM, leaving like 5Kb for all my code. Is there anything I can tweak to reduce RAM usage?

@h2zero
Copy link
Owner

h2zero commented Jun 18, 2024

Great work so far, there are some tweaks that need to be made to the linker file to reduce the ram use as they all have been modified for use here.

@h2zero
Copy link
Owner

h2zero commented Jun 19, 2024

@positron96 I've pushed a few changes to the config and startup scripts, please test them and let me know how it works out.

@positron96
Copy link
Contributor Author

@positron96 I've pushed a few changes to the config and startup scripts, please test them and let me know how it works out.

Thanks!
With new changes, the same BLE-server is this:

RAM:   [=======   ]  66.5% (used 16348 bytes from 24576 bytes)

I'll test on the MCU later.

@h2zero
Copy link
Owner

h2zero commented Jun 19, 2024

@positron96 I changed the linker script so there is some defined space for data storage and added the board as a generic.
Could you have a look at the board config and let me know if anything is incorrect?

@positron96
Copy link
Contributor Author

I don't have Arduino IDE, only PlatformIO, I think it doesn't use boards file.
It looks good, except maximum upload size should be 196608

@positron96
Copy link
Contributor Author

I thought that since in terms of RAM nRF52810 is closer to nrf51 than to nRF52832, it's better to take some settings from that definition. So I set MYNEWT_VAL_MSYS_1_BLOCK_SIZE to 88 (instead of 292) to save a Kb or two. Could you tell me what MSYS refers to actually?

@h2zero
Copy link
Owner

h2zero commented Jun 19, 2024

The max upload needs to be adjusted lower because the bond storage and user data storage each need 2 pages of flash.

Yes the nRF51 settings are memory optimal, you'll need to adjust the settings for your application, like main task stack size, disabling ble roles etc.

The msys is the internal memory system used by NimBLE, mainly for long reads and writes and scan results.

@h2zero
Copy link
Owner

h2zero commented Jun 19, 2024

We should add a board to the platform as well

@positron96
Copy link
Contributor Author

We should add a board to the platform as well

Done in h2zero/platform-n-able#1

@h2zero
Copy link
Owner

h2zero commented Jun 21, 2024

LGTM, let me know when you are done testing/ready for this to be merged please.

@positron96
Copy link
Contributor Author

Well, I've been using it for a week and it's working well for me.

@h2zero
Copy link
Owner

h2zero commented Jun 22, 2024

Awesome, thanks!

@h2zero h2zero merged commit bd7d6c2 into h2zero:master Jun 23, 2024
15 checks passed
@h2zero h2zero mentioned this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nRF52810 support?
2 participants