Yahoo Groups archive

68300

Index last updated: 2026-04-29 00:01 UTC

Thread

68376: RS485 half duplex setup

68376: RS485 half duplex setup

2002-06-07 by jgodiska2002

Hello List,

I need some advise on setting up a half-duplex RS485 channel using 
both the QSM's Serial Communication Interface and also the TPU's UART 
function.  I have two serial ports on my circuit board, and I have 
already set up hardware for both.  My driver chips have both Drive 
Enable and Receive Enable pins, which I have tied together.  I am 
using PC6 to control the DE/RE line for the QSM's SCI port and PC5 to 
control the one for the TPU port.

My question is this:  Is there a status bit or some flagging 
mechanism I can use to say that when the 68376 is done transmitting a 
message, I can now safely change the state of the DE/RE bit and 
prepare to receive data?  I have a concern about when a flag would be 
set compared to when the last bit in the data is shifted onto the bus.

I am hoping to avoid having to use any kind of delay timer to switch 
from TX->RX or RX->TX.

Thanks,
Jim

Re: [68300] 68376: RS485 half duplex setup

2002-06-07 by Scott Newell

>I need some advise on setting up a half-duplex RS485 channel using 
>already set up hardware for both.  My driver chips have both Drive 
>Enable and Receive Enable pins, which I have tied together.  I am 

Oops...see below.


>My question is this:  Is there a status bit or some flagging 
>mechanism I can use to say that when the 68376 is done transmitting a 
>message, I can now safely change the state of the DE/RE bit and 

SCI does: compare and contrast the TC (data has been completely shifted
out) and TDRE (transmit register is empty, ready for next byte) flags.  I
use the TDRE interrupt until the last byte, then switch to TC.  

As far as I know, the 'G' mask TPU UART does not have a TC flag, only TDRE.
 Maybe someone can offer a link to some custom TPU code to add the TC flag...


>I am hoping to avoid having to use any kind of delay timer to switch 
>from TX->RX or RX->TX.

I've also done the trick where you tie the receiver and transmitter
together, transmit the last byte, wait for the last byte to come in the
receiver, and then disable the transmitter.  However, you must leave the
receiver enabled during transmission, so tying the 485 DE and /RE lines
together won't work!


newell

Re: [68300] 68376: RS485 half duplex setup

2002-06-08 by Robert Smith

All serial ports that I am aware of have two registers on the transmitter
side; transmit data register and a transmit shift register.  The usual data
path is for the program to store the next byte to be transmitted into the
transmit data register.  If it is the first byte in a frame (meaning that
the transmit shift register is empty), that byte will be immediately
transfered into the transmit shift register, the transmitter will be started
to shift the data out onto the Tx data line and a transmit data register
empty interrupt (TDRE) will be posted to inform the program that the
transmit data register is empty and ready to receive the next byte of the
frame.

Upon receipt of a TDRE interrupt, the program should either a) store the
next byte of the frame in the transmit data register, or b) if the last byte
of the frame has already been sent then the program should disable the
transmit data register empty interrupt and then wait for a transmit complete
(TC) interrupt.

When the transmitter shifts out the list bit of any data byte, it examines
the transmit data register to see if another data byte is waiting in the
transmit data register to be sent.  If there is a byte waiting it is
immediately transferred to the transmit shift register, the transmitter is
re-started, and the next TDRE interrupt is posted.

The process continues untill the last bit of the last byte is shifted out of
the transmit serial register.  When that happens both the transmit data
register and the transmit shift register are empty (the complete frame has
been sent out the Tx data port), and the tranmitter posts a transmit
complete (TC) interrupt.

In a half duplex implementation, you should wait for the TC interrupt before
turning the link around, else you risk losing part of the last byte of any
given frame.  To turn the link around you should disable the transmitter,
enable the receiver, and then toggle the Rx Enable and Tx Enable bits on the
drivers.

There is some risk in tying the two driver enable bits together.  Depending
on the propagation delays of the two enables, you may wind up with both
directions enabled at the same time, thus introducing bus transients and
some risk of a latch up conditions.

Note - The above is a simplified summary of the function of the SCI port on
the MC68332 but will be applicable to all compatible SCI ports in the
MC683xx family devices.  Further detail is provided in the applicable
sections of your device's user manual.  Look for a section titled something
like "Transmitter Operation".

    Good Luck, Bob Smith

