Why does Tera Term return the Greek letter alpha when I send '!' to the MSP432 microcontroller?

207 Views Asked by At

I'm trying to learn how to use the microcontroller properly for a class and for some reason the terminal I'm using to communicate with the micro controller refuses to display the proper character and will also get stuck in the buffer loop.

```

```
#include "MSP.h"
#include <stdlib.h>
#include <stdio.h> 
#include <string.h>
    
    
int main()
{
EUSCI_A0->CTLW0 |= 0x01; //Resets UART module
EUSCI_A0-> MCTLW =0; //Error Baud
EUSCI_A0-> CTLW0 |= 0x80; //parity LSB first, 8 bit data, etc
EUSCI_A0-> BRW |= 0x4E;
P1->SEL0 |= 0x0C;
P1->SEL1 &=~0x0C;
EUSCI_A0-> CTLW0 &= ~0x01;

EUSCI_A0 -> TXBUF ='!';


while ((EUSCI_A0->IFG & 0x02)==0){

    //wait
}

while(1)
{
    //RUN Code Forever
}


}


````

```

Above is the code I used any help would be much appreciated as I need to understand what is causing this ASAP for a project

2

There are 2 best solutions below

0
On

Update to fix the problem in my specific case I went did the following Setup->Serial Port-> Speed 115200-> Speed 57600 Also changed EUSCI_A0->BRW |=0x4E to EUSCI_A0->BRW |=0x34

0
On

The reason is because of the baud rate:

  1. Baud Rate: The baud rate is a measure of how many signal changes (symbols) are transmitted per second. In digital systems, it often equates to the number of bits per second, especially when each symbol represents exactly one bit.

  2. The Value 0x34: This is a hexadecimal representation. The hexadecimal system (base 16) uses sixteen distinct symbols, 0-9 and A-F. Here, 0x34 in hexadecimal converts to 52 in decimal (4 + 3*16).

  3. Speed of the MSP432: The MSP432 is a microcontroller, and its speed is given as 3MHz, which is 3,000,000 Hertz (Hz). Hertz is a unit of frequency, and in this context, it refers to the number of clock cycles per second of the microcontroller.

  4. Calculating Baud Rate: The formula Baud = CLK / BRW is used here, where CLK is the clock speed of the microcontroller, and BRW is a divisor (Baud Rate Word). This divisor is used to scale down the clock speed to the desired baud rate.

    • CLK = 3,000,000 Hz
    • BRW = 52 (from the 0x34 hexadecimal value)

    So, Baud = 3,000,000 / 52 ≈ 57692. This is approximately 57600, which is a standard baud rate for serial communication.

This calculation shows how the baud rate is determined based on the clock speed of the microcontroller and a divisor value. The resulting baud rate of approximately 57600 is a common speed for serial communications, allowing for efficient data transfer without requiring an excessively high clock speed.