cancel
Showing results for 
Search instead for 
Did you mean: 

Uart problem

hanan54
Associate II
Posted on February 10, 2004 at 11:09

Uart problem

4 REPLIES 4
hanan54
Associate II
Posted on May 17, 2011 at 11:58

Hello all,

I‘m using uPSD3334DV in my card and the platform has 2 serial ports.

I initiated a communication between UART0 and a PC serial port, and it’s working good.

I tried to use UART1 for another channel but the serial signal don’t appears.

In the debugger the program jump to UART1 interrupt every byte transmit.

My program for initialize UART0 and UART1 :

Ea =0

//---------- UART0 -------------

timer2_baud = (65536L - ( (FREQ_OSC * 125L) / (4L * 19200L)));

RCAP2L = (timer2_baud & 0x00FF); // Timer 2 Reload low byte

RCAP2H = (timer2_baud >> 8,); // Timer 2 Reload high byte

T2CON = 0x34; // Set RCLK = 1 ,TCLK= 1 Timer2 select for uart0

// TR2 = 1 start Timer2.

P3SFS|=0x03; // Configure P3.0,P3.1 as UART0 pins

SCON = 0x40; //uart0 - mode 1 - SM1= 1 SM0 = 0

// 8 BIT variable data rate

RI = FALSE; // prepare to receive

REN = 1; // receiver enable - register

ES = 1; // Enable Uart0 interrupt

//---------- UART1 -------------

TMOD |= 0x20; // Timer 1 mode - 8 bit auto reload

SCON1 = 0xE0; // SM1= 1 SM0 = 1 mode 3 - 11 bits data

TH1 = 0xfd; // 19200 baud - must change recording to OSC

PCON |= 0x4C ; // set RCLK1 = 1 , TCLK1 = 1 - recive and

// transmit CLK enable

// smod1 =1 UART1 - boud rate *2

TR1 = 1; // baud rate generator run !

RI1 = FALSE; // prepare to receive

REN1 = 1; // receiver enable - TCON register

P1SFS0 |=0x06; // Configure P1.2,P1.3 as UART1 pins

IEA |= 0x10 ; // ES1=1 Enable Uart1 interrupt

The problem is why the serial signal don’t appears.

hanan

[ This message was edited by: hanan54 on 04-02-2004 10:11 ]
joseph2399
Associate II
Posted on May 17, 2011 at 11:58

Please try the following settings:

PCON |= 0xCC;

P1SFS0 |=0x0C;

Also, please see Table 42 (SCON0 and SCON1 Register Details) on page 48 of uPSD33XX datasheet,

SCON1 = 0xE0; (i.e. SM1= 1 SM0 = 1 mode 3 - 11 bits data)

hanan54
Associate II
Posted on May 17, 2011 at 11:58

Thanks Upsd,

I change my program according to the last post and It help to solve the problem.

Thank you,

Hanan

danny23
Associate II
Posted on May 17, 2011 at 11:58

Hanan

Can you post a complete working example of the UARTs?

DO