Hi,
I wanted to test the P1.4 which is UCA0TXD in the MSP430FR2422 which is connected with the external UART using which i check the output on UART serial port . I tried with uint8_t data and it is happening but now I wanted to have the hello World try but is not happening as the char and uint8_t data type are different and conversion is not supported . SO can anyone help me in this code and tried me to print Hello World on UART.
#include "driverlib.h"
//#include "Board.h"
#define GPIO_PORT_UCA0TXD GPIO_PORT_P1
#define GPIO_PIN_UCA0TXD GPIO_PIN4
#define GPIO_FUNCTION_UCA0TXD GPIO_PRIMARY_MODULE_FUNCTION
#define GPIO_PORT_UCA0RXD GPIO_PORT_P1
#define GPIO_PIN_UCA0RXD GPIO_PIN5
#define GPIO_FUNCTION_UCA0RXD GPIO_PRIMARY_MODULE_FUNCTION
uint16_t i;
unsigned long int m=0;
uint8_t RXData = 0;
unsigned long int TXData = 10;
uint8_t check = 0;
char mystr[49]="1219";
void main(void)
{
//Stop Watchdog Timer
WDT_A_hold(WDT_A_BASE);
SYSCFG3 &= ~USCIARMP;
// *ptr = mystr;
//Set ACLK = REFOCLK with clock divider of 1
CS_initClockSignal(CS_ACLK,CS_REFOCLK_SELECT,CS_CLOCK_DIVIDER_1);
//Set SMCLK = DCO with frequency divider of 1
CS_initClockSignal(CS_SMCLK,CS_DCOCLKDIV_SELECT,CS_CLOCK_DIVIDER_1);
//Set MCLK = DCO with frequency divider of 1
CS_initClockSignal(CS_MCLK,CS_DCOCLKDIV_SELECT,CS_CLOCK_DIVIDER_1);
//Configure UART pins
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_UCA0TXD,
GPIO_PIN_UCA0TXD,
GPIO_FUNCTION_UCA0TXD
);
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_UCA0RXD,
GPIO_PIN_UCA0RXD,
GPIO_FUNCTION_UCA0RXD
);
/*
* 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_SMCLK;
param.clockPrescalar = 8;
param.firstModReg = 0;
param.secondModReg = 0xD6;
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, ¶m)) {
return;
}
EUSCI_A_UART_enable(EUSCI_A0_BASE);
//EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE,
// EUSCI_A_UART_RECEIVE_INTERRUPT);
// Enable USCI_A0 RX interrupt
// EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE,
// EUSCI_A_UART_RECEIVE_INTERRUPT);
// Enable global interrupts
//__enable_interrupt();
while (1)
{
// Increment TX data
// Load data onto buffer
EUSCI_A_UART_transmitData(EUSCI_A0_BASE,mystr);// here mystr takes input as uint8_t
for(m=0;m<10000;m++);
// while(check != 1);
//check = 0;
}