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.

[参考译文] TM4C129CNCZAD:中断不工作

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/984411/tm4c129cnczad-interuupt-not-working

器件型号:TM4C129CNCZAD

尊敬的先生:

我们正在从 Stellaris LM3S9B96迁移到 TM4C129XCNZAD。

ROM.h 也进行了修改、因为文件下面缺少定义

#if defined (target_in_blizzard_RA1)||\
已定义(target_in_blizzard_RA3)||\
已定义(target_in_blizzard_RB1)||\
已定义(TARGET_IS _雪花_RA0)
#define ROM_GPIOPinIntEnable \
((void (*)(uint32_t ui32Port、\
uint8_t ui8引脚) rom_gpioTABLE[7])
#endif

#if defined (target_in_blizzard_RA1)||\
已定义(target_in_blizzard_RA3)||\
已定义(target_in_blizzard_RB1)||\
已定义(TARGET_IS _雪花_RA0)
#define ROM_GPIOPinIntDisable \
((void (*)(uint32_t ui32Port、\
uint8_t ui8引脚) rom_gpioTABLE[8])
#endif

#if defined (target_in_blizzard_RA1)||\
已定义(target_in_blizzard_RA3)||\
已定义(target_in_blizzard_RB1)||\
已定义(TARGET_IS _雪花_RA0)
#define ROM_GPIOPinIntStatus \
((long (*)(uint32_t ulPort、\
bool bMsed)) ROM_GPIOTABLE[9])
#endif

#if defined (target_in_blizzard_RA1)||\
已定义(target_in_blizzard_RA3)||\
已定义(target_in_blizzard_RB1)||\
已定义(TARGET_IS _雪花_RA0)
#define ROM_GPIOPinIntClear \
((void (*)(uint32_t ui32Port、\
uint8_t ui8引脚) rom_gpioTABLE[10])
#endif

 

我们将 引脚6配置为外部中断、但程序在执行"ROM_GPIOPinIntEnable (GPIO_PORTM_BASE、GPIO_PIN_6);"和 ROM_GPIOPinIntDisable 后卡住。

我在两 种不同的情况下使用了此命令、并得出结论、在启用程序卡滞和禁用它之后、它可以正常工作。

Stellaris LM3S9B96也是如此。 什么是问题?

以下是步骤

SysCtlPeripheralEnable (SYSCTL_Periph_GPIOM);//启用所用端口引脚的 GPIO 块。
ROM_GPIOPinTypeGPIOInput (GPIO_PORTM_BASE、GPIO_PIN_6);//外部中断引脚

ROM_IntMasterEnable();


ROM_GPIOIntTypeSet (GPIO_PORTM_BASE、GPIO_PIN_6、GPIO_FALLING_EDGE);//为引脚设置中断类型
ROM_GPIOPinIntEnable (GPIO_PORTM_BASE、GPIO_PIN_6);//启用单个引脚感应中断
ROM_IntEnable (INT_GPIOM);

完成任务后

ROM_GPIOPinIntDisable (GPIO_PORTM_BASE、GPIO_PIN_6);//禁用单个引脚感应中断
ROM_IntDisable (INT_GPIOM);

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

    切勿修改 rom.h 文件。 该文件描述了器件的内部 ROM 功能。 如果基于 ROM 的函数中存在错误、该函数将从 rom.h 文件中删除。 应改为使用该文件的当前驱动程序库版本。 如果可用、使用 map_prefix 而不是 ROM_prefix 将自动使用函数的 ROM 版本。 如果不可用、将使用库版本。

    在您的情况下、由于 GPIO 中断的附加功能、该函数被完全替换。 您需要的函数是 ROM_GPIOIntEnable()(请注意,从名称中删除了“Pin”。 请参阅 SW-TM4C-DRL-UG.2.2.0.295.pdf中对此函数的说明。