07-17-2014 04:38 PM
I am starting on a project that I'm planning on using a CAN module based on the MCP2515 Chip to pull CAN messages in a listen only mode from a Car ECU (aftermarket ECU, not OBDII format). This CAN chip uses SPI communication and I am planning on using a myRIO as the DAQ.
Has anyone written a VI library that uses this chip before or can point me in a good direction to develop this. I have not found any example and most of the other programing code I have found is based on object oriented programing which is difficult for me to translate into LabView code. Thank you in advance for any advice or help.
Data Sheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21801G.pdf
07-18-2014 03:40 PM
I haven't worked with that chip in the past, but if it communicates via SPI, then is there just a set of SPI instructions given in the user manual for the chip? The myRIO module has some VIs already configured for SPI communication, so all you would have to know is what instructions to send.
Also, the Academic Hardware Products (http://forums.ni.com/t5/Academic-Hardware-Products-ELVIS/bd-p/10) page is a little more specific to the myRIO and the Automotive and Embedded Networks page (http://forums.ni.com/t5/Automotive-and-Embedded-Networks/bd-p/30) is a little more specific to CAN. If you post you're question on one of those pages, you may get a better response from the community.
Regards,
07-21-2014 09:35 AM
I am interested in hearing if you are able to get this working well. I have used the MCP2515 before in an Arduino. Here is the source I used.
https://github.com/franksmicro/Arduino/tree/master/libraries/MCP2515
I didn't write much of that souce, just a few small additions for extended messages. But the source is very easy to follow which is why I started there and then added improvements and sent my changes back to the original developer.
One issue I had to be aware of is that the chip only has a two frame RX buffer. So you need to constantly be reading frames. If you are reading a message, and two frames come in before you are done reading, the data will be lost. I think the ODB2 is at 500K baud. I'm sure a myRIO is fast enough, just make sure your code is.
On the Arduino at 16MHz, and the SPI at 8MHz it was fast enought to read both buffers, but I didn't have enought time to sort the message and arrange them for very long. Looking at the data sheet the MCP2515 has a maximum SPI rate of 10MHz too so don't try to go any faster than that. Good luck and post back if you get anything working. I'd try myself but I don't have a myRIO to play with.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord