Im trying to communicate with my EXP430F5529 LP over backchannel UART (UCA1). The transmission from MSP to PC is working fine - it gets displayed in the Putty terminal. However, when I write a character in Putty, the UCRXIFG gets never set (when I halt the program with debugger, I can see it is stuck inside USCI_A_UART_receiveData polling for the UCRXIFG flag) - see the source code below.
SMCLK set to 1MHz, baudrate 9600
Im using MSPWare 1.90 Driverlib. Here is my source code:
void initClocks(uint32_t mclkFreq) { // Assign the REFO as the FLL reference clock UCS_clockSignalInit( UCS_FLLREF, UCS_REFOCLK_SELECT, UCS_CLOCK_DIVIDER_1); // Assign the REFO as the source for ACLK UCS_clockSignalInit( UCS_ACLK, UCS_REFOCLK_SELECT, UCS_CLOCK_DIVIDER_1); UCS_initFLLSettle( mclkFreq/1000, mclkFreq/32768); //use REFO for FLL and ACLK UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (SELREF__REFOCLK); UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (SELA__REFOCLK); } void transmitBytes(uint8_t* bytes,uint8_t size) { for (uint8_t i = 0;i < size;++i) { USCI_A_UART_transmitData(USCI_A1_BASE,bytes[i]); } } int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; // Set clock to 1MHz initClocks(1000000); // Set LED and blink setupLEDs(); blinkLED1(2); // Setup pins GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P4, GPIO_PIN4 + GPIO_PIN5 ); // Initialize UART (baudrate 9600) USCI_A_UART_initAdvance(USCI_A1_BASE,USCI_A_UART_CLOCKSOURCE_SMCLK, 104,0,1, USCI_A_UART_NO_PARITY, USCI_A_UART_LSB_FIRST,USCI_A_UART_ONE_STOP_BIT, USCI_A_UART_MODE, USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION); USCI_A_UART_enable(USCI_A1_BASE); uint8_t hello[6] = {'M','S','P','4','3','0'}; transmitBytes(hello,6); while (1) { // Wait for incoming byte uint8_t recv = USCI_A_UART_receiveData(USCI_A1_BASE); blinkLED2(2); // Blink led when data is received // Perform the received command if (recv == 'A') { blinkLED1(5); } else if (recv == 'B') { blinkLED2(5); } else if (recv == 'C') { uint8_t hello[6] = {'H','E','L','L','O','!'}; transmitBytes(hello,6); } else if (recv == 'Q') { break; } } // Close UART peripheral USCI_A_UART_disable(USCI_A1_BASE); return 0; }
Im running Windows 7 with IAR. Of course, I set 9600 baudrate, stop bits, no parity, etc. in putty accordingly.
Also the RXD and TXD jumpers on my LaunchPad are in place.
Thanks for any hints!