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.

CCS/MSP430FR5848: msp430fr5848 / uart transmission problem

Part Number: MSP430FR5848

Tool/software: Code Composer Studio

Hi,

I'm using msp430fr5848 with cp2102.

I'm implementing the function of communicating with PC(pyserial) using ftdi.

[ msp430fr5848 p2.5(uart tx), p2.6(uart rx) → ftdi(cp2102) → pc(pyserial) ] 

The problem is when i send one byte(or more byte), 8th bit is always 1 at receiver side.

ex) msp430fr5848 send 0x01 --> pyserial receive 0x11

msp430fr5848 send 0x11 --> pyserial receive 0x91

Doess anyone experienced this kind of problem?

This is my code of msp430fr5848.

/*
 * uca1_UART.c
 *
 *  Created on: 2020. 7. 10.
 *      Author: youngjun
 */

#include "uca1_UART.h"

uint8_t RXData = 0, TXData = 0;

uint8_t initUart(void)
{
	// set gpio to uart module
	GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2, GPIO_PIN5 | GPIO_PIN6, GPIO_SECONDARY_MODULE_FUNCTION);

	// Configure UART
	EUSCI_A_UART_initParam param = { 0 };
	param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK;
	param.clockPrescalar = 16;
	param.firstModReg = 0;
	param.secondModReg = 0x00;
	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_A1_BASE, &param))
	{
		return 0;
	}

	EUSCI_A_UART_enable(EUSCI_A1_BASE);

	EUSCI_A_UART_clearInterrupt(EUSCI_A1_BASE, EUSCI_A_UART_TRANSMIT_INTERRUPT | EUSCI_A_UART_RECEIVE_INTERRUPT);
	EUSCI_A_UART_enableInterrupt(EUSCI_A1_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable interrupt
	EUSCI_A_UART_enableInterrupt(EUSCI_A1_BASE, EUSCI_A_UART_TRANSMIT_INTERRUPT);

	return 1;
}

uint8_t test = 0;
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{
	switch (UCA1IV)
	{
	case USCI_NONE:
		break;
	case USCI_UART_UCRXIFG:
		RXData = EUSCI_A_UART_receiveData(EUSCI_A1_BASE);

		break;
	case USCI_UART_UCTXIFG:
		EUSCI_A_UART_transmitData(EUSCI_A1_BASE, test++);
		//EUSCI_A_UART_transmitBreak(EUSCI_A1_BASE);
		if (test >= 255)
		{
			test = 0;
		}
		break;
	case USCI_UART_UCSTTIFG:
		break;
	case USCI_UART_UCTXCPTIFG:
		break;
	}
}

This is my code of pyserial

                self.serial_dev.port = port_info[KEY_DEV_PORT]  # port[0].device
                self.serial_dev.baudrate = 1000000
                self.serial_dev.timeout = 0
                self.serial_dev.parity = serial.PARITY_NONE
                self.serial_dev.stopbits =serial.STOPBITS_ONE
                self.serial_dev.rtscts =False
                self.serial_dev._xonxoff = False
                self.serial_dev.dsrdtr = False
                self.serial_dev.bytesize = serial.EIGHTBITS
                self.serial_dev.open()

Best regards,

Youngjun

**Attention** This is a public forum