Hi,
> So I must admit that I'm a little bit confused.
May be I do something in wrong way, but CrossWorks and IAR work somehow.
> Could you please tell, what debugging aids you have? JTAG or not?
> What is the echo for a certain character/string? Is it random or what?
As I mentioned before, I use the MSP430x261x_uscia0_uart_03.c example
from slac151c.zip.
The hardware configuration is following:
// MSP430F261x/241x
// -----------------
// /|\| XIN|-
// | | | 32kHz
// --|RST XOUT|-
// | |
// | P3.4/UCA0TXD|------------>
// | | 9600 - 8N1
// | P3.5/UCA0RXD|<------------
//
USCI0 is connected to PC via MAX232. Sample program in python
continuously sends a fixed string, say "BLAH BLAH BLAH\r\n"
I also have MSP-FET430UIF connected to JTAG.
> If you can do JTAG debugging, then put a breakpoint into the
> initialization and the ISR. What's going on?
> Hey, and nevertheless, what about initializing UCA0CTL0? It really does
> not harm to set it to zero.
Well, I initialize it exactly as in example. And I tried a lot of
different things in several iterations, so current code is far from
original. If it's ok, there are the logs and dumps:
1. -s
msp430-gcc -S -mmcu=msp430x2418 -DGCC_MSP430 -Wall -Wshadow
-Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare
-Waggregate-return -I. -I/opt/mspgcc/msp430/include uart03.c
uart03.s:
.file "uart03.c"
.arch msp430x2418
/* Hardware multiplier registers: */
__MPY=0x130
__MPYS=0x132
__MAC=0x134
__MACS=0x136
__OP2=0x138
__RESLO=0x13a
__RESHI=0x13c
__SUMEXT=0x13e
.section .init3,"ax",@progbits
.p2align 1,0
.global __low_level_init
.type __low_level_init,@function
/***********************
* Function `__low_level_init'
***********************/
__low_level_init:
/* prologue: naked */
.L__FrameSize___low_level_init=0x0
mov #llo(23168), &0x0120
mov.b #llo(48), &0x0032
mov.b #llo(0), &0x0031
and.b #llo(-49), &0x0019
mov.b #llo(48), &0x001B
bis.b #llo(64), &0x0061
mov.b #llo(3), &0x0062
mov.b #llo(0), &0x0063
mov.b #llo(6), &0x0064
bic.b #llo(1),&0x0061
bis.b #llo(1), &0x0001
/* epilogue: naked */
.Lfe1:
.size __low_level_init,.Lfe1-__low_level_init
/********* End of function ******/
.text
.p2align 1,0
.global main
.type main,@function
/***********************
* Function `main'
***********************/
main:
/* prologue: frame size = 0 */
.L__FrameSize_main=0x0
.L__FrameOffset_main=0x4
mov #(__stack-0), r1
mov r1,r4
/* prologue end (size=3) */
.L5:
jmp .L5
/* epilogue: frame size=0 */
br #__stop_progExec__
/* epilogue end (size=4) */
/* function main size 9 (2) */
.Lfe2:
.size main,.Lfe2-main
/********* End of function ******/
.p2align 1,0
.global USCI0RX_ISR
.global vector_ffce
.type USCI0RX_ISR,@function
/***********************
* Interrupt Service Routine `USCI0RX_ISR' at 0xffce
***********************/
vector_ffce:
USCI0RX_ISR:
/* prologue: frame size = 0 */
.L__FrameSize_USCI0RX_ISR=0x0
.L__FrameOffset_USCI0RX_ISR=0x4
push r5
push r4
/* prologue end (size=2) */
mov.b #llo(48), &0x0032
bis.b #llo(32), &0x0031
bis.b #llo(16), &0x0031
/* epilogue: frame size=0 */
pop r4
pop r5
reti
/* epilogue end (size=3) */
/* function USCI0RX_ISR size 14 (9) */
.Lfe3:
.size USCI0RX_ISR,.Lfe3-USCI0RX_ISR
/********* End of function ******/
2. uart03.c preprocessed:
# 1 "uart03.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "uart03.c"
# 26 "uart03.c"
# 1 "/opt/mspgcc/msp430/include/signal.h" 1 3
# 33 "/opt/mspgcc/msp430/include/signal.h" 3
# 1 "/opt/mspgcc/msp430/include/iomacros.h" 1 3
# 34 "/opt/mspgcc/msp430/include/iomacros.h" 3
# 1 "/opt/mspgcc/msp430/include/sys/inttypes.h" 1 3
# 38 "/opt/mspgcc/msp430/include/sys/inttypes.h" 3
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef int int16_t;
typedef unsigned int uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
typedef int16_t intptr_t;
typedef uint16_t uintptr_t;
# 35 "/opt/mspgcc/msp430/include/iomacros.h" 2 3
# 34 "/opt/mspgcc/msp430/include/signal.h" 2 3
# 27 "uart03.c" 2
# 1 "/opt/mspgcc/msp430/include/stdlib.h" 1 3
# 32 "/opt/mspgcc/msp430/include/stdlib.h" 3
# 1 "/opt/mspgcc/lib/gcc-lib/msp430/3.2.3/include/stddef.h" 1 3 4
# 151 "/opt/mspgcc/lib/gcc-lib/msp430/3.2.3/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 213 "/opt/mspgcc/lib/gcc-lib/msp430/3.2.3/include/stddef.h" 3 4
typedef unsigned int size_t;
# 325 "/opt/mspgcc/lib/gcc-lib/msp430/3.2.3/include/stddef.h" 3 4
typedef int wchar_t;
# 33 "/opt/mspgcc/msp430/include/stdlib.h" 2 3
# 1 "/opt/mspgcc/msp430/include/sys/types.h" 1 3
# 36 "/opt/mspgcc/msp430/include/sys/types.h" 3
# 1 "/opt/mspgcc/msp430/include/sys/cdefs.h" 1 3
# 37 "/opt/mspgcc/msp430/include/sys/types.h" 2 3
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef u_int64_t u_quad_t;
typedef int64_t quad_t;
typedef quad_t * qaddr_t;
typedef char * caddr_t;
typedef const char * c_caddr_t;
typedef volatile char *v_caddr_t;
typedef u_int32_t fixpt_t;
typedef u_int32_t gid_t;
typedef u_int32_t in_addr_t;
typedef u_int16_t in_port_t;
typedef u_int32_t ino_t;
typedef long key_t;
typedef u_int16_t mode_t;
typedef u_int16_t nlink_t;
typedef quad_t rlim_t;
typedef int32_t segsz_t;
typedef int32_t swblk_t;
typedef int32_t ufs_daddr_t;
typedef int32_t ufs_time_t;
typedef u_int32_t uid_t;
# 34 "/opt/mspgcc/msp430/include/stdlib.h" 2 3
# 52 "/opt/mspgcc/msp430/include/stdlib.h" 3
extern void exit(int) __asm__("__stop_progExec__")
__attribute__((__const__));
typedef struct
{
int quot;
int rem;
} div_t;
extern div_t div(int num, int denom);
typedef struct
{
long quot;
long rem;
} ldiv_t;
extern ldiv_t ldiv(long num, long denom);
extern __inline__ int abs(int __x) __attribute__((__const__));
extern __inline__ int abs(int __x)
{
return (__x < 0) ? -__x : __x;
}
extern __inline__ long labs(long __x) __attribute__((__const__));
extern __inline__ long labs(long __x)
{
return (__x < 0) ? -__x : __x;
}
long strtol(const char *, char **, int);
unsigned long strtoul(const char *, char **, int);
int atoi(const char *p);
long atol(const char *p);
char *itoa(int num, char *str, int radix);
char *utoa(unsigned num, char *str, int radix);
char *ltoa(long num, char *str, int radix);
char *ultoa(unsigned long num, char *str, int radix);
void *malloc(size_t size);
void free(void *p);
void *bsearch(const void *, const void *, size_t, size_t, register int
(*compar)(const void *, const void *));
void abort(void);
int rand(void);
void srand(unsigned __seed);
int rand_r(unsigned *__seed);
# 28 "uart03.c" 2
# 1 "/opt/mspgcc/msp430/include/msp430x24x.h" 1 3
# 46 "/opt/mspgcc/msp430/include/msp430x24x.h" 3
# 1 "/opt/mspgcc/msp430/include/msp430/mpy.h" 1 3
# 18 "/opt/mspgcc/msp430/include/msp430/mpy.h" 3
volatile unsigned int MPY asm("0x0130");
volatile unsigned int MPYS asm("0x0132");
volatile unsigned int MAC asm("0x0134");
volatile unsigned int MACS asm("0x0136");
volatile unsigned int OP2 asm("0x0138");
volatile unsigned int RESLO asm("0x013A");
volatile unsigned int RESHI asm("0x013C");
volatile unsigned int SUMEXT asm("0x013E");
# 47 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/gpio.h" 1 3
# 1 "/opt/mspgcc/msp430/include/msp430/iostructures.h" 1 3
# 27 "/opt/mspgcc/msp430/include/msp430/iostructures.h" 3
typedef union port {
volatile unsigned char reg_p;
volatile struct {
unsigned char __p0:1,
__p1:1,
__p2:1,
__p3:1,
__p4:1,
__p5:1,
__p6:1,
__p7:1;
} __pin;
} __attribute__ ((packed)) ioregister_t;
# 108 "/opt/mspgcc/msp430/include/msp430/iostructures.h" 3
struct port_full_t {
ioregister_t in;
ioregister_t out;
ioregister_t dir;
ioregister_t ifg;
ioregister_t ies;
ioregister_t ie;
ioregister_t sel;
ioregister_t ren;
};
struct port_simple_t {
ioregister_t in;
ioregister_t out;
ioregister_t dir;
ioregister_t sel;
};
struct port_full_t port1 asm("0x0020");
struct port_full_t port2 asm("0x0028");
struct port_simple_t port3 asm("0x0018");
struct port_simple_t port4 asm("0x001c");
struct port_simple_t port5 asm("0x0030");
struct port_simple_t port6 asm("0x0034");
# 2 "/opt/mspgcc/msp430/include/msp430/gpio.h" 2 3
# 122 "/opt/mspgcc/msp430/include/msp430/gpio.h" 3
volatile unsigned char P1IN asm("0x0020");
volatile unsigned char P1OUT asm("0x0021");
volatile unsigned char P1DIR asm("0x0022");
volatile unsigned char P1IFG asm("0x0023");
volatile unsigned char P1IES asm("0x0024");
volatile unsigned char P1IE asm("0x0025");
volatile unsigned char P1SEL asm("0x0026");
volatile unsigned char P1REN asm("0x0027");
volatile unsigned char P2IN asm("0x0028");
volatile unsigned char P2OUT asm("0x0029");
volatile unsigned char P2DIR asm("0x002A");
volatile unsigned char P2IFG asm("0x002B");
volatile unsigned char P2IES asm("0x002C");
volatile unsigned char P2IE asm("0x002D");
volatile unsigned char P2SEL asm("0x002E");
volatile unsigned char P2REN asm("0x002F");
volatile unsigned char P3IN asm("0x0018");
volatile unsigned char P3OUT asm("0x0019");
volatile unsigned char P3DIR asm("0x001A");
volatile unsigned char P3SEL asm("0x001B");
volatile unsigned char P3REN asm("0x0010");
volatile unsigned char P4IN asm("0x001C");
volatile unsigned char P4OUT asm("0x001D");
volatile unsigned char P4DIR asm("0x001E");
volatile unsigned char P4SEL asm("0x001F");
volatile unsigned char P4REN asm("0x0011");
volatile unsigned char P5IN asm("0x0030");
volatile unsigned char P5OUT asm("0x0031");
volatile unsigned char P5DIR asm("0x0032");
volatile unsigned char P5SEL asm("0x0033");
volatile unsigned char P5REN asm("0x0012");
volatile unsigned char P6IN asm("0x0034");
volatile unsigned char P6OUT asm("0x0035");
volatile unsigned char P6DIR asm("0x0036");
volatile unsigned char P6SEL asm("0x0037");
volatile unsigned char P6REN asm("0x0013");
# 48 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/usci.h" 1 3
# 252 "/opt/mspgcc/msp430/include/msp430/usci.h" 3
volatile unsigned char UCA0CTL0 asm("0x0060");
volatile unsigned char UCA0CTL1 asm("0x0061");
volatile unsigned char UCA0BR0 asm("0x0062");
volatile unsigned char UCA0BR1 asm("0x0063");
volatile unsigned char UCA0MCTL asm("0x0064");
volatile unsigned char UCA0STAT asm("0x0065");
volatile unsigned char UCA0RXBUF asm("0x0066");
volatile unsigned char UCA0TXBUF asm("0x0067");
volatile unsigned char UCA0ABCTL asm("0x005D");
volatile unsigned char UCA0IRTCTL asm("0x005E");
volatile unsigned char UCA0IRRCTL asm("0x005F");
volatile unsigned char UCB0CTL0 asm("0x0068");
volatile unsigned char UCB0CTL1 asm("0x0069");
volatile unsigned char UCB0BR0 asm("0x006A");
volatile unsigned char UCB0BR1 asm("0x006B");
volatile unsigned char UCB0I2CIE asm("0x006C");
volatile unsigned char UCB0STAT asm("0x006D");
volatile unsigned char UCB0RXBUF asm("0x006E");
volatile unsigned char UCB0TXBUF asm("0x006F");
volatile unsigned int UCB0I2COA asm("0x0118");
volatile unsigned int UCB0I2CSA asm("0x011A");
volatile unsigned char UCA1CTL0 asm("0x00D0");
volatile unsigned char UCA1CTL1 asm("0x00D1");
volatile unsigned char UCA1BR0 asm("0x00D2");
volatile unsigned char UCA1BR1 asm("0x00D3");
volatile unsigned char UCA1MCTL asm("0x00D4");
volatile unsigned char UCA1STAT asm("0x00D5");
volatile unsigned char UCA1RXBUF asm("0x00D6");
volatile unsigned char UCA1TXBUF asm("0x00D7");
volatile unsigned char UCA1ABCTL asm("0x00CD");
volatile unsigned char UCA1IRTCTL asm("0x00CE");
volatile unsigned char UCA1IRRCTL asm("0x00CF");
volatile unsigned char UCB1CTL0 asm("0x00D8");
volatile unsigned char UCB1CTL1 asm("0x00D9");
volatile unsigned char UCB1BR0 asm("0x00DA");
volatile unsigned char UCB1BR1 asm("0x00DB");
volatile unsigned char UCB1I2CIE asm("0x00DC");
volatile unsigned char UCB1STAT asm("0x00DD");
volatile unsigned char UCB1RXBUF asm("0x00DE");
volatile unsigned char UCB1TXBUF asm("0x00DF");
volatile unsigned int UCB1I2COA asm("0x017C");
volatile unsigned int UCB1I2CSA asm("0x017E");
volatile unsigned char UC1IE asm("0x0006");
volatile unsigned char UC1IFG asm("0x0007");
# 49 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/timera.h" 1 3
# 26 "/opt/mspgcc/msp430/include/msp430/timera.h" 3
volatile unsigned int TA0IV asm("0x012E");
volatile unsigned int TA0CTL asm("0x0160");
volatile unsigned int TA0R asm("0x0170");
volatile unsigned int TA0CCTL0 asm("0x0162");
volatile unsigned int TA0CCTL1 asm("0x0164");
volatile unsigned int TA0CCR0 asm("0x0172");
volatile unsigned int TA0CCR1 asm("0x0174");
# 71 "/opt/mspgcc/msp430/include/msp430/timera.h" 3
volatile unsigned int TA0CCTL2 asm("0x0166");
volatile unsigned int TA0CCR2 asm("0x0176");
# 123 "/opt/mspgcc/msp430/include/msp430/timera.h" 3
typedef struct {
volatile unsigned
taifg:1,
taie:1,
taclr:1,
dummy:1,
tamc:2,
taid:2,
tassel:2;
} __attribute__ ((packed)) tactl_t;
typedef struct {
volatile unsigned
ccifg:1,
cov:1,
out:1,
cci:1,
ccie:1,
outmod:3,
cap:1,
dummy:1,
scci:1,
scs:1,
ccis:2,
cm:2;
} __attribute__ ((packed)) tacctl_t;
struct timera_t {
tactl_t ctl;
tacctl_t cctl0;
tacctl_t cctl1;
tacctl_t cctl2;
volatile unsigned dummy2[4];
volatile unsigned tar;
volatile unsigned taccr0;
volatile unsigned taccr1;
volatile unsigned taccr2;
};
struct timera_t timera asm("0x0160");
# 51 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/timerb.h" 1 3
# 22 "/opt/mspgcc/msp430/include/msp430/timerb.h" 3
volatile unsigned int TBIV asm("0x011E");
volatile unsigned int TBCTL asm("0x0180");
volatile unsigned int TBR asm("0x0190");
volatile unsigned int TBCCTL0 asm("0x0182");
volatile unsigned int TBCCTL1 asm("0x0184");
volatile unsigned int TBCCTL2 asm("0x0186");
volatile unsigned int TBCCR0 asm("0x0192");
volatile unsigned int TBCCR1 asm("0x0194");
volatile unsigned int TBCCR2 asm("0x0196");
volatile unsigned int TBCCTL3 asm("0x0188");
volatile unsigned int TBCCTL4 asm("0x018A");
volatile unsigned int TBCCTL5 asm("0x018C");
volatile unsigned int TBCCTL6 asm("0x018E");
volatile unsigned int TBCCR3 asm("0x0198");
volatile unsigned int TBCCR4 asm("0x019A");
volatile unsigned int TBCCR5 asm("0x019C");
volatile unsigned int TBCCR6 asm("0x019E");
typedef struct {
volatile unsigned
tbifg:1,
tbie:1,
tbclr:1,
dummy1:1,
tbmc:2,
tbid:2,
tbssel:2,
dummy2:1,
tbcntl:2,
tbclgrp:2;
} __attribute__ ((packed)) tbctl_t;
typedef struct {
volatile unsigned
ccifg:1,
cov:1,
out:1,
cci:1,
ccie:1,
outmod:3,
cap:1,
clld:2,
scs:1,
ccis:2,
cm:2;
} __attribute__ ((packed)) tbcctl_t;
struct timerb_t {
tbctl_t ctl;
tbcctl_t cctl0;
tbcctl_t cctl1;
tbcctl_t cctl2;
tbcctl_t cctl3;
tbcctl_t cctl4;
tbcctl_t cctl5;
tbcctl_t cctl6;
volatile unsigned tbr;
volatile unsigned tbccr0;
volatile unsigned tbccr1;
volatile unsigned tbccr2;
volatile unsigned tbccr3;
volatile unsigned tbccr4;
volatile unsigned tbccr5;
volatile unsigned tbccr6;
};
struct timerb_t timerb asm("0x0180");
# 52 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/basic_clock.h" 1 3
# 20 "/opt/mspgcc/msp430/include/msp430/basic_clock.h" 3
volatile unsigned char DCOCTL asm("0x0056");
volatile unsigned char BCSCTL1 asm("0x0057");
volatile unsigned char BCSCTL2 asm("0x0058");
volatile unsigned char BCSCTL3 asm("0x0053");
# 53 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/flash.h" 1 3
# 20 "/opt/mspgcc/msp430/include/msp430/flash.h" 3
volatile unsigned int FCTL1 asm("0x0128");
volatile unsigned int FCTL2 asm("0x012A");
volatile unsigned int FCTL3 asm("0x012C");
# 54 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/compa.h" 1 3
# 20 "/opt/mspgcc/msp430/include/msp430/compa.h" 3
volatile unsigned char CACTL1 asm("0x0059");
volatile unsigned char CACTL2 asm("0x005A");
volatile unsigned char CAPD asm("0x005B");
# 55 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/adc12.h" 1 3
# 18 "/opt/mspgcc/msp430/include/msp430/adc12.h" 3
volatile unsigned int ADC12CTL0 asm("0x01A0");
volatile unsigned int ADC12CTL1 asm("0x01A2");
volatile unsigned int ADC12IFG asm("0x01A4");
volatile unsigned int ADC12IE asm("0x01A6");
volatile unsigned int ADC12IV asm("0x01A8");
typedef struct {
volatile unsigned
adc12sc:1,
enc:1,
adc12tovie:1,
adc12ovie:1,
adc12on:1,
refon:1,
r2_5v:1,
msc:1,
sht0:4,
sht1:4;
} __attribute__ ((packed)) adc12ctl0_t;
typedef struct {
volatile unsigned
adc12busy:1,
conseq:2,
adc12ssel:2,
adc12div:3,
issh:1,
shp:1,
shs:2,
cstartadd:4;
} __attribute__ ((packed)) adc12ctl1_t;
typedef struct {
volatile unsigned
bit0:1,
bit1:1,
bit2:1,
bit3:1,
bit4:1,
bit5:1,
bit6:1,
bit7:1,
bit8:1,
bit9:1,
bit10:1,
bit11:1,
bit12:1,
bit13:1,
bit14:1,
bit15:1;
} __attribute__ ((packed)) adc12xflg_t;
struct adc12_t {
adc12ctl0_t ctl0;
adc12ctl1_t ctl1;
adc12xflg_t ifg;
adc12xflg_t ie;
adc12xflg_t iv;
};
struct adc12_t adc12 asm("0x01A0");
# 100 "/opt/mspgcc/msp430/include/msp430/adc12.h" 3
volatile unsigned int ADC12MEM0 asm("0x0140");
volatile unsigned int ADC12MEM1 asm("0x0142");
volatile unsigned int ADC12MEM2 asm("0x0144");
volatile unsigned int ADC12MEM3 asm("0x0146");
volatile unsigned int ADC12MEM4 asm("0x0148");
volatile unsigned int ADC12MEM5 asm("0x014A");
volatile unsigned int ADC12MEM6 asm("0x014C");
volatile unsigned int ADC12MEM7 asm("0x014E");
volatile unsigned int ADC12MEM8 asm("0x0150");
volatile unsigned int ADC12MEM9 asm("0x0152");
volatile unsigned int ADC12MEM10 asm("0x0154");
volatile unsigned int ADC12MEM11 asm("0x0156");
volatile unsigned int ADC12MEM12 asm("0x0158");
volatile unsigned int ADC12MEM13 asm("0x015A");
volatile unsigned int ADC12MEM14 asm("0x015C");
volatile unsigned int ADC12MEM15 asm("0x015E");
# 139 "/opt/mspgcc/msp430/include/msp430/adc12.h" 3
volatile unsigned char ADC12MCTL0 asm("0x0080");
volatile unsigned char ADC12MCTL1 asm("0x0081");
volatile unsigned char ADC12MCTL2 asm("0x0082");
volatile unsigned char ADC12MCTL3 asm("0x0083");
volatile unsigned char ADC12MCTL4 asm("0x0084");
volatile unsigned char ADC12MCTL5 asm("0x0085");
volatile unsigned char ADC12MCTL6 asm("0x0086");
volatile unsigned char ADC12MCTL7 asm("0x0087");
volatile unsigned char ADC12MCTL8 asm("0x0088");
volatile unsigned char ADC12MCTL9 asm("0x0089");
volatile unsigned char ADC12MCTL10 asm("0x008A");
volatile unsigned char ADC12MCTL11 asm("0x008B");
volatile unsigned char ADC12MCTL12 asm("0x008C");
volatile unsigned char ADC12MCTL13 asm("0x008D");
volatile unsigned char ADC12MCTL14 asm("0x008E");
volatile unsigned char ADC12MCTL15 asm("0x008F");
# 56 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
# 1 "/opt/mspgcc/msp430/include/msp430/common.h" 1 3
# 71 "/opt/mspgcc/msp430/include/msp430/common.h" 3
volatile unsigned int WDTCTL asm("0x0120");
# 57 "/opt/mspgcc/msp430/include/msp430x24x.h" 2 3
volatile unsigned char IE1 asm("0x0000");
volatile unsigned char IFG1 asm("0x0002");
volatile unsigned char IE2 asm("0x0001");
volatile unsigned char IFG2 asm("0x0003");
# 100 "/opt/mspgcc/msp430/include/msp430x24x.h" 3
volatile unsigned int TLV_CHECKSUM asm("0x10C0");
volatile unsigned char TLV_DCO_30_TAG asm("0x10F6");
volatile unsigned char TLV_DCO_30_LEN asm("0x10F7");
volatile unsigned char TLV_ADC12_1_TAG asm("0x10DA");
volatile unsigned char TLV_ADC12_1_LEN asm("0x10DB");
# 137 "/opt/mspgcc/msp430/include/msp430x24x.h" 3
volatile unsigned char CALDCO_16MHZ asm("0x10F8");
volatile unsigned char CALBC1_16MHZ asm("0x10F9");
volatile unsigned char CALDCO_12MHZ asm("0x10FA");
volatile unsigned char CALBC1_12MHZ asm("0x10FB");
volatile unsigned char CALDCO_8MHZ asm("0x10FC");
volatile unsigned char CALBC1_8MHZ asm("0x10FD");
volatile unsigned char CALDCO_1MHZ asm("0x10FE");
volatile unsigned char CALBC1_1MHZ asm("0x10FF");
# 30 "uart03.c" 2
__attribute__((naked, section(".init3"))) void __low_level_init(void)
{
WDTCTL = 0x5A00 + 0x0080;
P5DIR = 0x20|0x10;
P5OUT = 0;
P3OUT &= ~(0x0010 +0x0020);
P3SEL = 0x30;
UCA0CTL1 |= (1<<6);
UCA0BR0 = 0x03;
UCA0BR1 = 0x00;
UCA0MCTL = (0x04) + (0x02);
UCA0CTL1 &= ~(0x01);
IE2 |= (1<<0);
}
int main(void)
{
for(;;) {
}
}
void __attribute__((interrupt (14))) USCI0RX_ISR(void)
{
P5DIR = 0x20|0x10;
P5OUT |= 0x20;
P5OUT |= 0x10;
}
> And also what is the output of "msp430-gcc -E sample.c" and "msp430-gcc
> -S sample.c"?
>
> Hardy
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
//******************************************************************************
// MSP430x26x Demo - USCI_A0, Ultra-Low Pwr UART 9600 Echo ISR, 32kHz ACLK
//
// Description: Echo a received character, RX ISR used. Normal mode is LPM3,
// USCI_A0 RX interrupt triggers TX Echo.
// ACLK = BRCLK = LFXT1 = 32768Hz, MCLK = SMCLK = DCO ~1.045MHz
// Baud rate divider with 32768Hz XTAL @9600 = 32768Hz/9600 = 3.41
// //* An external watch crystal is required on XIN XOUT for ACLK *//
//
// MSP430F261x/241x
// -----------------
// /|\| XIN|-
// | | | 32kHz
// --|RST XOUT|-
// | |
// | P3.4/UCA0TXD|------------>
// | | 9600 - 8N1
// | P3.5/UCA0RXD|<------------
//
// B. Nisarga
// Texas Instruments Inc.
// September 2007
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include <signal.h>
#include <stdlib.h>
#include "msp430x24x.h"
__attribute__((naked, section(".init3"))) void __low_level_init(void)
{
WDTCTL = WDTPW + WDTHOLD;
P5DIR = 0x20|0x10;
P5OUT = 0;
P3OUT &= ~(BIT4+BIT5);
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32kHz/9600 = 3.41
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
// any other low level initialization you want
}
int main(void)
{
/* WDTCTL = WDTPW + WDTHOLD; // Stop WDT*/
//eint();
//__bis_SR_register(LPM3_bits+GIE); // Enter LPM3, interrupts enabled
for(;;) {
}
}
// Echo back RXed character, confirm TX buffer is ready first
interrupt ( USCIAB0RX_VECTOR ) USCI0RX_ISR(void)
{
P5DIR = 0x20|0x10;
P5OUT |= 0x20;
P5OUT |= 0x10;
/* while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?*/
/* UCA0TXBUF = UCA0RXBUF; // TX -> RXed character*/
}