Skip to content

xtimer_usleep wrong delay time #10073

@leandrolanzieri

Description

@leandrolanzieri

Description

While doing some tests on #10011, which uses a 1-wire interface I found out that the xtimer_usleep is introducing an extra delay.

I did some measurements by toggling a GPIO. Here is the value passed to the function vs. the actual delay measured.

Board 1us 5us 10us 50us 100us
nucleo-f410rb 4us 8us 18us 58us 108us
nucleo-l152re 12us 16us 21us 73us 124us

I also confirmed that this is not a delay introduced by the toggle of the pin by adding multiple calls of the xtimer_usleep function and each of them would add this extra time.

Steps to reproduce the issue

Try toggling a GPIO pin and using the xtimer_usleep function to wait:

   while (1) {
        gpio_toggle((GPIO_PIN(PORT_A, 5)));
        xtimer_usleep(10);
    }

Expected results

Should see the pin toggled each 10us.

Actual results

Pin toggles each 21us (on nucleo-152re).

Versions

Installed compiler toolchains
native gcc: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
avr-gcc: missing
mips-mti-elf-gcc: missing
msp430-gcc: missing
riscv-none-embed-gcc: missing
clang: clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

Installed compiler libs
arm-none-eabi-newlib: "2.5.0"
mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
avr-libc: missing (missing)

Installed development tools
cmake: cmake version 3.10.2
cppcheck: missing
doxygen: 1.8.13
flake8: missing
git: git version 2.17.1
coccinelle: missing

Metadata

Metadata

Assignees

Labels

Area: timersArea: timer subsystemsPlatform: ARMPlatform: This PR/issue effects ARM-based platformsState: won't fixState: The issue can not or will not be fixedType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions