中文字幕第二一区_久久久久在线视频_精品国产自在现线看久久_亚洲精品一区二区三区电影网

產品分類

當前位置: 首頁 > 工業電子產品 > 其他電子產品 > SoM

類型分類:
科普知識
數據分類:
SoM

Real Time: Some Notes on Microcontroller Interrupt Latency

發布日期:2022-10-09 點擊率:225

       
Interrupts take a lot out of a high-speed processor, especially one that is heavily pipelined and, capable of issuing more than one instruction per cycle. There could be eight to ten instructions in flight at any one time that either have to be run to completion, or annulled and restarted once normal execution resumes.

The electrical engineer needs to check that the interrupt responds fast enough for the application and, that the overhead of the interrupt does not swamp the main application.

Just how fast can a given MCU perform an interrupt? That is certainly affected by the application, but it seems unreasonably hard to find a number for this item.

When an interrupt occurs, the CPU saves some of its registers and executes the interrupt service routine (ISR), and then returns to the highest-priority task in the ready state. Interrupts are usually maskable and nestable.

Just to be clear, latency is usually specified as the time between the interrupt request and execution of the first instruction in the interrupt service routine. However the "real latency" must include some housekeeping that must be done in the ISR, which can cause confusion.

The value in which an electrical engineer is usually interested is the worst -case interrupt latency. This is a sum of many different smaller delays.

  1. The interrupt request signal needs to be synchronized to the CPU clock. Depending on the synchronization logic, typically up to three CPU cycles can be lost before the interrupt request has reached the CPU core.

  2. The CPU will typically complete the current instruction. This instruction can take a lot of cycles, with divide, push-multiple, or memory-copy instructions requiring most clock cycles taking the most time. There are often additional cycles required for memory access. In an ARM7 system, for example, the instruction STMDB SP!,{R0-R11,LR} (Push parameters and perm.) Registers is typically the worst case instruction. It stores 13 32-bit registers on the stack and requires 15 clock cycles.

  3. The memory system may require additional cycles for wait states.

  4. After completion of the current instruction, the CPU performs a mode switch or pushes registers (typically PC and flag registers) on the stack. In general, modern CPUs (such as ARM) perform a mode switch, which requires less CPU cycles than saving registers.

  5. If your CPU is pipelined, the mode switch has flushed the pipeline and a few more cycles are required to refill it. But we are not done yet. In more complex systems, there can be additional causes for interrupt latencies.


In more complex systems, there can be additional cause for interrupt latencies.

  1. Latencies cause by cache line fill:
    If the memory system has one or multiple caches, these may not contain the required data. Then, not only the required data is loaded from memory, but in many cases a complete line fill needs to be performed, reading multiple words from memory.

  2. Latencies caused by cache write back:
    A cache miss may cause a line to replaced. If this line is marked as dirty, it needs to be written back to main memory, causing an additional delay.

  3. Latencies caused by Memory Management Units (MMU) translation table walks:
    Translation table walks can take a considerable amount of time, especially as they involve potentially slow main memory accesses. In real-time interrupt handlers, translation table walks caused by the Translation Lookaside Buffer (TLB) not containing translations for the handler and/or the data it accesses can increase interrupt latency significantly.

  4. Latencies caused by the application program:
    The application program can cause additional latencies by disabling interrupts.

  5. Latencies caused by interrupt routines:
    If the application has more than one urgent interrupt, they cannot be masked off so another may be requested, lengthening the total time.

  6. Latencies caused by the RTOS:
    A RTOS also needs to temporarily disable the interrupts which can call API-functions. Some RTOSs disable all interrupts, effectively worsening interrupt latencies for all interrupts, some (like embOS from Segger) disable only low-priority interrupts.


ARM7 and ARM Cortex

The ARM7 and ARM Cortex are very different in the interrupt area. By integrating the interrupt controller in the processor, Cortex-M3 processor-based microcontrollers have one interrupt vector entry and interrupt handler per interrupt source. This avoids the need for re-entrant interrupt handlers, which have a negative effect on interrupt latency.

 ARM7TDMICortex-M3
Interrupt controllerExternal to processorIntegrated nested vectored interrupt controller
Interrupt handlersOne fast (nFIQ) and one slow (nIRQ)One handler per interrupt source
RTOS system timerUses one timer of the microcontrollerUses integrated "SysTick" timer on the processor
System callsSWI instruction (interrupts disabled)SVC instruction (interrupts enabled)
Memory interfaceSingle interface, data read/write takes 3 cyclesSeparate instruction and data bus interfaces, single cycle data read/write
PipelineThree-stageThree-stage with branch speculation
Bit manipulationRead, modify, writeSingle instruction

The Cortex-M3 also accelerates the execution of interrupt handlers with logic to automatically save its general purpose and status registers in the stack when an interrupt arrives. The M3 is made even more efficient, in certain circumstances, by tail-chaining interrupts that arrive at the same time, as shown in Figure 1.

The interrupt latency is up to 12 cycles for the Cortex-M3 processor-based MCU, and the context switch time is<4 μs, while the ARM7 is <7 μs.

Tail-chaining

Figure 1: Tail-chaining on Cortex-M3 processor speeds up things.


Microchip

According to Keith Curtis, technical staff engineer at Microchip, the 8-bit PIC-16/PIC-18 MCUs take 12 to 20 clock cycles to get to the ISR — depending on the type of instruction that was in progress at interrupt time. Then, in the ISR, the compiler will add instructions to determine where the interrupt originated and to push some registers. If you are using assembly language, you would put in your own items that need pushing, perhaps none.

Microchip's 32-bit PIC32 MCUs, according to Adrian Aur, applications engineer, will take a maximum of 11 clock cycles to get to the ISR where you will save at least some registers — worst case, all 32 of them need one clock cycle each. If you are responding to INT7, the highest priority (and not interruptible), a set of shadow registers will be used, making response much faster. Then, the RTOS may want to make a thread change, or enable nested interrupts when running at lower priority levels, which will add some latency. Other than that, you should be fine

Atmel

In 2008, Electronic Products Magazine gave Atmel a Product of the Year Award for the AVR XMEGA microcontroller family. The biggest reason for that was its innovative eight-channel event system which enables inter-peripheral communication without CPU or DMA usage using a bus separate from the data bus. The benefit of this is predictable, low-latency, inter-peripheral signal communication, reduced CPU usage, and the freeing of interrupt resources.

Independent of the CPU and DMA, the response time for the event system will never be more than two clock cycles of the I/O clock (usually 62.5 ns).

The XMEGA uses a Harvard architecture with the program memory separate from data. Program memory is accessed with single level pipelining. While one instruction is being executed, the next is prefetched. Performance is enhanced with the fast-access RISC register file — 32 x 8-bit general-purpose working registers. Within one single clock cycle, XMEGA can feed two arbitrary registers from the register file to the ALU, do a requested operation, and write back the result to an arbitrary register.

The interrupt response time for all the enabled interrupts is a minimum of five CPU clock cycles. During these five clock cycles, the program counter is pushed on the stack. After five clock cycles, the program vector for the interrupt is executed. The jump to the interrupt handler takes three clock cycles.

If an interrupt occurs during execution of a multicycle instruction, this instruction is completed before the interrupt is served. If an interrupt occurs when the device is in sleep mode, the interrupt execution response time is increased by five clock cycles. In addition, the response time is increased by the start-up time from the selected sleep mode.

A return from an interrupt-handling routine takes five clock cycles. During these five clock cycles, the program counter is popped from the stack and the stack pointer is incremented.

下一篇: PLC、DCS、FCS三大控

上一篇: Low-Power, Long Rang

推薦產品

更多
中文字幕第二一区_久久久久在线视频_精品国产自在现线看久久_亚洲精品一区二区三区电影网

      9000px;">

          国产精品18久久久久久久网站| 国产午夜亚洲精品不卡| 欧美一a一片一级一片| 91精品国产91久久久久久最新毛片 | 91精品国产日韩91久久久久久| 精品盗摄一区二区三区| 视频一区二区欧美| 色综合久久六月婷婷中文字幕| 国产三级精品在线| 国产精品一二一区| 精品国产污污免费网站入口| 日本不卡不码高清免费观看| 欧美性猛交xxxx乱大交退制版| 国产精品短视频| 成人av中文字幕| 激情综合一区二区三区| 久久综合色婷婷| 国产酒店精品激情| 国产欧美日韩中文久久| 99re热这里只有精品视频| 天堂在线一区二区| 精品国精品国产尤物美女| 捆绑变态av一区二区三区| 91色综合久久久久婷婷| 一区二区在线免费观看| 欧美视频一区在线观看| 亚洲bt欧美bt精品777| 91在线精品一区二区| 亚洲精品国产成人久久av盗摄| 日本道色综合久久| 成人午夜免费电影| 精品系列免费在线观看| 亚洲综合在线观看视频| 久久久久国产一区二区三区四区 | 在线观看91视频| 懂色av中文字幕一区二区三区| 奇米在线7777在线精品| 一区精品在线播放| 欧美日韩精品一区二区| 免费看欧美美女黄的网站| 91免费看片在线观看| 国产精品美女久久久久aⅴ国产馆| 久久精品久久99精品久久| 国产高清一区日本| 日韩一级免费观看| 亚洲电影在线免费观看| 免费精品视频在线| 亚洲视频香蕉人妖| 不卡在线观看av| 亚洲欧美激情视频在线观看一区二区三区| 蜜臂av日日欢夜夜爽一区| 成人短视频下载| 成人h精品动漫一区二区三区| 91国产免费看| 中文字幕在线不卡一区| 国产iv一区二区三区| 中文字幕一区二区三区视频| 一本大道久久a久久综合| 91麻豆自制传媒国产之光| 丁香桃色午夜亚洲一区二区三区| 国产成人自拍网| 亚洲乱码国产乱码精品精的特点| 日韩欧美在线1卡| 色欧美日韩亚洲| 欧美午夜影院一区| 91麻豆免费看片| 色综合天天狠狠| 欧美日韩精品三区| 91日韩一区二区三区| 97久久超碰精品国产| 波多野结衣中文字幕一区二区三区 | 99re这里只有精品首页| 成人丝袜高跟foot| 国产亚洲一区二区三区四区| 天天综合网天天综合色| 欧美中文字幕亚洲一区二区va在线| 精品第一国产综合精品aⅴ| 精品日韩成人av| 亚洲成a人在线观看| 国产精品一区专区| 欧美手机在线视频| 久久丝袜美腿综合| 亚洲观看高清完整版在线观看 | 久久伊人蜜桃av一区二区| 国产精品三级电影| 亚洲线精品一区二区三区| 老司机免费视频一区二区| 色视频一区二区| 色综合久久综合网97色综合| 久久久久久久久久美女| 青青草原综合久久大伊人精品| 在线亚洲免费视频| 国产精品少妇自拍| 成人av免费在线| 国产清纯在线一区二区www| 亚洲最快最全在线视频| 欧美日韩在线三区| 亚洲欧美一区二区三区国产精品| 成人app在线观看| 日韩欧美www| 国产在线日韩欧美| 中文天堂在线一区| 成人网男人的天堂| 中文字幕一区在线| 99精品视频中文字幕| 亚洲精品亚洲人成人网| 99精品欧美一区二区三区综合在线| 国产欧美日韩卡一| 国产精品乡下勾搭老头1| 欧美国产日韩精品免费观看| 96av麻豆蜜桃一区二区| 综合精品久久久| 欧美美女一区二区在线观看| 精彩视频一区二区三区| 日韩美女精品在线| 精品女同一区二区| 91传媒视频在线播放| 久久精品国产免费| 亚洲国产精品久久人人爱蜜臀| 日韩欧美电影在线| 69p69国产精品| 91丨porny丨户外露出| 激情五月婷婷综合| 日韩精品电影一区亚洲| 中文字幕国产精品一区二区| 在线观看日产精品| 成人午夜电影小说| 久久国产精品区| 免费成人深夜小野草| 亚洲图片有声小说| 日韩理论在线观看| 亚洲日本韩国一区| 亚洲一区中文日韩| 午夜免费欧美电影| 美女视频黄久久| 成人性生交大片免费看视频在线 | 成人高清av在线| 95精品视频在线| 色香蕉成人二区免费| 欧美在线观看视频一区二区| 欧美综合一区二区| 欧美日韩在线播放一区| 日韩亚洲欧美高清| 国产精品天干天干在观线| 日韩一区日韩二区| 免费看黄色91| 99免费精品在线观看| 91影视在线播放| 欧美日韩一区二区三区视频| 欧美午夜精品免费| 国产日韩欧美在线一区| 亚洲欧美福利一区二区| 一区二区三区鲁丝不卡| 国产麻豆欧美日韩一区| 色呦呦一区二区三区| 日韩精品中文字幕在线一区| 国产精品乱码一区二区三区软件| 婷婷综合在线观看| 日韩一区二区中文字幕| 视频一区在线播放| 欧美成人三级在线| 美女免费视频一区二区| 欧美丰满美乳xxx高潮www| 久久精品国产免费看久久精品| 一本久道久久综合中文字幕 | 亚洲不卡一区二区三区| 国产不卡高清在线观看视频| 日韩一区二区免费在线电影| 天天影视涩香欲综合网| 欧美日韩国产另类一区| 亚洲成人在线观看视频| 91精品婷婷国产综合久久性色| 天堂一区二区在线免费观看| 欧美精品一二三四| 狠狠狠色丁香婷婷综合久久五月| 欧美一级日韩一级| 精品一区二区三区免费| 精品毛片乱码1区2区3区 | 91精品国产综合久久精品| 国产米奇在线777精品观看| 国产亚洲精品7777| 精品久久国产老人久久综合| av欧美精品.com| 狠狠色丁香婷婷综合| 亚洲欧美一区二区三区久本道91| 欧洲另类一二三四区| 九九在线精品视频| 亚洲欧美日韩人成在线播放| 欧美性色黄大片| 91在线观看美女| 国产在线不卡视频| 麻豆成人在线观看| 一区二区三区精品| 国产精品激情偷乱一区二区∴| 正在播放一区二区| 亚洲精品在线观看网站| 日韩欧美在线网站| 日韩精品一区二区三区视频在线观看| 国产精品一区二区久激情瑜伽| 午夜伦欧美伦电影理论片|