Go Down

Topic: CAN Network via Ethernet? (Read 1 time) previous topic - next topic

tp2357

May 21, 2012, 10:36 pm Last Edit: May 21, 2012, 10:47 pm by Coding Badly Reason: 1
Hello there,

I was wondering if anyone has ever tried using the ethernet port on this arduino uno for a CAN network? How would I go about doing this?

Thanks,
tp2357


Moderator edit: fixed the link.

Coding Badly

Hello,

Ethernet and CANBUS are radically different things.  There is no possibility of getting that shield to communicate on a CAN network.

tp2357

Thanks for your help. Is there a way where I could use a wifi shield and a can bus shield at the same time? How would i go about doing that?

pylon

I don't see a conceptual problem in using a can bus shield and a WiFi shield together. If it really works is depending heavily on the shield hardware actually used.

Maybe it's better to describe to us what you like to achieve. That way we may propose you how this can be done.

tp2357

Well, i have a robot build with Texas instruments Jaguars running on a can network. I built the robot for a First Robotics competition, and am now looking to replace the cRIO microcontroller that is currently with a arduino (to save money on buying a new cRIO), using a wifi shield and a CAN network bus. What do you recommend I do?

pylon

If I understood correctly you're currently using the Arduino to let your cRIO (I assume this means compactRIO from National Instruments) communicate with a controlling PC. What's the current communication channel between the cRIO and the Arduino? UART? CAN?

Do you intend to replace the cRIO or do you wanna keep it and use the Arduino just for communication?

You've written you already own a WiFi shield. Which one is that? Do you also have a CAN shield/breakout? If yes, what type is it?

What's your plan for the final communication "protocol"? Sending some control commands from the PC to the Arduino which sends them to the cRIO? Has the Arduino to control other hardware directly using the CAN bus?

tp2357

I do not currently own a wifi shield, and I was planning on replacing a cRIO, not using the arduino as a gateway to the cRIO.

Basically the control system would look like this:

When we select "enabled" on the laptop, the laptop will send a packet to the arduino giving it the current joystick readings, and other miscelleneaous information selected laptop side. (this happens 10-20 times a second when enabled)

The code on the arduino then decides what to do with this information.

Sorry for being confusing or misleading, and i appreciate your help. (:

pylon

I have no experience with WiFi shields but with WiFi XBees on appropriate shields. I used a RN-XV from Roving Networks (http://www.rovingnetworks.com/products/RN_XV) which communicates over the UART with the Arduino and works flawlessly. I also use WiFi Bees (http://www.seeedstudio.com/wiki/Wifi_Bee) which are bit more complex to use (they are small Arduinos themselves) but allow much greater flexibility as the included ATmega328 handles the protocols with a minimal TCP/IP stack. If used as an XBee you can have all the network part on the WiFi Bee and let the main Arduino do the CAN handling (and whatever else you have for it).

For CAN communication I used this shield (I have only the shop link I bought it from: http://shop.boxtec.ch/product_info.php/products_id/40573). As the only CAN bus I have is in my car I used it only there.

mongo02

In case anyone still wants to do this, I've done it with an Arudino Uno R3, an Arduino Ethernet Shield R3, and a SK Pang Electronics CAN-BUS Shield.  I stacked the Ethernet shield first, then attached very long headers to the CAN-BUS shield (as the Ethernet port is fairly high) on the following pins: all pins on the 6-pin power port, D2 (if you're using the CAN-BUS INT pin), D10-13, and GND.  I then bent the header pin coming from pin D10 of the CAN-BUS shield so it would go into D9 of the Ethernet shield.  Correspondingly, I changed the SPI chip select (CS) pin in the software for the CAN-BUS shield from D10 to D9.  I used the CAN-BUS libraries from http://www.seeedstudio.com/wiki/images/5/55/CAN_BUS_Shield.zip and changed line 299 in mcp_can_dfs.h from
Code: [Select]
#define SPICS 10  to
Code: [Select]
#define SPICS 9This is needed because the Ethernet shield uses D10 as its CS pin, and a unique CS pin is needed for every device on the SPI bus.  Therefore, you can really use any other digital pin as the CAN-BUS CS pin (except D4 if you're using the Ethernet shield's SD card).

Go Up