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.

[参考译文] TMS570LC4357:有关速度传感器频率测量的 ECAP 捕获寄存器值错误的查询

Guru**** 2551110 points
Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1543344/tms570lc4357-query-regarding-incorrect-ecap-capture-register-values-for-speed-sensor-frequency-measurement

器件型号:TMS570LC4357
主题中讨论的其他器件: HALCOGEN

工具/软件:

我正在使用处理一个项目 TMS570LC4357 微控制器并尝试捕获 来自速度传感器的方波信号的频率 。 为此、我配置了 eCAP1 ECAP4 指定 中断模式

不过、 捕获的寄存器值看起来不正确或不一致 连接到驱动器。 我怀疑配置或读取值的方式可能存在问题。

我已附上:

  • 屏幕截图 HALCoGen ECAP 配置的实现

  • 代码片段 用于初始化 ECAP 和从中读取

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

    尊敬的 Prassana:

    请使用以下配置来生成 ECAP 初始化代码:

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

    void ecapNotification(ecapbase_t *ECAP、uint16 标志)

      Uint32 cap1、CAP2、cap3;
      float64 占空比、周期;

      CAP1 = ecapGetCAP1 (ecapREG1);
      CAP2 = ecapGetCAP2 (ecapREG1);
      CAP3 = ecapGetCAP3 (ecapREG1);

      占空比=(CAP2 - cap1)* 1000/CLK_FREQ;
      PERIOD =(cap3 - cap1)* 1000/CLK_FREQ;

      SPEED =  CLK_FREQ /(1000*(cap3-cap1));

    }