---   Avoid computer viruses, Practice safe hex  ---

-- Specializing in small, cost effective
    embedded control systems --


Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236   804/745-1065

  bobsmith5@...

----- Original Message -----
Show quoted textHide quoted text
From: "jgodiska2002" <jgodiska@...>
To: <68300@yahoogroups.com>
Sent: Friday, June 07, 2002 10:38 AM
Subject: [68300] 68376: RS485 half duplex setup


> Hello List,
>
> I need some advise on setting up a half-duplex RS485 channel using
> both the QSM's Serial Communication Interface and also the TPU's UART
> function.  I have two serial ports on my circuit board, and I have
> already set up hardware for both.  My driver chips have both Drive
> Enable and Receive Enable pins, which I have tied together.  I am
> using PC6 to control the DE/RE line for the QSM's SCI port and PC5 to
> control the one for the TPU port.
>
> My question is this:  Is there a status bit or some flagging
> mechanism I can use to say that when the 68376 is done transmitting a
> message, I can now safely change the state of the DE/RE bit and
> prepare to receive data?  I have a concern about when a flag would be
> set compared to when the last bit in the data is shifted onto the bus.
>
> I am hoping to avoid having to use any kind of delay timer to switch
> from TX->RX or RX->TX.
>
> Thanks,
> Jim
>
>
>
> ---------------------------------------------------
> To unsubscribe from this group, send an email to:
> 68300-unsubscribe@yahoogroups.com
>
> To learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>

RE: [68300] 68376: RS485 half duplex setup

2002-06-10 by Godiska, Jim

Thanks Bob.
But I am still unclear when using 2 TPU channels (as UARTs) to do an RS485 half-duplex. I still have the TDRE bit, but I believe I am missing the Transmit Complete flag. Is this true?
Thanks again,
Jim
-----Original Message-----
Show quoted textHide quoted text
From: Robert Smith [mailto:bobsmith5@...]
Sent: Saturday, June 08, 2002 8:22 AM
To: 68300@yahoogroups.com
Subject: Re: [68300] 68376: RS485 half duplex setup

All serial ports that I am aware of have two registers on the transmitter
side; transmit data register and a transmit shift register. The usual data
path is for the program to store the next byte to be transmitted into the
transmit data register. If it is the first byte in a frame (meaning that
the transmit shift register is empty), that byte will be immediately
transfered into the transmit shift register, the transmitter will be started
to shift the data out onto the Tx data line and a transmit data register
empty interrupt (TDRE) will be posted to inform the program that the
transmit data register is empty and ready to receive the next byte of the
frame.

Upon receipt of a TDRE interrupt, the program should either a) store the
next byte of the frame in the transmit data register, or b) if the last byte
of the frame has already been sent then the program should disable the
transmit data register empty interrupt and then wait for a transmit complete
(TC) interrupt.

When the transmitter shifts out the list bit of any data byte, it examines
the transmit data register to see if another data byte is waiting in the
transmit data register to be sent. If there is a byte waiting it is
immediately transferred to the transmit shift register, the transmitter is
re-started, and the next TDRE interrupt is posted.

The process continues untill the last bit of the last byte is shifted out of
the transmit serial register. When that happens both the transmit data
register and the transmit shift register are empty (the complete frame has
been sent out the Tx data port), and the tranmitter posts a transmit
complete (TC) interrupt.

In a half duplex implementation, you should wait for the TC interrupt before
turning the link around, else you risk losing part of the last byte of any
given frame. To turn the link around you should disable the transmitter,
enable the receiver, and then toggle the Rx Enable and Tx Enable bits on the
drivers.

There is some risk in tying the two driver enable bits together. Depending
on the propagation delays of the two enables, you may wind up with both
directions enabled at the same time, thus introducing bus transients and
some risk of a latch up conditions.

Note - The above is a simplified summary of the function of the SCI port on
the MC68332 but will be applicable to all compatible SCI ports in the
MC683xx family devices. Further detail is provided in the applicable
sections of your device's user manual. Look for a section titled something
like "Transmitter Operation".

Good Luck, Bob Smith

--- Avoid computer viruses, Practice safe hex ---

-- Specializing in small, cost effective
embedded control systems --


Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236 804/745-1065

bobsmith5@...

