Skip to content

pkg/mynewt-core: fix timer configuration for nrf51 - #18136

Merged
benpicco merged 1 commit into
RIOT-OS:masterfrom
haukepetersen:fix_mynewtcore_timernrf51
Jun 2, 2022
Merged

pkg/mynewt-core: fix timer configuration for nrf51#18136
benpicco merged 1 commit into
RIOT-OS:masterfrom
haukepetersen:fix_mynewtcore_timernrf51

Conversation

@haukepetersen

@haukepetersen haukepetersen commented May 25, 2022

Copy link
Copy Markdown
Contributor

Contribution description

While testing #18029 it turned out, that doing a combined build using NimBLE and mynewt-core did not run on nrf51 boards, due to a failed assertion caused by faulty timer configuration for the nrf51.

This PR fixes that configuration, so that the hal_timer is initialized properly for the nrf51 now.

However: I can still get not get RIOT+NimBLE+mynewt-core properly running on a nrf51 board, there seem to be additional issues with the RNG setup. When running the nimble_scanner example using both NimBLE and mynewt-core (USEPKG=mynewt-core BOARD=airfy-beacon make), I get:

2022-05-25 09:14:20,135 # assertion "REENT malloc succeeded" failed: file "/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/src/newlib/newlib/libc/stdlib/rand48.c", line 139                          
2022-05-25 09:14:20,136 # #! exit 1: powering off 

Can't really see what exactly is failing here, I guess we need to keep looking :-)

Testing procedure

