Hi, I've modified usci.h to work with USCI_A1 in UART mode. It works for me. The patch is based on CCE's headers.
>>> usci_patch --- usci.h 2009-06-05 01:55:18.000000000 +0400 +++ /opt/mspgcc/msp430/include/msp430/usci.h 2009-06-23 12:11:21.000000000 +0400 @@ -443,88 +443,123 @@ /* -------- USCI1_5 */ -// tbd -/*#define UCA1CTL0_ 0x0601 -#define UCA1CTL0_L 0x0601 -#define UCA1CTL0_H 0x0602 -#define UCA1CTL1_ 0x0600 -#define UCA1CTL1_L 0x0600 -#define UCA1CTL1_H 0x0601 -#define UCA1BR0_ 0x0606 -#define UCA1BR0_L 0x0606 -#define UCA1BR0_H 0x0607 -#define UCA1BR1_ 0x0607 -#define UCA1BR1_L 0x0607 -#define UCA1BR1_H 0x0608 -#define UCA1MCTL_ 0x0608 -#define UCA1MCTL_L 0x0608 -#define UCA1MCTL_H 0x0609 -#define UCA1STAT_ 0x060A -#define UCA1STAT_L 0x060A -#define UCA1STAT_H 0x060B -#define UCA1RXBUF 0x060C -#define UCA1RXBUF_L 0x060C -#define UCA1RXBUF_H 0x060D -#define UCA1TXBUF 0x060E -#define UCA1TXBUF_L 0x060E -#define UCA1TXBUF_H 0x060F -#define UCA1ABCTL 0x0610 -#define UCA1ABCTL_L 0x0610 -#define UCA1ABCTL_H 0x0611 -#define UCA1IRTCTL 0x0612 -#define UCA1IRTCTL_L 0x0612 -#define UCA1IRTCTL_H 0x0613 -#define UCA1IRRCTL 0x0613 -#define UCA1IRRCTL_L 0x0613 -#define UCA1IRRCTL_H 0x0614 -#define UCA1IE_ 0x061C -#define UCA1IE_L_ 0x061C -#define UCA1IE_H_ 0x061D -#define UCA1IFG_ 0x061D -#define UCA1IFG_L 0x061D -#define UCA1IFG_H 0x061E -#define UCA1IV_ 0x061E -#define UCA1IV_L_ 0x061E -#define UCA1IV_H_ 0x061F -#define UCB1CTL0_ 0x0621 -#define UCB1CTL0_L 0x0621 -#define UCB1CTL0_H 0x0622 -#define UCB1CTL1_ 0x0620 -#define UCB1CTL1_L 0x0620 -#define UCB1CTL1_H 0x0621 -#define UCB1BR0_ 0x0626 -#define UCB1BR0_L 0x0626 -#define UCB1BR0_H 0x0627 -#define UCB1BR1_ 0x0627 -#define UCB1BR1_L 0x0627 -#define UCB1BR1_H 0x0628 -#define UCB1STAT_ 0x062A -#define UCB1STAT_L 0x062A -#define UCB1STAT_H 0x062B -#define UCB1RXBUF 0x062C -#define UCB1RXBUF_L 0x062C -#define UCB1RXBUF_H 0x062D -#define UCB1TXBUF 0x062E -#define UCB1TXBUF_L 0x062E -#define UCB1TXBUF_H 0x062F -#define UCB1I2COA 0x0630 -#define UCB1I2COA_L 0x0630 -#define UCB1I2COA_H 0x0631 -#define UCB1I2CSA 0x0632 -#define UCB1I2CSA_L 0x0632 -#define UCB1I2CSA_H 0x0633 -#define UCB1IE_ 0x063C -#define UCB1IE_L_ 0x063C -#define UCB1IE_H_ 0x063D -#define UCB1IFG_ 0x063D -#define UCB1IFG_L 0x063D -#define UCB1IFG_H 0x063E -#define UCB1IV_ 0x063E -#define UCB1IV_L_ 0x063E -#define UCB1IV_H_ 0x063F -*/ +#define UCA1CTLW0_ 0x0600 +#define UCA1CTLW0_L_ 0x0600 +#define UCA1CTLW0_H_ 0x0601 +#define UCA1BRW_ 0x0606 +#define UCA1BRW_L_ 0x0606 +#define UCA1BRW_H_ 0x0607 +#define UCA1MCTL_ 0x0608 +#define UCA1STAT_ 0x060A +#define UCA1RXBUF_ 0x060C +#define UCA1TXBUF_ 0x060E +#define UCA1ABCTL_ 0x0610 +#define UCA1IRCTL_ 0x0612 +#define UCA1IRCTL_L_ 0x0612 +#define UCA1IRCTL_H_ 0x0613 +#define UCA1ICTL_ 0x061C +#define UCA1ICTL_L_ 0x061C +#define UCA1ICTL_H_ 0x061D +#define UCA1IV_ 0x061E +#define UCB1CTLW0_ 0x0620 +#define UCB1CTLW0_L_ 0x0620 +#define UCB1CTLW0_H_ 0x0621 +#define UCB1BRW_ 0x0626 +#define UCB1BRW_L_ 0x0626 +#define UCB1BRW_H_ 0x0627 +#define UCB1STAT_ 0x062A +#define UCB1RXBUF_ 0x062C +#define UCB1TXBUF_ 0x062E +#define UCB1I2COA_ 0x0630 +#define UCB1I2COA_L_ 0x0630 +#define UCB1I2COA_H_ 0x0631 +#define UCB1I2CSA_ 0x0632 +#define UCB1I2CSA_L_ 0x0632 +#define UCB1I2CSA_H_ 0x0633 +#define UCB1ICTL_ 0x063C +#define UCB1ICTL_L_ 0x063C +#define UCB1ICTL_H_ 0x063D +#define UCB1IV_ 0x063E + +sfrw(UCA1CTLW0,UCA1CTLW0_); /* USCI A1 Control Word Register 0 */ +sfrb(UCA1CTLW0_L,UCA1CTLW0_L_); /* USCI A1 Control Word Register 0 */ +sfrb(UCA1CTLW0_H,UCA1CTLW0_H_); /* USCI A1 Control Word Register 0 */ +#define UCA1CTL1 UCA1CTLW0_L /* USCI A1 Control Register 1 */ +#define UCA1CTL0 UCA1CTLW0_H /* USCI A1 Control Register 0 */ +sfrw(UCA1BRW,UCA1BRW_); /* USCI A1 Baud Word Rate 0 */ +sfrb(UCA1BRW_L,UCA1BRW_L_); /* USCI A1 Baud Word Rate 0 */ +sfrb(UCA1BRW_H,UCA1BRW_H_); /* USCI A1 Baud Word Rate 0 */ +#define UCA1BR0 UCA1BRW_L /* USCI A1 Baud Rate 0 */ +#define UCA1BR1 UCA1BRW_H /* USCI A1 Baud Rate 1 */ +sfrb(UCA1MCTL,UCA1MCTL_); /* USCI A1 Modulation Control */ +sfrb(UCA1STAT,UCA1STAT_); /* USCI A1 Status Register */ +sfrb(UCA1RXBUF,UCA1RXBUF_); /* USCI A1 Receive Buffer */ +sfrb(UCA1TXBUF,UCA1TXBUF_); /* USCI A1 Transmit Buffer */ +sfrb(UCA1ABCTL,UCA1ABCTL_); /* USCI A1 LIN Control */ +sfrw(UCA1IRCTL,UCA1IRCTL_); /* USCI A1 IrDA Transmit Control */ +sfrb(UCA1IRCTL_L,UCA1IRCTL_L_); /* USCI A1 IrDA Transmit Control */ +sfrb(UCA1IRCTL_H,UCA1IRCTL_H_); /* USCI A1 IrDA Transmit Control */ +#define UCA1IRTCTL UCA1IRCTL_L /* USCI A1 IrDA Transmit Control */ +#define UCA1IRRCTL UCA1IRCTL_H /* USCI A1 IrDA Receive Control */ +sfrw(UCA1ICTL,UCA1ICTL_); /* USCI A1 Interrupt Enable Register */ +sfrb(UCA1ICTL_L,UCA1ICTL_L_); /* USCI A1 Interrupt Enable Register */ +sfrb(UCA1ICTL_H,UCA1ICTL_H_); /* USCI A1 Interrupt Enable Register */ +#define UCA1IE UCA1ICTL_L /* USCI A1 Interrupt Enable Register */ +#define UCA1IFG UCA1ICTL_H /* USCI A1 Interrupt Flags Register */ +sfrw(UCA1IV,UCA1IV_); /* USCI A1 Interrupt Vector Register */ +sfrw(UCB1CTLW0,UCB1CTLW0_); /* USCI B1 Control Word Register 0 */ +sfrb(UCB1CTLW0_L,UCB1CTLW0_L_); /* USCI B1 Control Word Register 0 */ +sfrb(UCB1CTLW0_H,UCB1CTLW0_H_); /* USCI B1 Control Word Register 0 */ +#define UCB1CTL1 UCB1CTLW0_L /* USCI B1 Control Register 1 */ +#define UCB1CTL0 UCB1CTLW0_H /* USCI B1 Control Register 0 */ +sfrw(UCB1BRW,UCB1BRW_); /* USCI B1 Baud Word Rate 0 */ +sfrb(UCB1BRW_L,UCB1BRW_L_); /* USCI B1 Baud Word Rate 0 */ +sfrb(UCB1BRW_H,UCB1BRW_H_); /* USCI B1 Baud Word Rate 0 */ +#define UCB1BR0 UCB1BRW_L /* USCI B1 Baud Rate 0 */ +#define UCB1BR1 UCB1BRW_H /* USCI B1 Baud Rate 1 */ +sfrb(UCB1STAT,UCB1STAT_); /* USCI B1 Status Register */ +sfrb(UCB1RXBUF,UCB1RXBUF_); /* USCI B1 Receive Buffer */ +sfrb(UCB1TXBUF,UCB1TXBUF_); /* USCI B1 Transmit Buffer */ +sfrw(UCB1I2COA,UCB1I2COA_); /* USCI B1 I2C Own Address */ +sfrb(UCB1I2COA_L,UCB1I2COA_L_); /* USCI B1 I2C Own Address */ +sfrb(UCB1I2COA_H,UCB1I2COA_H_); /* USCI B1 I2C Own Address */ +sfrw(UCB1I2CSA,UCB1I2CSA_); /* USCI B1 I2C Slave Address */ +sfrb(UCB1I2CSA_L,UCB1I2CSA_L_); /* USCI B1 I2C Slave Address */ +sfrb(UCB1I2CSA_H,UCB1I2CSA_H_); /* USCI B1 I2C Slave Address */ +sfrw(UCB1ICTL,UCB1ICTL_); /* USCI B1 Interrupt Enable Register */ +sfrb(UCB1ICTL_L,UCB1ICTL_L_); /* USCI B1 Interrupt Enable Register */ +sfrb(UCB1ICTL_H,UCB1ICTL_H_); /* USCI B1 Interrupt Enable Register */ +#define UCB1IE UCB1ICTL_L /* USCI B1 Interrupt Enable Register */ +#define UCB1IFG UCB1ICTL_H /* USCI B1 Interrupt Flags Register */ +sfrw(UCB1IV,UCB1IV_); /* USCI B1 Interrupt Vector Register */ + #endif /* __MSP430_HAS_USCI1_5__ */ +#if defined (__MSP430_HAS_USCI0_5__) || defined (__MSP430_HAS_USCI1_5__) + +/* UCAxIE Control Bits */ +#define UCTXIE 0x0002 /* USCI Transmit Interrupt Enable */ +#define UCRXIE 0x0001 /* USCI Receive Interrupt Enable */ + +#define UCNACKIE 0x0020 /* NACK Condition interrupt enable */ +#define UCALIE 0x0010 /* Arbitration Lost interrupt enable */ +#define UCSTPIE 0x0008 /* STOP Condition interrupt enable */ +#define UCSTTIE 0x0004 /* START Condition interrupt enable */ +#define UCTXIE 0x0002 /* USCI Transmit Interrupt Enable */ +#define UCRXIE 0x0001 /* USCI Receive Interrupt Enable */ + +#define UCTXIFG 0x0002 /* USCI Transmit Interrupt Flag */ +#define UCRXIFG 0x0001 /* USCI Receive Interrupt Flag */ + +#define UCNACKIFG 0x0020 /* NAK Condition interrupt Flag */ +#define UCALIFG 0x0010 /* Arbitration Lost interrupt Flag */ +#define UCSTPIFG 0x0008 /* STOP Condition interrupt Flag */ +#define UCSTTIFG 0x0004 /* START Condition interrupt Flag */ +#define UCTXIFG 0x0002 /* USCI Transmit Interrupt Flag */ +#define UCRXIFG 0x0001 /* USCI Receive Interrupt Flag */ + +#endif + #if defined(__MSP430_HAS_USCI2_5__) /* -------- USCI2_5 */ >>>> end of usci_patch --- Regards, Dmitry On Mon, 2009-06-22 at 17:41 +0100, Robert Spanton wrote: > On Mon, 2009-06-22 at 20:10 +0400, Dmitry Zuikov wrote: > > I have a compilation error when try to build a sample with USCI for > > 5418: > > > led.c: In function `main': > > led.c:71: `UCA1CTL1' undeclared (first use in this function) > ... > > However, when I try to fix it, say by defining > > > > #define __MSP430_HAS_USCI__ > > #define __MSP430_HAS_USCI0__ > > #define __MSP430_HAS_USCI1__ > > After peeking at the top of usci.h, it looks like __MSP430_HAS_USCI0_5__ > and __MSP430_HAS_USCI1_5__ should be declared in the device's header > file. The two that you've declared are for non-5xx targets, and the > device header file should deal with these anyway. > > Looking in msp430x54xx.h, __MSP430_HAS_USCI0_5__ and > __MSP430_HAS_USCI1_5__ are declared -- so something odd is happening! > > > $ msp430-gcc -Os -mmcu=msp430x5418 ./led.c -o led.elf > > In file included from /opt/mspgcc/msp430/include/msp430x54xx.h:51, > > from /opt/mspgcc/msp430/include/io.h:152, > > from led.c:8: > > /opt/mspgcc/msp430/include/msp430/usci.h:426: conflicting types for > > `UCB0I2COA' > > /opt/mspgcc/msp430/include/msp430/usci.h:303: previous declaration of > > `UCB0I2COA' > > /opt/mspgcc/msp430/include/msp430/usci.h:428: conflicting types for > > `UCB0I2CSA' > > /opt/mspgcc/msp430/include/msp430/usci.h:305: previous declaration of > > `UCB0I2CSA' > > In file included from led.c:9: > > /opt/mspgcc/msp430/include/signal.h:39:2: warning: #warning X2 ist da > > This is because you've declared the __MSP430_HAS_USCI0__ and > __MSP430_HAS_USCI1__ constants, which aren't for the 5xx devices. > > > BTW, there were alse errors during build libc from the latest CVS > > snapshot - see diff: > > This error is fixed by the patch I sent last week: > http://article.gmane.org/gmane.comp.hardware.texas-instruments.msp430.gcc.user/7833 > > I don't think it's hit CVS yet though. > > Cheers, > > Rob > > > ------------------------------------------------------------------------------ > Are you an open source citizen? Join us for the Open Source Bridge conference! > Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. > Need another reason to go? 24-hour hacker lounge. Register today! > http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
