HCS12: Resistance for SCI loopback

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS12: Resistance for SCI loopback

1,618 Views
Red
Contributor I
Hi all,
 
I'm working on a project with an HCS12 (MC9S12DP512) MCU.  One of the SCI ports of the MCU will normally be used for communication.  However, there will be times when we want to loopback the TX port to the RX port (it's a bit of a long story whywe want to do this.)  When we do this loopback, we need the SCI to function so that the MCU will receive the data that it sends.
 
Rather than just short the two ports together, I want to put a resistor between them to protect against the software wrongly configuring the ports and causing a logic conflict (firstly to protect the ports but also to keep the power consumption to a minimum should this occur.)
 
My question is, is there anything I need to be wary of when doing this?  I'm looking at using a 10K resistor to restrict the current to 0.5mA in worst case scenario.  It's worked fine in the testing that I've done but I want to be sure that I haven't missed anything.  I haven't found anything to suggest that there is a limit on the resistance you can place on an SCI line.  The only issue I can think of is the capacitance of the line and RX port which, for 115kbs communcation, shouldn't be affected by 10K resistance.
 
Thanks,
 
Red
 
 
Labels (1)
0 Kudos
3 Replies

407 Views
bigmac
Specialist III
Hello Red,
 
There is no conflict between the TXD and RXD pins of the MCU, since RXD is always an input.  The potential conflict would be between the receive buffer output (perhaps RS232 or RS485 receiver) and TXD output.
 
The use of a series resistor, as you describe, will work only if the receive buffer output can be disabled (high-Z) when the loopback test is required, and provides a low-Z drive to over-ride the loopback path, when it is operational.  If the receive buffer cannot be disabled, you will probably need to use a separate multiplexer device to select the data path required for either normal or loopback operation.
 
I would expect that a resistor value of 4k7 or 10k should be satisfactory.
 
Regards,
Mac
 
0 Kudos

407 Views
Red
Contributor I
Hi bigmac,
 
Thanks for the reply.
 
Something that I should have mentioned in my first post is that, during the loopback, there will only be the resistor connected to the TX and RX pins.  The SCI port is directly accessed from a connector so we can physically disconnect what would normally be connected (ie. some sort of transceiver or another SCI device) and plug in a loopback connector that has the resistor across the required contacts.
 
I appreciate that, in normal operation, there should never be a conflict between the TX and RX pins.  What I want to project against is any software problem that results in the SCI channels being disabled and the corresponding general i/o pins being set as outputs with different logic levels.  It is admittedly a highly unlikely scenario but we are in a low quantity, niche market so the cost of adding a resistor is pretty insignificant.
 
 
 
 
 
0 Kudos

407 Views
Lundin
Senior Contributor IV
For that to happen, you would need RAM noise / highly unlikely bugs first disabling the SCI, and then setting the correct pin in the DDRS register to output (they are inputs oor).

To protect against that extremely unlikely case, simply write to the SCI enable flag continously from the main() loop of the program. As long as the SCI is enabled all I/O logic will be disabled. They cannot be enabled at the same time on HCS12.
0 Kudos