Yes, yet another UART setup question...
I have the standard EXP430FR5969 LaunchPad; I'm trying to get it to communicate with the host PC via the standard built-in LaunchPad UART. I'm finding that it's behaving as if it's sending correctly but I never receive any output.
My code's attached below. As you can see it's not exactly complicated.
Given that I'm intending to do polling rather than interrupt driven handling, I'm uncertain as to whether I need to enable the RX and TX interrupts in UCA0IE, but I've tried it both ways and neither work. I can single step through the code and it thinks everything's fine; the bits in UCA0IFG get set in all the right places...
I'm on a Linux platform and am connecting a serial terminal to the second tty port that shows up when the LaunchPad is connected at 9600 baud.
Is there anything obvious I'm missing?
My code is:
__main:
; Disable watchdog timer.
mov.w #(WDTPW | WDTHOLD), &WDTCTL
mov.w #CSKEY, &CSCTL0 ; Unlock clock registers
mov.w #DCOFSEL_3 | DCORSEL, &CSCTL1 ; DCO to 8MHz
; ACLK = VLO; SMCLK = MCLK = DCO
mov.w #(SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK), &CSCTL2
; Connect pins 2.0 and 2.1 to the UART.
bis.w #(BIT0 | BIT1), &P2SEL1
bic.w #(BIT0 | BIT1), &P2SEL0
bic.w #LOCKLPM5, &PM5CTL0 ; Disable high-impedance
mov.w #UCSWRST, &UCA0CTL0 ; Reset UART to 8n1
bis.w #UCSSEL__SMCLK, &UCA0CTL0 ; CLK = SMCLK (8MHz)
; The values below are simply looked up in table 21-5 on page 562 of
; the manual; 9600 baud at 8MHz:
; UCOS16=1 UCBRx=52 UCBRFx=1 UCBRSx=0x49
mov.w #52, &UCA0BR0 ; aka UCBRx
mov.w #(UCOS16 | (1<<4) | (0x49<<8)), &UCA0MCTLW ; UCOS16, UCBRFx, UCBRSx
bic.w #(UCTXIE | UCRXIE), &UCA0IE ; Disable RX/TX interrupts
bic.w #UCSWRST, &UCA0CTL0 ; Unreset UART
; Start emitting alternate @ and A characters.
mov #65, r12
2:
xor #1, r12
1:
bit.w #UCTXIFG, &UCA0IFG ; Wait until ready to transmit
jz 1b
mov.b r12, &UCA0TXBUF ; Transmit
jmp 2b