Hello everyone, I am a beginner with the MSP430 and my first application is a communication between two MSP430s via UART. The first step I wanted to do is to send a byte. I connected a oscilloscope to the UTXD0 pin but I can't see the byte, that should be transmitted. So, I'm not sure if I configured the UART in the right way, or if I have set all bits correctly at the right position. This is my code: ;------------------------------- #include "msp430x14x.h" ORG 01100h ;Program Start RESET mov.w #0A00h,SP ; Initialize 'F149 stackpointer call #Init_Sys ; Mainloop nop jmp Mainloop ; Do nothing Init_Sys ; Initalize StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT bis.b #030h,&P3SEL ; P3.4,5 = USART0 TXD/RXD bis.b #010h,&P3DIR ; P3.4 = output direction SetupUART0 clr.b &TXBUF0 ; Clear TXBUF0 mov.b #0D1h,&UCTL0 ; Parity enabled ; Even parity ; 8-bit data ; SWRST enabled bis.b #010h,&UTCTL0 ; Source ACLK mov.b #00Dh,&UBR00 ; 32k/2400 - 13.65 mov.b #000h,&UBR10 ; 32k 2400 mov.b #06Bh,&UMCTL0 ; 32k 2400 modulation bic.b #SWRST,&UCTL0 ; Clear SWRST bis.b #UTXIE0,&IE1 ; Enable USART0 TX interrupt bis.b #URXIE0,&IE1 ; Enable USART0 RX interrupt eint ; General enable interrupts tx1 bit.b #UTXIFG0,&IFG1 ; USART0 TX buffer ready? jz tx1 ; Jump is TX buffer not ready ret ; Return from subroutine USART_ISR ; Echo back RXed character TX1 bit.b #UTXIFG0,&IFG1 ; USART0 TX buffer ready? jz TX1 ; Jump is TX buffer not ready mov.b &RXBUF0,&TXBUF0 ; TX -> RXed character reti ; UART_TRANSMIT nop reti ; Interrupt Vectors Used MSP430x13x/14x ORG 0FFFEh ; DW RESET ; ORG 0FFF2h ; DW UART0RX_VECTOR ; USART0 receive DW USART_ISR ; USART0 receive ORG 0FFF0h ; DW UART_TRANSMIT ; USART0 transmit end ;------------------------------- In my view this should run endless, because when I send AAh it is received and send again... But I only see a high level on the P3.4/UTXD0 pin after setting P3.4,5 = USART0 TXD/RXD and no signal. I hope somebody can help me. Nice greetings! Bernhard
UART - no signal on UTXD0
Started by ●April 3, 2003
Reply by ●April 4, 20032003-04-04
hill_valley1979 wrote: > Hello everyone, > > I am a beginner with the MSP430 and my first application is a > communication between two MSP430s via UART. > > So, I'm not sure if I configured the UART in the right way, or if I > have set all bits correctly at the right position. You haven't enabled the UART. Refer to the data sheet for registers ME1 & ME2 (Module enable). They have bits for the Tx & Rx for UART0 & 1. Note the bit numbers are different in each register. HTH Stephen -- -- Tel: +44 1225 868228 || Stephen Bashford (sbashford@sbas...) Fax: +44 1225 868191 || Software Engineer Mob: +44 7768 440692 || MPC Data Limited (http://www.mpc-data.co.uk)