View previous topic :: View next topic |
Author |
Message |
paddy
Joined: 04 Nov 2012 Posts: 15
|
Interfacing MCP4921 with PIC18F4620 through optocoupler |
Posted: Wed Mar 11, 2015 12:24 am |
|
|
Hi,
Greetings of the day!!!
I am using driver files of MCP4921 to interface with PIC18F4620.
Compiler version is 4.119.
Everything working fine when I directly interface MCP4921 with PIC18F4620.
But when I insert KP1010 optocoupler in between DAC and microcontroller it is not working. I have tried same with 6N139 optocoupler. But in both cases it fails.
Please find attached schematic for reference.
Please advice.
Regards,
Paddy
https://www.dropbox.com/s/yrcfxx5tve6pr6d/MCP4921.bmp?dl=0 |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Wed Mar 11, 2015 2:37 am |
|
|
Have you looked at waveforms on both side of the optos with a 'scope?
Mike |
|
|
paddy
Joined: 04 Nov 2012 Posts: 15
|
|
Posted: Wed Mar 11, 2015 2:47 am |
|
|
Hi Mike,
I do not have oscilloscope to check the waveforms. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Mar 11, 2015 6:12 am |
|
|
What speed is the SPI bus ?
Optocouplers generally are 'slow speed' devices, so you'll need to read the datasheets, and decide if the one you choose has the proper rise time,fall time, overall speed needed for your application.
You just can't 'grab one off the shelf' and expect it to work !
Ok, you can do that for 'line follower robots' but NOT for any high speed application.
You will need a 'scope' to SEE the waveforms and probably have to 'adjust' the resistors as well.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Wed Mar 11, 2015 6:54 am |
|
|
The KP1010, is only rated to 80KHz max. It'll not even be getting there though, the 10K output resistors will limit the rise time significantly. Something like 1K needed to get full speed.
Use something like a 6N137, with 470R resistors on the output, to get reasonable speed operation. |
|
|
paddy
Joined: 04 Nov 2012 Posts: 15
|
|
Posted: Wed Mar 11, 2015 11:59 pm |
|
|
Hi all,
Thanks for your suggestions. I will check out the options which you have suggested.
Thanks,
Paddy |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Mar 13, 2015 3:31 am |
|
|
First question:-
How fast do you HAVE to update the DAC?
Everything else depends on the answer.
Mike |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Fri Mar 13, 2015 6:35 am |
|
|
2nd question
WHY the optocouplers ?
I have to assume that the power supply may be common, SPI is a SHORT distance buss, and everything is on the same PCB ?
It'll take a LOT of R&D time and effort to get even 1 MHz SPI buss speed from an optocoupler configuration.
Jay |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Fri Mar 13, 2015 10:30 am |
|
|
if you really need to use isolation - and you want high data rates
consider GMR type isolaters.
i used the following for a very reliable 4 mhz clock/data isolation circuit for
a veterinary life-sciences portable product and was quite happy.
it is under $4 ea in quantity.
note: it only has 2.5 kv or so isolation but the speed can't be beat.
http://www.nve.com/Downloads/il710.pdf |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Sat Mar 14, 2015 7:43 am |
|
|
I have used SPI driving a different DAC, for opto-coupled 4-20mA analog outputs. I used the 6N137, and ran the SPI at 1MHz.
This is why I suggested the 6N137, since it worked well for me. |
|
|
|