Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

regarding serial communication

Status
Not open for further replies.

yviswanathbe

Full Member level 4
Joined
Jun 14, 2007
Messages
221
Helped
10
Reputation
20
Reaction score
6
Trophy points
1,298
Activity points
3,066
HI Friends,

I am working on C8051F120 Micro controller (silabs make).

I am facing problems with the serial communication.

when i connect to onboard pc com port, i am able to communicate. but when i connect to PCI card i am not able to communicate. i have tried different pci cards (TLINK, QUANTUM etc).

The drivers for PCI cards are installed. I have checked all the possibilities (tried for different baud rates).

i am not able to analyze the problem.

can somebody suggest me what could be the problem.

Thanks and Regards,
Viswanath
 

Hi There,
Have more information regarding the problem will help to support you. bound rate, parity bit, flow control, source code, conf...
But if it is working I`d suggest you use a logic analyzer as Saleae Logic. The logic analyzer you'll love to use. to try to understand what is going on. Obviously it cost some money, but is a good tool to help in this cases.

Kind regards,
rgv
 

the pci card com port numbers are different.
have you taken into account this ?
 

Hi cabelyn and srizbf,

Thanks for your replies.

I am using 115200 baudrate, no parity, flow control none.
and here is my source code.


Code:
/////////////////////////////////////

#include <C8051F120.h>
#include<stdio.h>

void serTx(unsigned char);
void delay_ms(unsigned int);

unsigned char dat=0;
// Peripheral specific initialization functions,
// Called from the Init_Device() function
void Reset_Sources_Init()
{
    WDTCN     = 0xDE;
    WDTCN     = 0xAD;
}

void Timer_Init()
{
    SFRPAGE   = TIMER01_PAGE;
    TCON      = 0x40;
    TMOD      = 0x20;
    CKCON     = 0x10;
    TH1       = 0xF4;
}

void UART_Init()
{
    SFRPAGE   = UART0_PAGE;
    SCON0     = 0x50;
}

void Port_IO_Init()
{
    // P0.0  -  TX0 (UART0), Open-Drain, Digital
    // P0.1  -  RX0 (UART0), Push-Pull,  Digital
    SFRPAGE   = CONFIG_PAGE;
    P0MDOUT   = 0x00;
    XBR0      = 0x04;
    XBR2      = 0x40;
}

void Oscillator_Init()
{
    int i = 0;
    SFRPAGE   = CONFIG_PAGE;
    OSCXCN    = 0x67;
    for (i = 0; i < 3000; i++);  // Wait 1ms for initialization
    while ((OSCXCN & 0x80) == 0);
    CLKSEL    = 0x01;
    OSCICN    &= ~0x80;
}
void Interrupts_Init()
{
    IE        = 0x90;
}

// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    Reset_Sources_Init();
    Timer_Init();
    UART_Init();
    Port_IO_Init();
    Oscillator_Init();
	Interrupts_Init();
}
void UART0_Interrupt (void) interrupt 4
{
	if(RI0==1)
	{
		RI0=0;
		dat=SBUF0;
		serTx(dat);
	}
	if(TI0==1)
	{
		TI0=0;
	}
}
void serTx(unsigned char dat)
{
	SBUF0=dat;
}
void delay_ms(unsigned int val)
{
	int  di=0,dj=0;
	for(di=0;di<val;di++)
	for(dj=0;dj<15;dj++);
}
void main(void)
{
	Init_Device();
	while(1)
	{
		serTx(0xAA);
		delay_ms(1000);
	}
}

the code is working with the serial port which comes with the mother board.
the pci card com port numbers are different.
have you taken into account this

yes i have taken care while selecting the port number.

thanks and regards,
viswanath
 

Have you tested the serial PCI boards using a loopback to verify they are functioning properly?
 

Have you tested the serial PCI boards using a loopback to verify they are functioning properly?

Exactly; short out pins 2 and 3 on your PCI card connector, fire up your Hyperterminal (or other terminal emulator), and you should see the echo of whatever you type on the keyboard.

Anand
 

Hi,

Loop back testing is OK.

problem comes only when i connect my controller board to pci card.
 

Are you connecting the GND between the MCU and the serial PCI port, along with the TX/RX pins?

---------- Post added at 13:27 ---------- Previous post was at 13:25 ----------

Also try reducing the BAUD rate to 9600 at both ends.
 

hi bigdogguru,
Thanks for your mail.

Yes, GND is connected between the controller and PCI card.

I have tried with all the baudrates from 9600 to 115200 at both ends.

I am suspecting my controller because i am facing the same problem with other 3 controller boards.

i have bought 10 numbers from the local distributor. i am facing problem with 4 among 10.

How to check the controller i have received is not damaged.

Regards,
Viswanath
 

Are you using a proper level shifter between your microcontroller output and the PC? If you have TTL level swings, then maybe the serial port on the PC is more forgiving than the one on your PCI card.

BTW, are you sure there are no yellow exclamations agains the PCI com ports in your device manager? That might indicate an IRQ, or driver issue? But since your loopback works, I guess not.

Anand.
 

I thing your connector on PC side is Canon9
try to shourt out pins (does not matter if you use HW flow control or not):
a) 1,4,6
and
b) 7 and 8

Also try to exchange pins 2 and 3

---------- Post added at 18:39 ---------- Previous post was at 18:32 ----------

Another test which I use :
1. set MCU as transmitter. Send "U" periodically every 200ms.
2. check TXD signal with oscope or logic probe on MCU pins and rs232 shifter IC
3. run any serial port monitor and set correct baudrate,...
3. connect this wire to pin2 or pin 3. One of them must work. Do not forget GND connection
 

Hi friends,

Thanks for your valuable suggestions.

I will check and come back to you.

Regards,
Viswanath
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top