Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-8953

ClockP_usleep() for FreeRTOS calculates delay incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • TI Device Drivers
    • TIDRIVERS-1441
    • 3.50.00
    • 3.60.00
    • Hide
      ClockP_usleep(usec) for FreeRTOS calculates the delay passed to vTaskDelay(), using portTICK_PERIOD_MS. This macro is defined in FreeRTOS/Source/portable///portmacro.h as:
      #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )

      If configTICK_RATE_HZ were ever set to a value > 1000, this would be 0. It is probably also better to use defines that are in FreeRTOSConfig.h.
      Instead, we could calculate the delay for ClockP_usleep(usec) as:

      tickPeriouUs = 1000000 / configTICK_RATE_HZ; /* Tick period in microseconds */
      delay = (usec + tickPeriodUs - 1) / tickPeriodUs; /* Take the ceiling */
      Show
      ClockP_usleep(usec) for FreeRTOS calculates the delay passed to vTaskDelay(), using portTICK_PERIOD_MS. This macro is defined in FreeRTOS/Source/portable///portmacro.h as: #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) If configTICK_RATE_HZ were ever set to a value > 1000, this would be 0. It is probably also better to use defines that are in FreeRTOSConfig.h. Instead, we could calculate the delay for ClockP_usleep(usec) as: tickPeriouUs = 1000000 / configTICK_RATE_HZ; /* Tick period in microseconds */ delay = (usec + tickPeriodUs - 1) / tickPeriodUs; /* Take the ceiling */

      ClockP_usleep() for FreeRTOS calculates delay incorrectly

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: