Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | 8051 serial problems

There are 16 messages in this thread.

You are currently looking at messages 0 to 10.

8051 serial problems - Edo Reshef - 11:33 21-04-04



Hi,

I have an 8051 controller that communicates over RS485 to other 8051
controller. The communication is half-duplex at baud of 57600, and it
works great. So far so good.
Lately, I'm trying to make the 8051 device talk with a PC, since it is
57600 and I have RS232<>RS485 converter this should be simple.

I'm encountering strange problems at the 8051 reception, I never
received what I send from the PC. For example:
             msb  lsb
PC Sends  -> 11011011
8051 Gets -> 10111011

PC Sends  -> 10110011
8051 Gets -> 01110011

PC Sends  -> 11000101
8051 Gets -> 10000101

PC Sends  -> 10101011
8051 Gets -> 01001011

Even more, when the msb is "0" the reception interrupt does not
trigger.
It looks like the 8051 ignores the PC start bit or something...

The protocol is 9-bit multi-drop, which i already implemented on PC
side using Space and Mark parities, it worked fine with some other
9-bit PIC devices.

I'm debugging the 8051 device with a DS-ICE but i don't think this is
the problem.
I'm totally out of ideas what could be wrong.

Regards,
  Edo Reshef

Re: 8051 serial problems - Gary Kato - 11:58 21-04-04

>PC Sends  -> 11011011
>8051 Gets -> 10111011
>
>PC Sends  -> 10110011
>8051 Gets -> 01110011
>
>PC Sends  -> 11000101
>8051 Gets -> 10000101
>
>PC Sends  -> 10101011
>8051 Gets -> 01001011
>
>Even more, when the msb is "0" the reception interrupt does not
>trigger.
>It looks like the 8051 ignores the PC start bit or something...
>
>The protocol is 9-bit multi-drop, which i already implemented on PC
>side using Space and Mark parities, it worked fine with some other
>9-bit PIC devices.
>

Remember that serial data is sent lsb first. It seems something odd is
happening at the end of reception, not at the start.



Re: 8051 serial problems - Tilmann Reh - 12:02 21-04-04

Edo Reshef schrieb:

> I have an 8051 controller that communicates over RS485 to other 8051
> controller. The communication is half-duplex at baud of 57600, and it
> works great. So far so good.
> Lately, I'm trying to make the 8051 device talk with a PC, since it is
> 57600 and I have RS232<>RS485 converter this should be simple.
> 
> I'm encountering strange problems at the 8051 reception, I never
> received what I send from the PC. For example:
>              msb  lsb
> PC Sends  -> 11011011
> 8051 Gets -> 10111011
> 
> PC Sends  -> 10110011
> 8051 Gets -> 01110011
> 
> PC Sends  -> 11000101
> 8051 Gets -> 10000101
> 
> PC Sends  -> 10101011
> 8051 Gets -> 01001011
> 
> Even more, when the msb is "0" the reception interrupt does not
> trigger.
> It looks like the 8051 ignores the PC start bit or something...

It cannot. A start bis is a start bit, wherever it comes from.

> The protocol is 9-bit multi-drop, which i already implemented on PC
> side using Space and Mark parities, it worked fine with some other
> 9-bit PIC devices.

I think the problem is somewhere in this area. PCs are not likely
to support 9-bit frames, and if it works, it's not really safe
or reproducible.
Maybe your positive experience was made with another PC or another
software configuration.

> I'm debugging the 8051 device with a DS-ICE but i don't think this is
> the problem.
> I'm totally out of ideas what could be wrong.

I strongly recommend to look at the interface lines with a DSO
and check if the PC really sends correctly.
You might also consider testing the communication at lower
speeds first (where the PC hack might eventually work).

Did you also try the other direction already?

-- 
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de

Re: 8051 serial problems - Meindert Sprang - 12:04 21-04-04

"Edo Reshef" <e...@hotmail.com> wrote in message
news:7...@posting.google.com...
> Hi,
>
> I have an 8051 controller that communicates over RS485 to other 8051
> controller. The communication is half-duplex at baud of 57600, and it
> works great. So far so good.
> Lately, I'm trying to make the 8051 device talk with a PC, since it is
> 57600 and I have RS232<>RS485 converter this should be simple.
>
> I'm encountering strange problems at the 8051 reception, I never
> received what I send from the PC. For example:
>              msb  lsb
> PC Sends  -> 11011011
> 8051 Gets -> 10111011
>
> PC Sends  -> 10110011
> 8051 Gets -> 01110011
>
> PC Sends  -> 11000101
> 8051 Gets -> 10000101
>
> PC Sends  -> 10101011
> 8051 Gets -> 01001011
>

Looking at the bit patterns, I'd say either your timing is off (not exactly
57600) or your signal edges are not steep enough due to, for instance, a
long cable or low-pass filters on a serial port.
Check the signal with an oscilloscope.

Meindert



Re: 8051 serial problems - Tauno Voipio - 12:52 21-04-04