Run any nimble example (e.g. /examples/nimble_scanner) on a nrf512-based board while enabling the mynewt-core package -> ``USEPKG=mynewt-core`. Once anything is sorted out, the examples should behave as expected without any runtime failures :-)

Issues/PRs references

follow up on #18029, also rebased on #18029

@haukepetersen haukepetersen added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label May 25, 2022
@github-actions github-actions Bot added Area: BLE Area: Bluetooth Low Energy support Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels May 25, 2022
@fjmolinas
fjmolinas self-requested a review May 25, 2022 08:28
@benpicco

Copy link
Copy Markdown
Contributor

Does this depend on #18029?

@fjmolinas

Copy link
Copy Markdown
Contributor

@haukepetersen can you squash out the commits from #18029, a5ba99d seems to fix the issue in master on its own:

IIOTLAB_NODE=auto CFLAGS=-DDEBUG_ASSERT_VERBOSE USEPKG=mynewt-core BOARD=microbit make -C examples/nimble_gatt/ -j flash term

ssh -t molina@lille.iot-lab.info 'socat - tcp:microbit-1.lille.iot-lab.info:20000' 
main(): This is RIOT! (Version: 2022.07-devel-574-gd13fa-pr-18136)
NimBLE GATT Server Example

@haukepetersen

Copy link
Copy Markdown
Contributor Author

#18029 is squashed and ready. Once merged this PR should be more straight forward to cope with :-)

@haukepetersen
haukepetersen force-pushed the fix_mynewtcore_timernrf51 branch from a5ba99d to 1198efd Compare June 2, 2022 08:23
@haukepetersen

Copy link
Copy Markdown
Contributor Author

rabased this PR on the current state of #18029.

A quick test using the airfy-beacon shows that (at least) the nimble_gatt example is now running as expected:

2022-06-02 10:22:49,177 # main(): This is RIOT! (Version: 2022.07-devel-603-g1198e-fix_mynewtcore_timernrf51)
2022-06-02 10:22:49,177 # NimBLE GATT Server Example
2022-06-02 10:22:55,128 # service 'rw demo' callback triggered
2022-06-02 10:22:55,133 # access to characteristic 'rw demo (read-only)'
2022-06-02 10:22:55,143 # new random number: 3
2022-06-02 10:22:55,143 # 
2022-06-02 10:22:56,613 # service 'rw demo' callback triggered
2022-06-02 10:22:56,617 # access to characteristic 'rw demo (write)'
2022-06-02 10:22:56,620 # read from characteristic
2022-06-02 10:22:56,629 # current value of rm_demo_write_data: 'This characteristic is read- and writeable!'
2022-06-02 10:22:56,629 # 
2022-06-02 10:22:56,703 # service 'rw demo' callback triggered
2022-06-02 10:22:56,708 # access to characteristic 'rw demo (write)'
2022-06-02 10:22:56,710 # read from characteristic
2022-06-02 10:22:56,719 # current value of rm_demo_write_data: 'This characteristic is read- and writeable!'
2022-06-02 10:22:56,720 # 
2022-06-02 10:23:20,643 # service 'rw demo' callback triggered
2022-06-02 10:23:20,648 # access to characteristic 'rw demo (write)'
2022-06-02 10:23:20,650 # write to characteristic
2022-06-02 10:23:20,659 # old value of rm_demo_write_data: 'This characteristic is read- and writeable!'
2022-06-02 10:23:20,664 # new value of rm_demo_write_data: 'Pudding, mhh'
...

Can you reproduce this?

@haukepetersen

Copy link
Copy Markdown
Contributor Author

Same goes for the heart-rate sensor example (examples/nimble_heart_rate) -
CFLAGS=-DDEBUG_ASSERT_VERBOSE USEPKG=mynewt-core BOARD=airfy-beacon make -j clean all flash term:

2022-06-02 10:29:28,153 # main(): This is RIOT! (Version: 2022.07-devel-603-g1198e-fix_mynewtcore_timernrf51)
2022-06-02 10:29:28,154 # NimBLE Heart Rate Sensor Example
2022-06-02 10:29:38,146 # [NOTIFY_ENABLED] heart rate service
2022-06-02 10:29:38,398 # [NOTIFY] heart rate service: measurement 84
2022-06-02 10:29:38,653 # [NOTIFY] heart rate service: measurement 86
2022-06-02 10:29:38,909 # [NOTIFY] heart rate service: measurement 88
2022-06-02 10:29:39,164 # [NOTIFY] heart rate service: measurement 90
2022-06-02 10:29:39,420 # [NOTIFY] heart rate service: measurement 92
2022-06-02 10:29:39,676 # [NOTIFY] heart rate service: measurement 94
...

@fjmolinas

Copy link
Copy Markdown
Contributor

@haukepetersen thanks for squashing but I meant leaving only 1198efd in this PR, since that fixes nrf51 + mynewt-core on itself, then #18029 introduces or exposed an other issue somehow, so I would rather get 1198efd in on its own as a clean starting point

@haukepetersen
haukepetersen force-pushed the fix_mynewtcore_timernrf51 branch from 1198efd to cd332d6 Compare June 2, 2022 09:15
@github-actions github-actions Bot removed Area: Kconfig Area: Kconfig integration Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: BLE Area: Bluetooth Low Energy support Area: build system Area: Build system Area: cpu Area: CPU/MCU ports labels Jun 2, 2022
@haukepetersen

Copy link
Copy Markdown
Contributor Author

removed all dependencies to #18029 - so the nrf51 timer fix for mynewt-core is now stand-alone.

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 2, 2022

@fjmolinas fjmolinas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK! Thanks for this fix!

@haukepetersen

Copy link
Copy Markdown
Contributor Author

You're welcome :-)

@fjmolinas fjmolinas added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 2, 2022
@fjmolinas

Copy link
Copy Markdown
Contributor

Not sure but this might need a rebase for the python issue...

@haukepetersen

Copy link
Copy Markdown
Contributor Author

rebased

@haukepetersen
haukepetersen force-pushed the fix_mynewtcore_timernrf51 branch from cd332d6 to 39085c7 Compare June 2, 2022 12:59
@benpicco
benpicco enabled auto-merge June 2, 2022 20:49
@benpicco
benpicco merged commit d20d353 into RIOT-OS:master Jun 2, 2022
@haukepetersen
haukepetersen deleted the fix_mynewtcore_timernrf51 branch June 3, 2022 07:29
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants