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.

[参考译文] TM4C123 QEI0模块不工作

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1174682/tm4c123-qei0-module-not-working

主题中讨论的其他器件:TM4C123GH6PM

大家好、我使用的是 TM4C123GH6PM、我使用的是 QEI 模块。 使用示例代码 QEI1模块正在工作... 使用相同的代码、它不适用于 QEI0模块...任何建议...

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

    Anuprash、您好!

    您能否发布有效的 QEI1代码和无效的 QEI0代码、以便我对它们进行比较?

    此致、

    Ralph Jacobi

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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    FOR QEI1 MODULE TAKEN FROM THE EXAMPLE CODE OF CCS
    /* ----------------------- Include Files --------------------- */
    #include <stdint.h> // Library of Standard Integer Types
    #include <stdbool.h> // Library of Standard Boolean Types
    #include "inc/tm4c123gh6pm.h" // Definitions for interrupt and register assignments on Tiva C
    #include "inc/hw_memmap.h" // Macros defining the memory map of the Tiva C Series device
    #include "inc/hw_types.h" // Defines common types and macros
    #include "inc/hw_gpio.h" // Defines Macros for GPIO hardware
    #include "inc/hw_qei.h" // Macros used when accessing the QEI hardware
    #include "driverlib/debug.h" // Macros for assisting debug of the driver library
    #include "driverlib/sysctl.h" // Defines and macros for System Control API of DriverLib
    #include "driverlib/interrupt.h" // Defines and macros for NVIC Controller API of DriverLib
    #include "driverlib/gpio.h" // Defines and macros for GPIO API of DriverLib
    #include "driverlib/qei.h" // Prototypes for the Quadrature Encoder Driver
    #include "driverlib/pin_map.h" // Mapping of peripherals to pins for all parts
    #include "driverlib/rom.h" // Defines and macros for ROM API of driverLib
    #define VEL_INT_FREQ 10000 // Macro to store the Interrupt frequency of QEI1
    #define QEI1_PPR 4000 // Macro to store the PPR of the QEI1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [使用相同的代码引用 userid="541209" URL"~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1174682/tm4c123-qei0-module-not-working "]它不适用于 QEI0模块....任何建议...

    该代码具有以下配置 QEI0引脚的功能、其中包含对使用端口 C 和 D 的混合引用:

    Fullscreen
    1
    2
    3
    4
    // Configure the PC5, PC6 for QEI signals
    ROM_GPIOPinTypeQEI(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    ROM_GPIOPinConfigure(GPIO_PD6_PHA0);
    ROM_GPIOPinConfigure(GPIO_PD7_PHB0);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    假设您要对 PhA0使用 PD6、对 PhB0使用 PD7、则尝试将代码更改为:

    Fullscreen
    1
    2
    3
    4
    // Configure the PD6, PD7 for QEI signals
    ROM_GPIOPinTypeQEI(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    ROM_GPIOPinConfigure(GPIO_PD6_PHA0);
    ROM_GPIOPinConfigure(GPIO_PD7_PHB0);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    是否在启动文件中出现问题

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

    Anuprash、您好!

    很抱歉耽误了我的假期。

    您使用的 PD7是一个 NMI 引脚、默认情况下在器件上被锁定。 您将需要解锁引脚以将其配置为 QEI0操作。

    有关如何操作的详细信息、请参阅以下常见问题解答: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1020814/faq-how-to-get-locked-gpio-pins-on-tm4c123-devices-to-work

    除此之外、将您的代码与 Chester 观察到 的内容与 QEI0 GPIO 配置的 GPIO_PORTC_BASE 不正确进行比较、其他所有内容似乎都与转换保持一致。 我相信、一旦您添加解锁例程、您就会有一个可用的 QEI0外设。

    此致、

    Ralph Jacobi