← index #4377PR #6202
Off-topic · high · value 1.563
QUERY · ISSUE

nrf: add support for threading

openby george-xiongopened 2018-12-24updated 2019-05-21
port-nrf

hi Micropython,

could you please add thread to nrf as some cusotmer in china need micropython support multi-thread function. currently, it is not supported on nrf51&52 platform.
my email is george.xiong@nordicsemi.no

thanks.

Best regards
george

CANDIDATE · PULL REQUEST

Feat nrf time rtc support

closedby hoihuopened 2020-06-27updated 2020-07-08
port-nrf

This is a cleanup version of the inputs collected in https://github.com/micropython/micropython/pull/6171
(I didn't want to force push the update to that PR because it contains implementation details
via ticker module that might be useful for others)

Basically it adds support for time.ticks_ms / time.ticks_us via RTC1, configured in 30usec tick mode. It also
adds the time.ticks_add and time.ticks_diff helper functions.

For this to work properly the RTC1's overflow irq is handled and a msec / usec ticks counter appropiately
generated (see also commit comment for this relatively complex matter). Thanks for @dpgeorge for
basically providing the solution there!

The PR also contains support for MICROPY_EVENT_POLL_HOOK. The wakeup from WFI is done via RTC1's
CCR0, configured in app. 1msec intervals. Basically that makes the nrf port ready for asyncio.

This feature can be enabled using MICROPY_PY_TIME_TICKS. If disabled, the system uses the legacy
ticks and sleep methods.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied