Tuesday, 9 July 2019

microcontroller - Switching a resistor by software


I want to communicate with a microcontroller over a CAN bus which needs (ideally) 120 ohm terminal resistors at the end of each bus. I want to integrate this resistor into the circuit and activate it only if it is needed (depending on which software is being flashed on the controller). Is it possible to switch a resistor using software?


Basically what I have in mind is something like this: What's the automatic equivalent of a variable resistor?. With only two states (120 ohm and 0 ohm open circuit) switched by a digital signal from the microcontroller.



Answer



There are a couple ways of doing the termination with CAN (from AD application note AN1123):



enter image description here


Here is one scheme that uses switched termination to a common mode level, using two smallish p-channel MOSFETs. Raising the gates to +5V turns off the termination.


enter image description here


As an alternative, there are some pretty low-resistance analog switches available (a couple ohms or less) which might simplify things but you'd have to analyze how well they'd do with ESD etc., and many won't handle even 5V. For example the TS5A3167.


enter image description here


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...