Skip to content

Changing configTICK_RATE_HZ to 100 #29

@centerorbit

Description

@centerorbit

Hello,

I am working on a project that has some atypical constraints that keep popping up (reading sensors at high cycle rates, and running tasks for many hours on end). And I've realized that having the configTICK_RATE_HZ set to 1000 may be both cutting into my available cycle times and limiting how long my tasks can run (due to overflow of uint).

The FreeRTOS documentation recommends configTICK_RATE_HZ to be set somewhere in the 100's (yet their documentation is often in 1000).

If I change the configTICK_RATE_HZ to 100 in the FreeRTOSConfig.h it would seem to work fine, except the Arduino function millis() is now counting in centi-seconds (aka 10x faster than milliseconds).

My guess is that this is a split-brain conflict between how Arduino thinks the MPU timer interrupts are configured and how the FreeRTOS actually configures the interrupts.

I dug through the arduino core and found where millis() is defined:
https://github.com/arduino/ArduinoCore-samd/blob/9f91accecc8298976670234e4d6ac0afef5c7a39/cores/arduino/delay.c

And that seems to bubble up to a SysTick_Handler.

And interestingly enough the FreeRTOSConfig.h has reference to this function:
// #define xPortSysTickHandler SysTick_Handler

But sadly, when I uncomment it I get a build error:

/tmp/arduino-sketch-8207F96DB73DDE6C846722181CBF0D7B/../arduino-core-cache/core_P1AM-100_samd_P1AM-100_native_9b4df8df00aa424bbcc46d14ec2deaea.a(cortex_handlers.c.o): In function `SysTick_Handler':
/home/andy/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/cores/arduino/cortex_handlers.c:171: multiple definition of `SysTick_Handler'
/tmp/arduino-sketch-8207F96DB73DDE6C846722181CBF0D7B/libraries/FreeRTOS_SAMD21/port.c.o:/home/andy/Arduino/libraries/FreeRTOS_SAMD21/src/port.c:402: first defined here
collect2: error: ld returned 1 exit status

Error during build: exit status 1

I'm guessing that I need to either modify my board port (the P1AM-100) to not define the SysTick_Handler and let FreeRTOS do that (which I'll try next) but wanted to ask/seek guidance on this issue since I am quite over my head in this area.

Let me know if you have any sage advice in approaching this matter.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions