‘Queues’ provide a task-to-task, task-to-interrupt, and interrupt-to-task communication mechanism. Characteristics of a Queue Data Storage A queue can hold a finite number of fixed size data items. The maximum number of items a queue can hold is called its ‘length’. Both the length and the size of each data item are set when the queue is created. Queues are normally used as First In First Out (FIFO) buffers, where data is written to the end (tail) of the queue and removed from the front (head) of the queue. There are two ways in which queue behavior could have been implemented: 1. Queue by copy Queuing by copy means the data sent to the queue is copied byte for byte into the queue 2. Queue by reference Queuing by reference means the queue only holds pointers to the data sent to the queue, not the data itself. FreeRTOS uses the queue by copy method. Queuing by copy is considered to be simultaneously more powerful and simpler to use than queueing by reference becaus...
GPIO as Interrupt The external interrupt/event controller consists of up to 23 edge detectors for generating event/interrupt requests. Each input line can be independently configured to select the type (interrupt or event) and the corresponding trigger event (rising or falling or both). Each line can also masked independently. A pending register maintains the status line of the interrupt requests. GPIO Interrupt In section one (GPIOs) we have 16 interrupt lines. They are line0 to line15 and they also represent pin number. This means, PA0 is connected to Line0 and PA13 is connected to Line13 . All pins with same number are connected to line with same number. They are multiplexed to one line. PA0 and PB0 and PC0 and so on, are connected to Line0 , so you can use only one pin at one time to handle interrupt from there. PA0 and PA5 are connected to different lines, they can be used at the same time. Each line can trigger an interrupt on rising, falling or rising_falling enge on si...
Time Measurement time slicing : In the examples, both tasks were created at the same priority, and both tasks were always able to run. Therefore, each task executed for a ‘time slice’, entering the Running state at the start of a time slice, and exiting the Running state at the end of a time slice. The length of the time slice is effectively set by the tick interrupt frequency, which is configured by the application-defined configTICK_RATE_HZ For example, if configTICK_RATE_HZ is set to 100 (Hz), then the time slice will be 10 milliseconds. The time between two tick interrupts is called the ‘tick period’. One time slice equals one tick period. FreeRTOS API calls always specify time in multiples of tick periods, which are often referred to simply as ‘ticks’. The pdMS_TO_TICKS() macro converts a time specified in milliseconds into a time specified in ticks. pdMS_TO_TICKS() cannot be used if the tick frequency is above 1KHz (if configTICK_RATE_HZ is greater than 1...
留言
張貼留言