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.

[参考译文] F28M36P63C2:从主应用程序读取或写入 CPUTimer0.InterruptCount 时出现问题。

Guru**** 2538955 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/600125/f28m36p63c2-problem-with-reading-or-writing-cputimer0-interruptcount-from-main-application

器件型号:F28M36P63C2

尊敬的 TI 员工:

我遇到了一个奇怪的问题。 当我想从主应用程序中读取 CPUTimer0.InterruptCount 时、寄存器停止更新、ISR 不再启动。 不过、RegsAdrr 中的值仍在更新。 在我的情况下,我一直停留在 delayus()的 while 循环中。 另外、当我尝试从主应用程序设置 CPUTimer0.InterruptCount=0时、也会遇到同样的问题。

感谢您的帮助!

systemControlError_t ConfigureAndStartCPUTimer0 (常量浮点周期){
   if (period <= 0.0) return bad_input_argument;

   enableCPUTimer0Clock();
   ConfigCpuTimer (&CpuTimer0、system_frequency、period);
   StartCpuTimer0();

   返回 SYS_CTL_NO_ERROR;

中断空 cpuTimer0ISR (空){
   CpuTimer0.InterruptCount++;
   //确认此中断以从组1接收更多中断
   PieCtrlRegs.PIEACX.ALL = PIEACK_Group1;


void InitializeDS28EC20 (void){
   InitializeChecksum ();
   EALLOW;
   GpioCtrlRegs.GPBMUX1.bit.GPIO45 = 0;//将 PIN 设置为单线 PIN 的 GPIO
   GpioCtrlRegs.GPBDIR.bit.GPIO45 = 1;//设置方向1=out 0=in
   EDIS;
   GpioDataRegs.GPBSET.BIO45 = 1;//初始化引脚

   EALLOW;
   PieVectTable.TINT0 =&cpuTimer0ISR;
   EDIS;

   ConfigureAndStartCPUTimer0 (CPU_TIMER_0_PERIOD_US);//CpuTimer0在每个 CPU_TIMER_0_PERIOD 发生中断

   //在 PIE 中启用 TINT0:组1中断7
   IER |= M_INT1;
   PieCtrlRegs.PIEIER1.bit.INTx7=1;

空 delayU (const uint32_t delayU){
   uint32_t tic = CpuTimer0.InterruptCount;
   while (((CpuTimer0.InterruptCount - tic)< delayU);

内联 void writeOne (void){
   setBusLow();
   delayU(5);// Tw1l
   releaseBus();
   delayU (60);//Tslot 应至少为65us (60+5)

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

    问题来自代码中的其他地方 您可以删除此帖子。