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.

[参考译文] MSP432E401Y:开发套件,TI 蓝垫。

Guru**** 2539500 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1070405/msp432e401y-development-kit-ti-lanchpad

部件号:MSP432E401Y
“线程:测试”中讨论的其它部件

大家好,团队

客户提出的问题可能需要您的帮助:

客户已检查这2个文件:

https://dev.ti.com/tirex/explore/node?node=AOD4LXqFA8XEr21FehvtQA__J4.hfJy__LATEST

https://dev.ti.com/tirex/explore/node?node=AEFKJ9Hm67JXdj9NzpSYFA__J4.hfJy__LATEST&search=432E

并从《技术参考手册》中获得相关说明:

问题在于:重新加注时无法自行设置加注模式。

一些相关信息供参考:

A. 可将倒计数模式设置为10000到0。

B.  代码如下所示。 只需将97行的 TIMER CFG _B_REALARY_TIMER 更改为 TIMER CFG _B_REAL式_UP,并将105行的数据更改为10000,即可轻松观察 LED 的闪烁频率。

/* --COPYRIGHT--,BSD
 * Copyright (c) 2017, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --/COPYRIGHT--*/
/******************************************************************************
 * MSP432E4 Example project for Configuring a timer in 16-bit periodic mode
 *
 * Description: In this example, the timer is configured to generate an
 * interrupt every 0.1 sec in 16-bit periodic mode. On the interrupt the state
 * of the LED D2
 *
 *                MSP432E401Y
 *             ------------------
 *         /|\|                  |
 *          | |                  |
 *          --|RST               |
 *            |                  |
 *            |               PN0|-->LED
 *            |                  |
 *            |                  |
 *            |                  |
 * Author: Amit Ashara
*******************************************************************************/
/* DriverLib Includes */
#include <ti/devices/msp432e4/driverlib/driverlib.h>

/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>

void TIMER2B_IRQHandler(void)
{
    uint32_t getTimerInterrupt;

    /* Get timer interrupt status  and clear the same */
    getTimerInterrupt = MAP_TimerIntStatus(TIMER2_BASE, true);
    MAP_TimerIntClear(TIMER2_BASE, getTimerInterrupt);

    /* Toggle the LED */
    MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0,
                     ~(MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_0)));
}

int main(void)
{
    uint32_t systemClock;

    /* Configure the system clock for 120 MHz */
    systemClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
                                          SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),
                                          120000000);

    /* Enable the clock to the GPIO Port N and wait for it to be ready */
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
    while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)))
    {
    }

    /* Configure the GPIO PN0 as output and put in low state */
    MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
    MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, ~(GPIO_PIN_0));

    /* Enable the Timer-0 in 16-bit periodic mode with interrupt generated
     * every 0.1 sec */
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
    while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER2)))
    {
    }

    MAP_TimerConfigure(TIMER2_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PERIODIC_UP);
    MAP_TimerIntEnable(TIMER2_BASE, TIMER_TIMB_TIMEOUT);

    /* Since the 16-bit timer can count only 65536 value, we use the pre
     * scaler of 256 to divide down the count rate by 256. Thus the actual
     * count load is 120e6/256 = 468750. Now when to count at 0.1 sec the
     * load value in the timer would be 468750 * 0.1 = 46875 = 0xB71B. */
    MAP_TimerPrescaleSet(TIMER2_BASE, TIMER_B, 255);
    MAP_TimerLoadSet(TIMER2_BASE, TIMER_B, 10000);

    /* Enable Timer Interrupt */
    MAP_IntEnable(INT_TIMER2B);

    /* Enable the timer count */
    MAP_TimerEnable(TIMER2_BASE, TIMER_B);

    while(1)
    {
    }
}

C. 在运行时可以看到上面修改的代码。 当97行参数为 TIMEER_CFG_B_REARISTERY_UP 时,指示灯将快速闪烁,而当它是 TIMEER_CFG_B_B_REPORTY_UP 时,指示灯将不会闪烁。 这不是一个0-10000上下计数,它被称为0-65535。

D.  删除104行且未执行除法时,C 中将不会出现错误。

请帮您检查此案例? 谢谢。

此致,

樱桃

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

    你(们)好

    GPTIM 支持计数上升/下降。 该值通过 GPMTnPR 寄存器设置。  请参阅用户指南。  

    GPMTBMR 寄存器可以配置何时更新超时值

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

    你好,艾伦,

    他们配置了这样的配置,但它不起作用。

    此致,

    樱桃

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

    你好,Cherry,

    我对计时器做了很多测试。 在倒计时模式下,时间间隔是预计算器的 TIMER TBILR 值*。 当我更改 TIMER TBILR 值或预分频器时,周期将相应地更改 。 但在计数上升模式下,只有当预计算器=0时,时间间隔才会与 Time_TBILR 值成比例变化。 当 TIMER 不是0时,间隔看起来像65535×预先计算器+ TIMER TBILR。

    我不清楚为什么它会如此。 它需要一些时间来了解。

    客户可以使用停机模式作为解决方案。  对于最终实现的功能,向上和向下模式之间没有差异。

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

    你好,艾伦,

    谢谢,期待您的更新。

    此致,

    樱桃

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

    你好,Cherry,

    《技术参考手册》18.3中有相关说明。 随着倒计时模式预计算器充当真正的分隔符。 但在计数模式下,它是一个分机,而不是  

    真正的预分频器。 这就是为什么点点算/点算有不同的行为。