Jump to content
Sign in to follow this  
TheDirty1426459890

LM4F120 CAN peripheral

Recommended Posts

Has anyone tried out the CAN peripheral?

 

I have a motorcycle that I ruined the gauge cluster.  I made up a new cluster with a LPC1752, but it's missing tachometer and engine temp because these are only provided on a CANBUS from the ECU and not discrete signals.  I have the CAN hardware setup with the LPC1752 with a MCP2551, but I just haven't tried the coding because it looks like a real pain.

 

I figured with the Launchpad and the driver lib I would give it a try with this.  Looking to see if anyone has any sample code using the driverlib.  I didn't see any driverlib examples in the imported examples when I setup CCS.

 

I'm just making up a simple plugin PCB with a MCP2551 on it right now that I'll etch and get started on.  If nobody has anything I'll start from scratch next week on trying to figure it out.  I don't have any prior experience with CAN, for automotive I usually can get away with just LIN.

Share this post


Link to post
Share on other sites

I found some examples in the StellarisWare Peripherals Examples directory that I can look at.

 

EDIT:  Wow, this is the most inline documentation I have ever seen for example code.  There's like a paragraph of explanation for each few lines of code.

 

All you need is a transceiver and you are good to go. I've used that library to get readings from my car.

Share this post


Link to post
Share on other sites

The simplerx example looks just that, simple.  It does just what I need since the bus on my motorcycle does not have id'ed packets it will take me a bit to decypher it all.

 

I've designed up a quick board with a mcp2551 on it and I'll etch it this weekend.  Not looking forward to the amount of drilling that needs to be done for the launchpad headers.

Share this post


Link to post
Share on other sites

I'm embarrassed about the etching job.  I ran out of alcohol to clean the board and it didn't take very well, but it's all put together if not pretty.  I also realized after I took the picture that the board was plugged into the launchpad backwards, but I'm too lazy to retake the picture.  Oh well, I'll try it out next week.  I didn't want to just put on the CAN transceiver and waste all the rest of the space so I put on a place to plug in an HC-05 board and cheap LCD.

 

20121215-stel-can-001.jpg

Share this post


Link to post
Share on other sites

I'm embarrassed about the etching job.  I ran out of alcohol to clean the board and it didn't take very well, but it's all put together if not pretty.  I also realized after I took the picture that the board was plugged into the launchpad backwards, but I'm too lazy to retake the picture.  Oh well, I'll try it out next week.  I didn't want to just put on the CAN transceiver and waste all the rest of the space so I put on a place to plug in an HC-05 board and cheap LCD.

 

20121215-stel-can-001.jpg

Looks sweet1.. is that a BT board?

Share this post


Link to post
Share on other sites

Yes, it's an HC-06 I think, not the HC-05 I originally stated.  The one without the host mode option.  It has the original linvor firmware on it.  I've been playing with interfaces to Android, which is pretty easy over bluetooth serial.

 

If I get this running I can use it to send CAN messages to display on an Android device app or just a serial bridge to PC.

Share this post


Link to post
Share on other sites

I also used the MCP2551 to connect a LM4F120 (on the Stellaris Launchpad) to a CAN bus. It's really simple.. just connect the TX and RX lines to the MCP2551 and set the proper pin configuration in the simple_tx example (I used PE4/PE5 for the CAN0 module). Here is my mini-howto: http://www.fischl.de/arm/can_bus_interface_for_stellaris_launchpad/

Share this post


Link to post
Share on other sites

I also used the MCP2551 to connect a LM4F120 (on the Stellaris Launchpad) to a CAN bus. It's really simple.. just connect the TX and RX lines to the MCP2551 and set the proper pin configuration in the simple_tx example (I used PE4/PE5 for the CAN0 module). Here is my mini-howto: http://www.fischl.de/arm/can_bus_interface_for_stellaris_launchpad/

Good work.. if you make a writeup here in the Projects forum, you can add it to the Project of the Month.

Share this post


Link to post
Share on other sites

Hey thanks.  Nothing new here, but at least it confirms it should work with what I have.  I've been sick this week and the motorcycle isn't going anywhere until next Summer, so this isn't a high priority for me.

 

What I know about the CANBUS on this motorcycle.  The transmission speed is 1Mbit.  The packets are only sent from the ECU to the gauge.  Because of this there's no ID on the packets, everything just goes.  Unfortunately I have no idea about the actual packets so I'm going to need to decypher what data is being sent in what packets.

Share this post


Link to post
Share on other sites

Hey thanks.  Nothing new here, but at least it confirms it should work with what I have.  I've been sick this week and the motorcycle isn't going anywhere until next Summer, so this isn't a high priority for me.

 

What I know about the CANBUS on this motorcycle.  The transmission speed is 1Mbit.  The packets are only sent from the ECU to the gauge.  Because of this there's no ID on the packets, everything just goes.  Unfortunately I have no idea about the actual packets so I'm going to need to decypher what data is being sent in what packets.

I used QuickCan to sniff packets of my Mazda3. I had to filter of IDs as the amount of data that gets transferred in insane.

Share this post


Link to post
Share on other sites

I also used the MCP2551 to connect a LM4F120 (on the Stellaris Launchpad) to a CAN bus. It's really simple.. just connect the TX and RX lines to the MCP2551 and set the proper pin configuration in the simple_tx example (I used PE4/PE5 for the CAN0 module). Here is my mini-howto: http://www.fischl.de/arm/can_bus_interface_for_stellaris_launchpad/

 

Hi, i'm new here, and new to stellaris too, I really like your aproach to your problem with the CAN bus, would  you like to share your schematic and code over the CAN+Bluetooth+LCD please?

 

Ohhh, Im sorry ! was TheDirty post what I mean

Edited by JeffDAK

Share this post


Link to post
Share on other sites

Yes, it's an HC-06 I think, not the HC-05 I originally stated.  The one without the host mode option.  It has the original linvor firmware on it.  I've been playing with interfaces to Android, which is pretty easy over bluetooth serial.

 

If I get this running I can use it to send CAN messages to display on an Android device app or just a serial bridge to PC.

 

Hi, i'm new here, and new to stellaris too, I really like your aproach to your problem with the CAN bus, would  you like to share your schematic and code over the CAN+Bluetooth+LCD please?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...