Other Parts Discussed in Thread: MSP430F5438, MAX232, MSP430F5438A
I'm trying to get started using the MSP430F5438, and I'm having some troubles.
One of the first things I need to do is get the chip communicating to me over RS232 via the UART. To try and get this off the ground, I downloaded the 5438 example code, and loaded it onto my 5438. Using the MSP-TS430PZ5x100 socket module, I hooked up a serial cable and connected it to my computer. However, I'm not seeing any of the signaling coming through on the line - when i disconnect the serial cable from the 5x100 board, I can see the characters on the oscilloscope, but when I re-connect, the line is held just above ground level, with no changes.
The code I'm using is as follows (straight out of the example code set):
//******************************************************************************
// MSP430F54x Demo - USCI_A0, 115200 UART Echo ISR, DCO SMCLK
//
// Description: Echo a received character, RX ISR used. Normal mode is LPM0.
// USCI_A0 RX interrupt triggers TX Echo.
// Baud rate divider with 1048576hz = 1048576/115200 = ~9.1 (009h|01h)
// ACLK = REFO = ~32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz
// See User Guide for baud rate divider table
//
// MSP430F5438
// -----------------
// /|\| |
// | | |
// --|RST |
// | |
// | P3.4/UCA0TXD|------------>
// | | 115200 - 8N1
// | P3.5/UCA0RXD|<------------
//
// M Smertneck / W. Goh
// Texas Instruments Inc.
// September 2008
// Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B
//******************************************************************************
#include "msp430x54x.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 9; // 1MHz 115200 (see User's Guide)
UCA0BR1 = 0; // 1MHz 115200
UCA0MCTL |= UCBRS_1 + UCBRF_0; // Modulation UCBRSx=1, UCBRFx=0
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
__no_operation(); // For debugger
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}
I'm running CCS 4.3, freshly downloaded.The code compiles fine, and appears to load onto the chip perfectly. In debug mode I can step through what little code there is, until it goes into low power mode.
I've attached wires to pins 37 (GND), 39 (TX) and 40 (RX) on the 5x100 board, with no other changes to the 5x100 board. I am powering via the JTAG connection over a MSP-FET430UIF, and I believe this is working, as CCS appears to load the code onto the chip without errors. I've tried swapping pins 39 & 40 to make sure I didn't get my RX/TX switched into the computer, with no changes.
The chip appear to be working - I've put it into the MSP430 experimenters board and loaded them with the User Experience code (same FET430UIF, so I know it's working as well), and it appears to work just fine - including UART functionality over USB. I'm happy to provide any other information that might be needed to help me out.
Thanks,
Ian