Edo Reshef wrote:
> Hi,
> 
> I have an 8051 controller that communicates over RS485 to other 8051
> controller. The communication is half-duplex at baud of 57600, and it
> works great. So far so good.
> Lately, I'm trying to make the 8051 device talk with a PC, since it is
> 57600 and I have RS232<>RS485 converter this should be simple.
> 
> I'm encountering strange problems at the 8051 reception, I never
> received what I send from the PC. For example:
>              msb  lsb
> PC Sends  -> 11011011
> 8051 Gets -> 10111011
> 
> PC Sends  -> 10110011
> 8051 Gets -> 01110011
> 
> PC Sends  -> 11000101
> 8051 Gets -> 10000101
> 
> PC Sends  -> 10101011
> 8051 Gets -> 01001011
> 
> Even more, when the msb is "0" the reception interrupt does not
> trigger.
> It looks like the 8051 ignores the PC start bit or something...
> 
> The protocol is 9-bit multi-drop, which i already implemented on PC
> side using Space and Mark parities, it worked fine with some other
> 9-bit PIC devices.

This has a strong scent of a speed / distorsion error. It seems that
after 6 bits, the 8051 is off by one bit time.

Please remember that initially the RS-232 standard limited the transfer
speed to 20000 bits/s. There may be edge slow-down capacitors at either
or both ends of the RS-232 data lines.

Which crystal and what divisor are you using on the 8051's?

Tauno Voipio
tauno voipio @ iki fi


Re: 8051 serial problems - nospam - 18:31 21-04-04

e...@hotmail.com (Edo Reshef) wrote:

>Hi,
>
>I have an 8051 controller that communicates over RS485 to other 8051
>controller. The communication is half-duplex at baud of 57600, and it
>works great. So far so good.
>Lately, I'm trying to make the 8051 device talk with a PC, since it is
>57600 and I have RS232<>RS485 converter this should be simple.
>
>I'm encountering strange problems at the 8051 reception, I never
>received what I send from the PC. For example:
>             msb  lsb
>PC Sends  -> 11011011
>8051 Gets -> 10111011
>
>PC Sends  -> 10110011
>8051 Gets -> 01110011
>
>PC Sends  -> 11000101
>8051 Gets -> 10000101
>
>PC Sends  -> 10101011
>8051 Gets -> 01001011

Looks like the 8051 baud rate is about 10% faster than the PC.



Re: 8051 serial problems - Jim Granville - 20:44 21-04-04

Gary Kato wrote:

> PC Sends  -> 11011011
>>8051 Gets -> 10111011
>>
>>PC Sends  -> 10110011
>>8051 Gets -> 01110011
>>
>>PC Sends  -> 11000101
>>8051 Gets -> 10000101
>>
>>PC Sends  -> 10101011
>>8051 Gets -> 01001011
>>Even more, when the msb is "0" the reception interrupt does not
>>trigger.
>>It looks like the 8051 ignores the PC start bit or something...
>>
>>The protocol is 9-bit multi-drop, which i already implemented on PC
>>side using Space and Mark parities, it worked fine with some other
>>9-bit PIC devices.
>>
> 
> Remember that serial data is sent lsb first. It seems something odd is
> happening at the end of reception, not at the start.

and that suggests the MSB is perhaps sliding into the STOP bit,
either drive slew as has been suggested, or simply the wrong BAUD rate.
Your errors are all 'at one end' which does not suggest driver skew, but
does fit baud rate miss-match.
-jg


Re: 8051 serial problems - Edo Reshef - 04:26 22-04-04

g...@aol.com (Gary Kato) wrote in message news:<2...@mb-m27.aol.com>...
> >PC Sends  -> 11011011
> >8051 Gets -> 10111011
> >
> >PC Sends  -> 10110011
> >8051 Gets -> 01110011
> >
> >PC Sends  -> 11000101
> >8051 Gets -> 10000101
> >
> >PC Sends  -> 10101011
> >8051 Gets -> 01001011
> >
> >Even more, when the msb is "0" the reception interrupt does not
> >trigger.
> >It looks like the 8051 ignores the PC start bit or something...
> >
> >The protocol is 9-bit multi-drop, which i already implemented on PC
> >side using Space and Mark parities, it worked fine with some other
> >9-bit PIC devices.
> >
> 
> Remember that serial data is sent lsb first. It seems something odd is
> happening at the end of reception, not at the start.

Good point! I didn't know that, that make sense! But how can you
explain that if the MSB is "0" the byte is not received at all?

Re: 8051 serial problems - Edo Reshef - 04:38 22-04-04

Tilmann Reh <t...@despammed.com> wrote in message news:<c665p1$qg2$1...@online.de>...

> I think the problem is somewhere in this area. PCs are not likely
> to support 9-bit frames, and if it works, it's not really safe
> or reproducible.
> Maybe your positive experience was made with another PC or another
> software configuration.

I have done 9-bit framing with a PC at 57600 baud rate communicating
to a PIC controller, it works perfect, sending the 9-bit is really
easy, receiving it a bit is more tricky but I'm not interested in
receiving so I'm OK.

> I strongly recommend to look at the interface lines with a DSO
> and check if the PC really sends correctly.
> You might also consider testing the communication at lower
> speeds first (where the PC hack might eventually work).
> 
> Did you also try the other direction already?

I'll check it with a DSO and see what comes up, I have a really old
DSO so I will see if i can make it work....

Re: 8051 serial problems - Jim Granville - 04:42 22-04-04

Edo Reshef wrote:
> Good point! I didn't know that, that make sense! But how can you
> explain that if the MSB is "0" the byte is not received at all?

Because then the stop bit is invalid (due to baud-timing-skew)....
Post up your xtal, and timer reload values, and there are plenty
here who will spot a ooops...
-jg


| 1 | 2 | next