Skip to content

Commit ea1a7fa

Browse files
authored
more delay explanations
1 parent bdc7562 commit ea1a7fa

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

readme.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Over the past few years freeRTOS development has become increasingly 32-bit orie
2222
FreeRTOS has a multitude of configuration options, which can be specified from within the FreeRTOSConfig.h file.
2323
To keep commonality with all of the Arduino hardware options, some sensible defaults have been selected. Feel free to change these defaults as you gain experience with FreeRTOS.
2424

25-
The AVR Watchdog Timer is used to generate 15ms time slices, but Tasks that finish before their allocated time will hand execution back to the Scheduler. This does not affect the use of any of the normal Timer functions in Arduino.
25+
The AVR Watchdog Timer is used to generate 15ms time slices (Ticks), but Tasks that finish before their allocated time will hand execution back to the Scheduler.
2626

2727
Time slices can be selected from 15ms up to 500ms. Slower time slicing can allow the Arduino MCU to sleep for longer, without the complexity of a Tickless idle.
2828

@@ -36,17 +36,15 @@ Watchdog period options:
3636
* `WDTO_1S`
3737
* `WDTO_2S`
3838

39-
Note that Timer resolution is affected by integer math division and the time slice selected. Trying to measure 50ms, using a 120ms time slice for example, won't work. Also, trying to measure less than 15ms, with the default time slice, will not work.
39+
Note that Timer resolution is affected by integer math division and the time slice selected. Trying to measure 50ms, using a 120ms time slice for example, won't work. Also, trying to delay for less than 15ms, with the default time slice, will not work.
4040

41-
The Arduino `delay()` function has been defined to automatically use the FreeRTOS `vTaskDelay()` function, so that Arduino example sketches and tutorials work with no change. If you would like to measure a short millisecond delay of less than one Tick (Watchdog period), then [use `millis()`](https://www.arduino.cc/reference/en/language/functions/time/millis/) to achieve this outcome (for example see [BlinkWithoutDelay](https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay)).
41+
The Arduino `delay()` function has been defined to automatically use the FreeRTOS `vTaskDelay()` function, so that simple Arduino example sketches and tutorials work with no change. If you would like to measure a short millisecond delay of less than one Tick (Watchdog period), then use [`millis()`](https://www.arduino.cc/reference/en/language/functions/time/millis/) (or with greater granularity use [`micros()`](https://www.arduino.cc/reference/en/language/functions/time/micros/)) to achieve this outcome (for example see [BlinkWithoutDelay](https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay)).
4242

43-
The 8-bit AVR Timer0 has been added as an option for the experienced user. Please examine the source code to figure out how to use it. This using Timer0 will break Arduino `millis()` and `delay()` though, as these rely on Timer0.
43+
The 8-bit AVR Timer0 has been added as an option for the experienced user. Please examine the source code to figure out how to use it. Reconfiguring Timer0 for FreeRTOS will break Arduino `millis()` and `micros()` though, as these functions rely on Timer0.
4444

45-
Stack for the `loop()` function has been set at 192 Bytes. This can be configured by adjusting the `configMINIMAL_STACK_SIZE` parameter. If you have stack overflow issues, just increase it. Users should prefer to allocate larger structures, arrays, or buffers using `pvPortMalloc()`, rather than defining them locally on the stack. If you are not using `loop()` then the stack size can be reduced to 85 Bytes, saving some valuable memory.
45+
Stack for the `loop()` function has been set at 192 Bytes. This can be configured by adjusting the `configMINIMAL_STACK_SIZE` parameter. If you have stack overflow issues, just increase it. Users should prefer to allocate larger structures, arrays, or buffers using `pvPortMalloc()`, rather than defining them locally on the stack. Ideally you should not use `loop()` for your sketches, and then the stack size can be reduced down to 85 Bytes, saving some valuable memory.
4646

47-
Memory for the heap is allocated by the normal `malloc()` function, wrapped by `pvPortMalloc()`.
48-
This option has been selected because it is automatically adjusted to use the capabilities of each device.
49-
Other heap allocation schemes are supported by FreeRTOS, and they can used with additional configuration.
47+
Memory for the heap is allocated by the normal `malloc()` function, wrapped by `pvPortMalloc()`. This option has been selected because it is automatically adjusted to use the capabilities of each device. Other heap allocation schemes are supported by FreeRTOS, and they can used with some additional configuration.
5048

5149
## Upgrading
5250

0 commit comments

Comments
 (0)