|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
MSP430F1611 - UARTHi all,
I am trying to get the UART mode working. My setup is: - MSP-TS430PM64 (with the optional 32 kHz external crystal oscillator installed) - MPS-FET430UIF Debug-Interface - Code Composer Esentials 3 - a level converter for RS232 (http://www.tildesign.nl/rs232_ttl_converter-20107101P2N)) - and a one-to-one serial cable I am using the sample code from TI. However, I do get stuck in the do{}while loop of clearing OSCFault flag. Does anyone know why this is?? Further more, commenting out the do{}while the transmission of data also gets stuck after the first character is set in the transmit register. (I am using hyperterminal to connect to my serial port) #include <msp430x16x.h> int main(void) { volatile unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop WDT P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG)); // OSCFault flag still set? UCTL0 |= SWRST; // USART logic held in reset state BCSCTL2 |= SELM_3; // MCLK = LFXT1(safe) ME1 |= UTXE0; // Enabled USART0 TXD (2^7 = 128 = 0x80) UCTL0 |= CHAR; // 8-bit character UTCTL0 |= SSEL0; // UCLK = ACLK UBR00 = 0x45; // 8MHz 115200 UBR10 = 0x00; // 8MHz 115200 UMCTL0 = 0x00; // 8MHz 115200 modulation UCTL0 &= ~SWRST; // Initalize USART state machine while(1) { while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready? TXBUF0 = 0x41; } return 0; } |
|
|
Re: MSP430F1611 - UARTYou said you are using a 32 kHz crystal. But the code you use is
assuming that you have a "High Frequency" crystal. Thus the oscillator will fail. --- In msp430@..., "Sebastian Popa" <saberell@...> wrote: > > Hi all, > > I am trying to get the UART mode working. My setup is: > - MSP-TS430PM64 (with the optional 32 kHz external crystal oscillator > installed) > - MPS-FET430UIF Debug-Interface > - Code Composer Esentials 3 > - a level converter for RS232 > (http://www.tildesign.nl/rs232_ttl_converter-20107101P2N)) > - and a one-to-one serial cable > > I am using the sample code from TI. > > However, I do get stuck in the do{}while loop of clearing > OSCFault flag. > Does anyone know why this is?? > > > Further more, commenting out the do{}while the transmission of data > also gets stuck after the first character is set in the transmit > register. (I am using hyperterminal to connect to my serial port) > > #include <msp430x16x.h> > > int main(void) > { > volatile unsigned int i; > > WDTCTL = WDTPW + WDTHOLD; // Stop WDT > P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD > BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL > > do > { > IFG1 &= ~OFIFG; // Clear OSCFault flag > for (i = 0xFF; i > 0; i--); // Time for flag to set > } > while ((IFG1 & OFIFG)); // OSCFault flag still set? > > UCTL0 |= SWRST; // USART logic held in reset state > BCSCTL2 |= SELM_3; // MCLK = LFXT1(safe) > ME1 |= UTXE0; // Enabled USART0 TXD (2^7 = 128 = 0x80) > UCTL0 |= CHAR; // 8-bit character > UTCTL0 |= SSEL0; // UCLK = ACLK > UBR00 = 0x45; // 8MHz 115200 > UBR10 = 0x00; // 8MHz 115200 > UMCTL0 = 0x00; // 8MHz 115200 modulation > UCTL0 &= ~SWRST; // Initalize USART state machine > > while(1) > { > while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready? > TXBUF0 = 0x41; > } > > return 0; > } > |
| Free Forum Powered by Nabble | Forum Help |