can communication

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.
Im looking in to CANbus communication. I'm thinking of using AT90CAN128 controller for this.
Im new to CAN communication..

The application is as follow:
I like to measure AC voltage frequency using AVR microcontroller. Then send result to a PLC with CAN communication. The PLC has CANopen communication. Master and slave modules.
First of all. IS it possible to communicate AT90CAN128 CAN controller with a CANopen devise. If so, should it be a CANopen Master or a slave module?

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Absolutely, the AT90CAN128 will communicate with CANopen. The AT90CAN64 and AT90CAN32 will also work with CANopen. However, I don't know if you will be able to find any CANopen source code. The “open” in CANopen doesn't apply to source code (its not GPL or any other kind of open source license).

CANopen is a standard owned by CiA:
http://www.can-cia.org/

From what I have seen, CiA does not support the hobbyist that simply wants to interface with CANopen products. They do support developers/manufactures that pay CiA membership fees and want to design/build CANopen products.

I see something new. Now you can purchase a CANopen conformance test tool:
http://www.can-cia.org/index.php...

Its up to you too see if you can gather enough information on how CANopen works. You will probably have to write your own source code from scratch. Still, things change so do take the time to look for source code first.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I don't know if you will be able to find any CANopen source code.

You don't need CANopen source code, write your own. The only hard part is PDO mapping, which you can do without. The second hardest part is segmented or block uploads/ downloads. You can do without those also.

You are left with either a periodic message with the data in it, or a message in response to a query.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I'm a newbe, CANopen seems to be hard. I have lookied into USB as well. I need fast and safe communication. What communication is best for this purpose: USB or CAN?
Whitch is most easy to implement?

Hans

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And: Do I need full CANopen on my microcontroller to be able to communicate with a CAN open device? If not. What is minimum req.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

USB is good for two nodes, like your PC and your printer. CAN is good for many nodes on one bus.

The minimum requirement for your application is for your device to send a periodic message, ie every 100 ms, with message ID 0x180 + the node number. The message data would be the frequency that you measure.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, but it must be much faster < 5ms.
Is it possible wit CAN or USB?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The fastest way would be to use CANBASIC:
That means you only send from your controller a simple CAN Message with a defined identifier (e.g. $300) and 8 Data bytes.
I'm quite sure your PLC ist able to receive a simple can-message without any can-open protocol.
if you use baudrate from 500kpbs ore more you can transmitt much faster than in 5ms, but you have to ensure that your PLC is able to receive the messages too.

best regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is CABbasic the same as microCAN?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At 125 Kbaud, a message takes less than 1 ms. I do not know how fast USB is.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually the time to send a highest current priority CAN frame depends on if you are using 11 bit or 29 bit format as well as the baud rate. Then if you are using a protocol like CANopen for example, you will need to send as many frames as the specification requires for any complete action to take place.

From the OP's first post I made the assumption you were stuck with existing CANopen devices. If you are not constrained by CANopen, then maybe you don't have to use CAN at all? There is allot of stuff that goes into picking or designing a communication system, much of it should be driven by your specific requirements.

If you want to use CAN, depending on your experience you might even create your own CAN custom protocol, tailored to solve your specific problem. The advantages to using standardized protocols is connecting with other equipment that already uses the exact same standard protocol and sometimes software is already available. CAN hardware does offer the advantage of automatically taking care of the low level details (message CRC checking, priority arbitration, error detection, retries ,node error confinement, etc.). If you used RS-485 this or something like it would have to be done in software, but if you can get free or cheap RS-485 software it still might be easier to do than CAN.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hapetter wrote:
Is CABbasic the same as microCAN?

I do not know what is microCAN.

But CAN-basic means that you transmit only a can Message with max 8-Data Bytes. The content of the data bytes depends only on your requirement. So you save a lot of data scrap and handshake messages as it is at CANOPEN.

If you whant a can transmit you a example of CANBASIC communication on a ATMega8 with a SPI Can-Controller (MCP2515)

best regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Someone says CANopen is to comlex for 8-bit microcontrollers? I have seen several companys offering CANopen stack for AVR CAN controllers.

Comments?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

CANopen is a system of network nodes, where different individual nodes have different capabilities (some nodes are more complex than others). Different systems may be targeted at more complex tasks or less complex tasks.

A CANopen system is capable of taking on tasks that could very well require the resources of a PC (hard drives, lots of memory, databases, full size monitor, keyboard, etc.). Even in more complex systems where a PC CANopen node is required, not every CANopen node needs the resources of a full PC. There may still be simpler CANopen nodes in the network that are very well suited to 8 bit microprocessors. These 8 bit nodes (probably nodes with simple sensors, motor drivers, etc.) do need the CANopen stack to communicate with the rest of the CANopen network, but they do not have the resources to do the job of the PC based CANopen node.

Yes, if you require something really complex then you will need something bigger than an 8 bit micro for at least one CANopen node. If you require something simpler then you could use only 8 bit micros. Even if you do use only 8 bit micros with CANopen, you will not be using low end 8 bit micros and as rneil pointed out you might not even implement the full CANopen stack.