Author Topic: Driving an LED with a CAN transceiver??  (Read 3039 times)

0 Members and 1 Guest are viewing this topic.

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Driving an LED with a CAN transceiver??
« on: May 25, 2017, 01:13:40 pm »
OK, this isn't (quite) as stupid as it sounds (promise  :-DD)

I have a remote device that is controlled by a hardwired PWM (~1KHz, 5 ->95% duty)  input to an optocoupler in that device.  That device is about to move to CAN bus based control, but i would like to protect for being able to control the old level devices as well as the new CAN ones without changing ECU hardware that much.  I am also looking for very low (MIL) RFI emissions, so a differential output is a good idea.

So, i think, i could use a CAN transceiver to drive that remote optocoupler, as they are usually rated to drive 5v into around 50 ohms minimum, that way, a simple jumper on the pcb could configure the output to suit either type of device, and being differential, the usual CAN common mode chokes etc will help for reducing EMI (in conjunction with twisted pair wires in the loom etc)

As this is pretty outside the usual usage for such transceivers i will of course have to test it out properly, but can anyone think why it shouldn't work at a first glance??

 (not sure of the exact current with which the opto is being driven at the moment, but i'd guess it's pretty low current (<5mA i suspect) as its output is just driving an IC pin in the device)
 

Offline Bendba

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Re: Driving an LED with a CAN transceiver??
« Reply #1 on: May 25, 2017, 01:52:16 pm »
Hi,

Will CAN controlled devices be connected to the bus at the same time as will PWM devices?
If so, how is the PWM controlled device going to discriminate a CAN transmission from a PWM input?
Stop dreaming your life, start leaving your dreams.
 

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: Driving an LED with a CAN transceiver??
« Reply #2 on: May 25, 2017, 05:57:22 pm »
No, it will be a strict OR situation.  Current slaves just take a PWM signal, and obviously don't report any info back to the master.  The new slave is going CAN so bi-directional info can now flow. The main thing is that drive both options with the smallest possible hardware change, so i could wire the PWM output pin to the CAN TX wire, and just tri-state the appropriate pin to chosse between CAN and PWM output.  i think.......  ;-)
 

Offline Bendba

  • Regular Contributor
  • *
  • Posts: 216
  • Country: au
Re: Driving an LED with a CAN transceiver??
« Reply #3 on: May 25, 2017, 09:53:32 pm »
Hi,

Would you have a diagram of how you are thinking of wiring it?
Are you talking about TX wire between CPU and CAN transceiver? If so, you will need to add a CAN transceiver on the other end for the PWM device to turn the differential signal back into PWM

Just to make sure I got it right,  you want to do this:

PWM generator
\/
CAN transceiver
\/
CAN bus
\/
CAN transceiver
\/
Optocoupler
« Last Edit: May 25, 2017, 10:03:38 pm by Bendba »
Stop dreaming your life, start leaving your dreams.
 

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: Driving an LED with a CAN transceiver??
« Reply #4 on: May 26, 2017, 01:05:36 pm »
No, mean directly drive the LED in the remote optocoupler with the differential output of the CAN transceiver!

When output is Recessive (both lines at 2.5v) the optocoupler LED will be off, when Dominant, the LED is driven on




I would simply PWM the TX input to the transceiver from a normal GPIO pin, instead of driving it with the CAN  TX line from the controller.



 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3327
  • Country: gb
Re: Driving an LED with a CAN transceiver??
« Reply #5 on: May 26, 2017, 01:55:56 pm »
Sounds reasonable to me.  The only snag I can think of right now is that some transceivers have a built in timeout to ensure a dominant state can not be continuously asserted. Either use a transceiver without this protection or ensure the timeout is somewhat larger than your 1ms PWM period.
 

Offline max_torqueTopic starter

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: Driving an LED with a CAN transceiver??
« Reply #6 on: May 26, 2017, 02:12:28 pm »
Typical transceiver like MCP2551 has a 1.25ms maximum dominant state time out, which looks like it fits with my 1KHz current PWM frequency (although i can easily bump that up if necessary)

http://ww1.microchip.com/downloads/en/DeviceDoc/21667f.pdf
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf