Analog.com Analog Dialogue Wiki English
Analog.com Analog Dialogue Wiki 简体中文
EngineerZone
EngineerZone
  • Site
  • User
  • Site
  • Search
  • User
EngineerZone
EngineerZone
  • Log in
  • Site
  • Search
  • Log in
  • Home
  • Blogs ⌵
    • EngineerZone Spotlight
    • The Engineering Mind
  • Browse ⌵
    • All Groups
    • All Members
  • Support ⌵
    • 3D ToF Depth Sensing
    • Amplifiers
    • Analog Microcontrollers
    • Audio
    • Clock and Timing
    • Data Converters
    • Design Tools and Calculators
    • Direct Digital Synthesis (DDS)
    • Embedded Vision Sensing
    • Energy Monitoring and Metering
    • FPGA Reference Designs
    • Industrial Ethernet
    • Interface and Isolation
    • Low Power RF Transceivers
    • MEMS Inertial Sensors
    • Motor Control Hardware Platforms
    • Optical Sensing
    • Power By Linear
    • Processors and DSP
    • Reference Circuits
    • RF and Microwave
    • Switches/Multiplexers
    • Temperature Sensors
    • Video
    • Wide Band RF Transceivers
    • Wireless Sensor Networks Reference Library
  • My EZ
  • More
  • Cancel
  • 主页
  • 浏览 ⌵
    • 收件箱
    • 个人设置
    • 会员
    • 专区列表
  • 论坛专区 ⌵
    • 放大器专区
    • 精密转换器专区
    • 音频专区
    • ADE电能计量专区
    • MEMS和传感器专区
    • 接口和隔离专区
    • Power 中文专区
    • ADUC微处理器专区
    • 锁相环专区
    • 开关和多路复用器专区
    • 温度传感器
    • 基准电压源专区
    • 资源库
    • 论坛使用指南
    • 技术支持参考库
    • 在线研讨会
    • 论坛社群活动
    • 论坛激励活动
  • More
  • Cancel
Motor Control Hardware Platforms
Motor Control Hardware Platforms
Documents Double Execution of Interrupt
  • Q&A
  • Discussions
  • Documents
  • File Uploads
  • Video/Images
  • Tags
  • Managers
  • More
  • Cancel
  • New
Motor Control Hardware Platforms requires membership for participation - click to join
  • Documents
  • +Code Examples
  • Comparing SAR to SINC performance using ADIMonitor
  • Double Execution of Interrupt
  • Getting Started with the EV-MCS-ISOINV-Z Isolated Inverter Platform
  • Getting started with the EV-MCS-LVDRV-Z (LV FlexMC) motor control platform
  • High Precision PWM (HPPWM)
  • MOTOR CONTROL HARDWARE PLATFORMS
  • +Platform Schematics
  • What motor control system evaluation platforms are available from ADI?

Double Execution of Interrupt

CM40x has multiple clock domains/buses: AHB, PAB, APB, AXI. The necessary bus conversions add latency as MMR reads/writes traverse through the fabric (typically when a peripheral register is accessed from the core domain).  In other words, each MMR write would need to stall code execution until the operation made the round-trip through the fabric This can be over 10 SYSCLKs per write.

For most MMR writes however, it's acceptable to do the write and proceed code execution right away. There is no need to wait until the write has actually reached the peripheral. If this mode is acceptable CM40x supports "Posted Writes" which immediately acknowledge writes before the peripherals knows if they were successful. This brings down the latency considerably but is some cases it requires special attention from the programmer.

Consider an ISR with only a few instructions in it. For this example, we look at ISR for PWM0 SYNC but it applies to any interrupt:

void PWM0_SYNC_ISR(uint32_t iid, void* handlerArg){

  *pREG_PWM0_STAT = BITM_PWM_STAT_TMR0PER;

  *pREG_PWM0_ILAT = BITM_PWM_ILAT_TMR0PER;  

}

 

Here the ISR only contains a few instructions - clear of STAT and ILAT register. These writes has to transverse across clock domains and assuming Posted Writes is enabled, it means the clear of IALT has not taken effect before the end of the ISR. To the interrupt handler it appears like IALT is set again as soon as the ISR is exited, leading to a new execution of the interrupt - Double Execution. This is an unwanted consequence of using Posted Writes.

 

To avoid this, Posted Writes can be disabled. However, for the most part, Posted Writes is desirable and significantly improves code performance. Therefore, it is better to leave Posted Writes enabled and deal with the special cases.

 

Another work-around is to clear ILAT at the top of the ISR. If the ISR has several instructions in it, the execution time will allow for the write to go though before exiting the ISR.

In cases where the ISR only has a few instructions in it (like the example above), the programmer must take special care to make sure the write goes through. For that the assembler instructions sev and isb are helpful. This ensures synchronization across clock domains and flushes the pipeline to the processor.

With synchronization, the ISR looks like this:

void PWM0_SYNC_ISR(uint32_t iid, void* handlerArg){

  *pREG_PWM0_STAT = BITM_PWM_STAT_TMR0PER;

  *pREG_PWM0_ILAT = BITM_PWM_ILAT_TMR0PER;  

  asm("sev;isb;");

}

  • Share
  • History
  • More
  • Cancel
Comments
Anonymous
Related
 
社交网络
快速链接
  • 关于ADI
  • Partners
  • 模拟对话
  • 职业
  • 联系我们
  • 投资信息
  • 新闻中心
  • 质量和可靠性
  • 办事处与代理商
  • Analog Garage
语言
  • English
  • 简体中文
  • 日本語
  • Руccкий
电子快讯

欲获得最新ADI产品、设计工具、培训与活动的相关新闻与文章,请从我们的在线快讯中选出您感兴趣的产品类别,每月或每季度都会发送至您的收件箱。

订阅
Switch to mobile view
Analog Logo
© 1995 - 2021 Analog Devices, Inc. All Rights Reserved 沪ICP备09046653号-1
  • ©
  • 1995 - 2021 Analog Devices, Inc. All Rights Reserved
  • 沪ICP备09046653号-1
  • 网站地图
  • 隐私和保密政策
  • 隐私设置
  • 使用条款
 
Social
Quick Links
  • About ADI
  • Partners
  • Analog Dialogue
  • Careers
  • Contact us
  • Investor Relations
  • News Room
  • Quality & Reliability
  • Sales & Distribution
  • Analog Garage
Languages
  • English
  • 简体中文
  • 日本語
  • Руccкий
Newsletters

Interested in the latest news and articles about ADI products, design tools, training and events? Choose from one of our 12 newsletters that match your product area of interest, delivered monthly or quarterly to your inbox.

Sign Up
Switch to mobile view
Analog Logo
© 1995 - 2021 Analog Devices, Inc. All Rights Reserved 沪ICP备09046653号-1
  • ©
  • 1995 - 2021 Analog Devices, Inc. All Rights Reserved
  • 沪ICP备09046653号-1
  • Sitemap
  • Privacy & Security
  • Privacy Settings
  • Terms of use
EngineerZone Uses cookies to ensure you get the best experience in our community. For more information on cookies, please read our Privacy & Security Statement.