----- Original Message -----
From: "jgodiska2002"
To: <68300@yahoogroups.com>
Sent: Friday, June 07, 2002 10:38 AM
Subject: [68300] 68376: RS485 half duplex setup


> Hello List,
>
> I need some advise on setting up a half-duplex RS485 channel using
> both the QSM's Serial Communication Interface and also the TPU's UART
> function. I have two serial ports on my circuit board, and I have
> already set up hardware for both. My driver chips have both Drive
> Enable and Receive Enable pins, which I have tied together. I am
> using PC6 to control the DE/RE line for the QSM's SCI port and PC5 to
> control the one for the TPU port.
>
> My question is this: Is there a status bit or some flagging
> mechanism I can use to say that when the 68376 is done transmitting a
> message, I can now safely change the state of the DE/RE bit and
> prepare to receive data? I have a concern about when a flag would be
> set compared to when the last bit in the data is shifted onto the bus.
>
> I am hoping to avoid having to use any kind of delay timer to switch
> from TX->RX or RX->TX.
>
> Thanks,
> Jim
>
>
>
> ---------------------------------------------------
> To unsubscribe from this group, send an email to:
> 68300-unsubscribe@yahoogroups.com
>
> To learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com

To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

RE: [68300] 68376: RS485 half duplex setup

2002-06-10 by jeffrey.tenney@gm.com

Jim, Once you get TDRE for the last data byte, there s an absolute maximum amount of time until the shift register is also empty (the elusive TC condition).

RE: [68300] 68376: RS485 half duplex setup

2002-06-10 by Godiska, Jim

Well, I was hoping to avoid a timer. But thanks, I like the CTM one-shot idea.
Jim
-----Original Message-----
Show quoted textHide quoted text
From: jeffrey.tenney@... [mailto:jeffrey.tenney@...]
Sent: Monday, June 10, 2002 4:23 PM
To: 68300@yahoogroups.com
Subject: RE: [68300] 68376: RS485 half duplex setup


Jim,

Once you get TDRE for the last data byte, there's an absolute maximum
amount of time until the shift register is also empty (the elusive TC
condition). Depending on your situation, you could just wait it out or set
a quick timed one-shot interrupt (I recommend using the CTM4) that would
effectively be your TC interrupt (at a different interrupt vector as a
bonus!).

Transmission begins immediately upon TDRE notification, so you can use your
baud rate to calculate the character time (don't forget start, parity, and
stop bits).

Jeff





"Godiska, Jim" on 06/10/2002 10:21:55 AM

Please respond to 68300@yahoogroups.com

To: "'68300@yahoogroups.com'" <68300@yahoogroups.com>
cc:
Subject: RE: [68300] 68376: RS485 half duplex setup


Thanks Bob.

But I am still unclear when using 2 TPU channels (as UARTs) to do an RS485
half-duplex. I still have the TDRE bit, but I believe I am missing the
Transmit Complete flag. Is this true?

Thanks again,
Jim

-----Original Message-----
From: Robert Smith [mailto:bobsmith5@...]
Sent: Saturday, June 08, 2002 8:22 AM
To: 68300@yahoogroups.com
Subject: Re: [68300] 68376: RS485 half duplex setup


All serial ports that I am aware of have two registers on the transmitter
side; transmit data register and a transmit shift register. The usual data
path is for the program to store the next byte to be transmitted into the
transmit data register. If it is the first byte in a frame (meaning that
the transmit shift register is empty), that byte will be immediately
transfered into the transmit shift register, the transmitter will be
started
to shift the data out onto the Tx data line and a transmit data register
empty interrupt (TDRE) will be posted to inform the program that the
transmit data register is empty and ready to receive the next byte of the
frame.

Upon receipt of a TDRE interrupt, the program should either a) store the
next byte of the frame in the transmit data register, or b) if the last
byte
of the frame has already been sent then the program should disable the
transmit data register empty interrupt and then wait for a transmit
complete
(TC) interrupt.

When the transmitter shifts out the list bit of any data byte, it examines
the transmit data register to see if another data byte is waiting in the
transmit data register to be sent. If there is a byte waiting it is
immediately transferred to the transmit shift register, the transmitter is
re-started, and the next TDRE interrupt is posted.

The process continues untill the last bit of the last byte is shifted out
of
the transmit serial register. When that happens both the transmit data
register and the transmit shift register are empty (the complete frame has
been sent out the Tx data port), and the tranmitter posts a transmit
complete (TC) interrupt.

In a half duplex implementation, you should wait for the TC interrupt
before
turning the link around, else you risk losing part of the last byte of any
given frame. To turn the link around you should disable the transmitter,
enable the receiver, and then toggle the Rx Enable and Tx Enable bits on
the
drivers.

There is some risk in tying the two driver enable bits together. Depending
on the propagation delays of the two enables, you may wind up with both
directions enabled at the same time, thus introducing bus transients and
some risk of a latch up conditions.

Note - The above is a simplified summary of the function of the SCI port on
the MC68332 but will be applicable to all compatible SCI ports in the
MC683xx family devices. Further detail is provided in the applicable
sections of your device's user manual. Look for a section titled something
like "Transmitter Operation".

Good Luck, Bob Smith

--- Avoid computer viruses, Practice safe hex ---

-- Specializing in small, cost effective
embedded control systems --


Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236 804/745-1065

bobsmith5@...

----- Original Message -----
From: "jgodiska2002"
To: <68300@yahoogroups.com>
Sent: Friday, June 07, 2002 10:38 AM
Subject: [68300] 68376: RS485 half duplex setup


> Hello List,
>
> I need some advise on setting up a half-duplex RS485 channel using
> both the QSM's Serial Communication Interface and also the TPU's UART
> function. I have two serial ports on my circuit board, and I have
> already set up hardware for both. My driver chips have both Drive
> Enable and Receive Enable pins, which I have tied together. I am
> using PC6 to control the DE/RE line for the QSM's SCI port and PC5 to
> control the one for the TPU port.
>
> My question is this: Is there a status bit or some flagging
> mechanism I can use to say that when the 68376 is done transmitting a
> message, I can now safely change the state of the DE/RE bit and
> prepare to receive data? I have a concern about when a flag would be
> set compared to when the last bit in the data is shifted onto the bus.
>
> I am hoping to avoid having to use any kind of delay timer to switch
> from TX->RX or RX->TX.
>
> Thanks,
> Jim
>
>
>
> ---------------------------------------------------
> To unsubscribe from this group, send an email to:
> 68300-unsubscribe@yahoogroups.com
>
> To learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu <http://www.motorola.com/mcu>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
<http://docs.yahoo.com/info/terms/>
>
>
>


---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com

To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .



(See attached file: C.htm)





---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com

To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

RE: [68300] 68376: RS485 half duplex setup

2002-06-12 by Bill Hartmann

Also you can send a dummy character at the end of the data string.
Then after the last TDRE you can turn the system around.

We have been doing that for years with a 6809/6850 and 6801 radio
systems.



On Mon, 10 Jun 2002 17:05:07 -0400, Godiska, Jim wrote:

>Well, I was hoping to avoid a timer.  But thanks, I like the CTM one-shot
>idea.
> 

--------------------------------------------------------------------------------
Bill Hartmann

Lake Tapawingo, MO (near Kansas City)

billhart@...

RE: [68300] 68376: RS485 half duplex setup

2002-06-12 by Melear Charles-rdph40

Hello everyone,
 
On the QSM module of the MC68300 and MC68HC16 families, there is the TDRE bit and the TC bit.
 
The TDRE bit tells you that another byte can be loaded into the "transmit data buffer" which is different from the "transmit shifter".
 
The TC bit tells you that the "transmit shifter" is empty and that there is no byte waiting in the "transmit data buffer".
 
 
 
 
On the QSPI, there is a somewhat similar situation.  The SPIF flag tells you that a new byte can be written to the SPI data buffer.  It does not necessarily mean that the "shifter" is empty as well.
 
The only way to tell that the QSPI shifter is empty is to monitor the SPE bit which will "self clear" when the transmission is finished.
 
Regards,
 
Charlie
Show quoted textHide quoted text
-----Original Message-----
From: Bill Hartmann [mailto:billhart@...]
Sent: Wednesday, June 12, 2002 6:47 AM
To: 68300@yahoogroups.com
Subject: RE: [68300] 68376: RS485 half duplex setup


Also you can send a dummy character at the end of the data string.
Then after the last TDRE you can turn the system around.

We have been doing that for years with a 6809/6850 and 6801 radio
systems.



On Mon, 10 Jun 2002 17:05:07 -0400, Godiska, Jim wrote:

>Well, I was hoping to avoid a timer.  But thanks, I like the CTM one-shot
>idea.
> 

--------------------------------------------------------------------------------
Bill Hartmann

Lake Tapawingo, MO (near Kansas City)

billhart@...


---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com

To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu> 



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .

RE: [68300] 68376: RS485 half duplex setup

2002-06-17 by Robert Yablonski

Group,

I am confused about how to assign Data Port pull up/down functions during 
reset.  According to table 4-19, chip select pin functions, I can change 
the meaning of several of the pins during reset.  There are twelve pins 
shown, but in the text it says that only 8 data bus lines are associated.

How are they mapped?

The user manual says refer to 4.8.4, which even confused me more.

I have taken over an existing design where the previous engineer has 
assigned boot values to the data bus as follows.

D0 = 1
D1 = 1
D2 = 1
D3 = 0
D4 = 1
D5 = 1
D6 = 1
D7 = 1
D8 = 0
D9 = 0
D11 = 1

NOTICE D10 WAS SKIPPED

How do I figure out how Table 4-19 is initialized?

Robert E. Yablonski
Hunt Dabney & Associates

RE: [68300] 68376: RS485 half duplex setup

2002-06-17 by jeffrey.tenney@gm.com

See Table 4-16, same book.

Jeff





Robert Yablonski <yabo@...> on 06/17/2002 01:34:37 PM

Please respond to 68300@yahoogroups.com

To:    68300@yahoogroups.com
cc:
Show quoted textHide quoted text
Subject:    RE: [68300] 68376: RS485 half duplex setup


Group,

I am confused about how to assign Data Port pull up/down functions during
reset.  According to table 4-19, chip select pin functions, I can change
the meaning of several of the pins during reset.  There are twelve pins
shown, but in the text it says that only 8 data bus lines are associated.

How are they mapped?

The user manual says refer to 4.8.4, which even confused me more.

I have taken over an existing design where the previous engineer has
assigned boot values to the data bus as follows.

D0 = 1
D1 = 1
D2 = 1
D3 = 0
D4 = 1
D5 = 1
D6 = 1
D7 = 1
D8 = 0
D9 = 0
D11 = 1

NOTICE D10 WAS SKIPPED

How do I figure out how Table 4-19 is initialized?

Robert E. Yablonski
Hunt Dabney & Associates



---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com

To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

(no subject)

2002-06-17 by Robert Yablonski

Thanks,

R. Yablonski

At 04:57 PM 6/17/02 -0400, you wrote:
Show quoted textHide quoted text
>See Table 4-16, same book.
>
>Jeff
>
>
>
>
>
>Robert Yablonski <yabo@...> on 06/17/2002 01:34:37 PM
>
>Please respond to 68300@yahoogroups.com
>
>To:    68300@yahoogroups.com
>cc:
>Subject:    RE: [68300] 68376: RS485 half duplex setup
>
>
>Group,
>
>I am confused about how to assign Data Port pull up/down functions during
>reset.  According to table 4-19, chip select pin functions, I can change
>the meaning of several of the pins during reset.  There are twelve pins
>shown, but in the text it says that only 8 data bus lines are associated.
>
>How are they mapped?
>
>The user manual says refer to 4.8.4, which even confused me more.
>
>I have taken over an existing design where the previous engineer has
>assigned boot values to the data bus as follows.
>
>D0 = 1
>D1 = 1
>D2 = 1
>D3 = 0
>D4 = 1
>D5 = 1
>D6 = 1
>D7 = 1
>D8 = 0
>D9 = 0
>D11 = 1
>
>NOTICE D10 WAS SKIPPED
>
>How do I figure out how Table 4-19 is initialized?
>
>Robert E. Yablonski
>Hunt Dabney & Associates
>
>
>
>---------------------------------------------------
>To unsubscribe from this group, send an email to:
>68300-unsubscribe@yahoogroups.com
>
>To learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
>
>
>
>
>---------------------------------------------------
>To unsubscribe from this group, send an email to:
>68300-unsubscribe@yahoogroups.com
>
>To learn more about Motorola Microcontrollers, please visit
>http://www.motorola.com/mcu
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.