Skip to content

Commit a6ea449

Browse files
aescolarnashif
authored andcommitted
drivers serial nrfx: Speed up for simulation
Increase the busy wait time granularity while runing in simulation for poll mode. In this mode, the driver spends a *lot* of time waiting for the UART to be done. The smallest frame time is ~10µs @ 1Mbps, so busywaiting in very small increments is very wastefull as we keep shuting down and turning on the simulated MCU. Let's increase the busy wait time increments of the driver to 3 micros, which should not change much the behaviour. Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent 685c883 commit a6ea449

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,11 @@ static int wait_tx_ready(const struct device *dev)
484484
/* wait arbitrary time before back off. */
485485
bool res;
486486

487+
#if defined(CONFIG_ARCH_POSIX)
488+
NRFX_WAIT_FOR(is_tx_ready(dev), 33, 3, res);
489+
#else
487490
NRFX_WAIT_FOR(is_tx_ready(dev), 100, 1, res);
491+
#endif
488492

489493
if (res) {
490494
key = irq_lock();
@@ -1502,7 +1506,7 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c)
15021506
}
15031507

15041508
irq_unlock(key);
1505-
Z_SPIN_DELAY(2);
1509+
Z_SPIN_DELAY(3);
15061510
}
15071511
} else {
15081512
key = wait_tx_ready(dev);

0 commit comments

Comments
 (0)