This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS320F28388D:为什么 CM 在读取或写入 ESC 寄存器时应禁用全局中断?

Guru**** 2482225 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1450590/tms320f28388d-why-cm-should-disable-the-global-interrupt-when-reading-or-writing-the-esc-register

器件型号:TMS320F28388D

工具与软件:

最近、我发现在调试 UART 时数据偶尔会丢失。 后来、我发现这是因为在读取 ESC 寄存器时、通用中断被关闭了超过100微秒(通常只有大约1微秒)。 因此、无法及时触发 UART 中断、FIFO 已满、并且后续数据丢失。
我注意到其他厂家的芯片在读取 ESC 寄存器时并没有关闭中断。 为什么 CM 内核会在这些 API 中关闭全局中断?

另外、 当我删除关闭全局 中断的代码时、CM 变得不稳定、并且在运行时出现一些奇怪的行为。

例如:

ethercat_slave_cm_hal.c

//
//
// ESC_readBlock
//
//
void ESC_readBlock (ESCM_ADDR* pDatauint16_t 地址uint16_t len)
  //
  //禁用中断
  //
  //_disable_irq ();
  //
  //将 ESC 数据复制到缓冲区
  //
  ESC_readBlockISR (pDataaddresslen);

  //
  //启用中断
  //
  //_enable_irq ();
}
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    ESC_readBlock()函数用于禁用中断、ESC_readBlockISR()将保持启用中断。 软件用户指南 第7节 ESC HAL API 对此进行了介绍。

    此致!

    Kevin