LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MCP2515 or MCP25625 CAN Controller

Solved!
Go to solution

I am wondering if anyone here has worked with the MCP2515 or MCP25625 CAN Controller in LabVIEW. I see a few posts here of people asking the same question but the conversation never really goes anywhere. 

 

I am asking specifically for use on a myRIO 1950 which has the required SPI interface. I have a basic understanding of SPI communication but it would take me awhile to write VIs specific for the MCP2515 chip.

 

I have purchased and used the Stratom X-CAN module which works well. Unfortunately, their VIs are password locked and they tie up the FPGA which prevents me from using any other inputs or outputs on the myRIO which are needed for my project.

0 Kudos
Message 1 of 5
(2,925 Views)

So I have worked with the MCP2515 in the past.  Back then I was mostly interested in making my own XNet like device on the cheap.  This was before NI's relatively low cost USB 8502.  Back then the only USB XNet option was to buy a USB cDAQ chassis, and get a single XNet port per slot.  Using an Arduino I was able to configure the interface, and dump raw CAN frames over USB.  The Arduino Uno really couldn't keep up, and so I looked into logging to the onboard SD card which also didn't quite work well.  If I were to try it again I'd use a Teensy which has onboard CAN stuff, and lots more processing power.

 

Anyway back to the MCP2515.  The Stratom module is likely just a wrapper around the functions of the MCP2515 datasheet which can be found online.  And if you want to see some examples of it working there are several C libraries again written for the Arduino.  

 

https://github.com/autowp/arduino-mcp2515

https://github.com/coryjfowler/MCP_CAN_lib

 

Sorry the Stratom module is so locked down.  One other option I haven't had a chance to test out is installing XNet on the myRIO, and then using the USB 8502 I mentioned earlier.  I do have a myRIO and an 8502 but they are being used on other projects right now.

0 Kudos
Message 2 of 5
(2,862 Views)
Solution
Accepted by topic author cdrps

Stratom got back to me! They walked me through the process. Basically follow the instructions on the following link to create a custom FPGA project: https://learn-cf.ni.com/teach/riodevguide/procedure/fpga_modify-default-myrio-personality.html

Then inside the Realtime VI (open RT Main Modified), I placed the "Create X-CAN Session" VI and to test things out I put in the "LED_Write" VI with opposite and alternating values to make sure it was actually working.

So fortunately the answer is as simple as continuing to use the Stratom X-CAN which makes things quite a bit easier for me.

 

Thank you Hooovahh for the response as well. I was considering creating my own wrapper for one of those Arduino libraries but I would be at the starting point of that learning curve.

0 Kudos
Message 3 of 5
(2,838 Views)

Did they happen to mention anything about removing block diagram passwords by chance?  I've never used one but am interested in possibly using the code on a Raspberry Pi, and the low level implementation of the registers could be useful there.  I'm more comfortable in LabVIEW than C so making a XNet replacement that is stand alone might be easier using a Pi and LINX.

0 Kudos
Message 4 of 5
(2,824 Views)

Since they still sell and support X-CAN it might be in their best interest not to. But it wouldn't hurt to ask. 

The solution I posted above is all I really needed and they were very helpful in getting me to that point.

 

Someone can point you in the right direction if you contact info@stratom.com

0 Kudos
Message 5 of 5
(2,802 Views)