Skip to content

Commit 8c432ea

Browse files
projectgusdpgeorge
authored andcommitted
rp2: Remove 1ms timeout to make idle waiting tickless.
The main motivation for doing this was to reduce the latency when the system is woken by a USB interrupt. The best_effort_wfe_or_timeout() function calls into the pico-sdk dynamic timer framework which sets up a new dynamic timer instance each time, and then has to tear it down before continuing after a WFE. Testing Python interrupt latency, it seems to be improved by about 12us (from average of 46us to 34us running a Pin IRQ). C-based "scheduled nodes" should see even lower latency. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent b41055a commit 8c432ea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ports/rp2/modmachine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
111111
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj, 0, 1, machine_freq);
112112

113113
STATIC mp_obj_t machine_idle(void) {
114-
best_effort_wfe_or_timeout(make_timeout_time_ms(1));
114+
__wfe();
115115
return mp_const_none;
116116
}
117117
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);

ports/rp2/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ extern void mp_thread_end_atomic_section(uint32_t);
274274
#define MICROPY_EVENT_POLL_HOOK \
275275
do { \
276276
MICROPY_EVENT_POLL_HOOK_FAST; \
277-
best_effort_wfe_or_timeout(make_timeout_time_ms(1)); \
277+
__wfe(); \
278278
} while (0);
279279

280280
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy