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.

MSP430FR2475: 串口无任何输出信号

Part Number: MSP430FR2475

Dear FAE,我在使用MSP430FR2475,发现根据库demo配置的串口无法正常输出,用示波器测量无任何信息,

如果配置成普通IO翻转则可以测量到电平变化,说明引脚没坏。外部主晶振32.768K

下面是配置文件:

#include "driverlib.h"
//******************************************************************************
//!
//!   Empty Project that includes driverlib
//!
//******************************************************************************
   
   
void main(void)
{
   // stop watchdog
    WDT_A_hold(WDT_A_BASE);

    GPIO_setAsPeripheralModuleFunctionInputPin(
        GPIO_PORT_P2,
        GPIO_PIN1 + GPIO_PIN0,
        GPIO_PRIMARY_MODULE_FUNCTION
        );

    //Set external clock frequency to 32.768 KHz
    CS_setExternalClockSource(32768);
    //Set ACLK=XT1
    CS_initClockSignal(CS_ACLK,CS_XT1CLK_SELECT,CS_CLOCK_DIVIDER_1);
    //Start XT1 with no time out
    CS_turnOnXT1(CS_XT1_DRIVE_1);
    //Set SMCLK = DCO with frequency divider of 1
    CS_initClockSignal(CS_SMCLK,CS_XT1CLK_SELECT,CS_CLOCK_DIVIDER_1);
    //Set MCLK = DCO with frequency divider of 1
    CS_initClockSignal(CS_MCLK,CS_XT1CLK_SELECT,CS_CLOCK_DIVIDER_1);

    // Configure UART pins
    //Set P1.0 and P1.1 as Secondary Module Function Input.
    /*

     * Select Port 1
     * Set Pin 0, 1 to input with function, (UCA0TXD/UCA0SIMO, UCA0RXD/UCA0SOMI).
     */
    GPIO_setAsPeripheralModuleFunctionInputPin(
        GPIO_PORT_P5,
        GPIO_PIN1 + GPIO_PIN2,
        GPIO_PRIMARY_MODULE_FUNCTION
        );

    /*
     * Disable the GPIO power-on default high-impedance mode to activate
     * previously configured port settings
     */
    PMM_unlockLPM5();

    //Configure UART
    //SMCLK = 1MHz, Baudrate = 115200
    //UCBRx = 8, UCBRFx = 0, UCBRSx = 0xD6, UCOS16 = 0
    EUSCI_A_UART_initParam param = {0};
    param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_ACLK;
    param.clockPrescalar = 3;
    param.firstModReg = 0;
    param.secondModReg = 146;
    param.parity = EUSCI_A_UART_NO_PARITY;
    param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
    param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
    param.uartMode = EUSCI_A_UART_MODE;
    param.overSampling = EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

    if(STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A0_BASE, &param))
    {
        return;
    }

    EUSCI_A_UART_enable(EUSCI_A0_BASE);

    
    while(1)
    {
        // Load data onto buffer
        EUSCI_A_UART_transmitData(EUSCI_A0_BASE, 'A');
        __delay_cycles(32768);
    }
}