simple uart on MSP430f5438a

So to talk to your embedded system yo need an uart connection. This is the most simple and hence robust connection. Here the most simple configuration I could implement. So mainly with almost default settings. Here we start with short register reminder. I hate them :D.

RegisterFunction
WDTCTLWatch dog timer control
P5SELConfigure Port 5 pins to for uart tx/rx otherwise GPIO
UCA1CTL1Control serial com. e.g. clock selection
UCA1BR0/1Set Baud rate
UCA1MCTLSet modulation
UCA1IEInterrupt enable register
UCA1IFGInterrupt flag register. to detect whether transmit or receive is pending
UCTXIFGTransmit interrupt flag. UCTXIFG is set when UCxxTXBUF empty.
0b = No interrupt pending
1b = Interrupt pending

And here our small program:

Build, ship it to chip and start your picocom:

-$ msp430-elf-gcc -g -mmcu=msp430f5438a -o soft_uart soft_uart.c

-$ mspdebug tilib ‘prog soft_uart’

-$ sudo picocom -b 9600 /dev/ttyACM2

That is it.

Subscribe to get last updates.

×