SylixOS timer test error analysis

  1. Test Model
    1.1 Test Flow
    SylixOS timer test error analysis
    Figure 1.1 Running Flow
    Figure 1.1 shows the test code running flow. The accuracy of the timer is judged by the time between GPIO pulling up and pulling down.
    1.2 Test method
    1.2.1 Test model
    Use the ZYNQ internal private timer, set the timing time to 250μs and bind the interrupt. Pull the GPIO high in the interrupt service routine, pull the GPIO low and send the binary semaphore the next time the interrupt service routine is entered. Create a high-priority task in the application to receive binary semaphores and simulate the load, create 10 medium-priority tasks to simulate the load, and connect an oscilloscope to measure the time.
    1.2.2 Test Interference Items
  2. Other interrupts with different priorities;
  3. other load programs;
  4. Binary semaphore;
    1.3 Test results
    When the program runs, the waveform shown in Figure 1.2 will be generated.
    SylixOS timer test error analysis
    Figure 1.2
    Using the oscilloscope capture function for normal waveforms, as shown in Figure 1.3 and Figure 1.4, the time interval between the capture level pull-down and pull-up is shown in Figure 1.4. After 12 hours of capture, the waveform less than 242μs does not appear, and after 12 hours of capture, it is greater than 258μs The waveform does not appear.
    SylixOS timer test error analysis
    Figure 1.3 Capture the waveform less than 242μs
    SylixOS timer test error analysis
    Figure 1.4 Capture the waveform greater than 258μs The
    test results can see that the error range is between 242μs and 258μs, so the error size is ±8μs.
  5. Error Analysis
    From the perspective of the program running process, after reaching the timing time of 250μs:
    1 Interrupt generation;
    ○2 Responding to the interrupt service routine;
    ○3 Pulling GPIO;
    Then the interrupt cannot be responded; the maximum shutdown time of SylixOS is 7μs; at this time, errors may occur;
    (2) The average interrupt response time of SylixOS is 3.6μs, the minimum is 2.9μs, and the maximum is 4.1μs. Analyze the following scenarios:
  6. The system shutdown interrupt occurs before the first interrupt is generated, and then the interrupt responds with the slowest time of 4.1μs and pulls the GPIO low; before the second interrupt is generated, the system shutdown interrupt does not occur, and the fastest time to respond to the interrupt is 2.9μs and pull the GPIO high ; This scene time will be about 7μs+1μs less than the normal time;
  7. There is no system shutdown interrupt before the first interrupt is generated, and then the interrupt is responded to in the fastest 2.9μs, and the GPIO is pulled low; the system shutdown interrupt occurs before the second interrupt is generated, and the GPIO is pulled high in the slowest 4.1μs response. ; This scene time will be about 7μs+1μs longer than the normal time;
    this error analysis is exactly in line with the test result ±8μs.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325023409&siteId=291194637