我想让 Arduino 在 CAN 网络中运行。Arduino是否存在提供OSI模型网络层的软件?我想用 GPIO/ADC 检测 HI/LOW 电平并用 DAC 将信号发送到网络。如果没有附加任何额外的硬件,那就太好了。不过,我不介意 CAN 网络需要一个终端电阻。
我所说的 Arduino 是指其中任何一个。我的目的是保持开发环境。
如果不存在这样的软件,是否存在任何技术障碍,例如有限的闪存大小(再次,我不是指具有某些 Atmega 芯片的特定板)。
你可以写一点 CAN 驱动程序,但它有很多限制。
首先是时序,很难实现位时序和仲裁。
您将能够获得 10kb 甚至 50kb,但这会消耗大量的 CPU 时间。
而且代码本身很痛苦。
您必须即时计算 CRC(简单),但要实现碰撞检测和所有时序参数并不容易。
曾经,我为一家公司做过这件事,但这是一个非常糟糕的主意。
最好花 1 欧元买一个芯片,然后开心。
There are several CAN Bus Shield boards available (e.g: this, and this), and that would be a far better solution. It is not just a matter of the controller chip, the bus interface, line drivers, and power all need to be considered. If you have the resources and skills you can of course create your own board or bread-board for less.
Even if you bit-bang it via GPIO you would need some hardware mods I believe to handle bus contention detection, and it would be very slow and may not interoperate well with "real" CAN controllers on the bus.
If your aim is to communicate between devices of your own design rather than off-the shelf CAN devices, then you don't need CAN for that, and something proprietary will suffice, and a UART will perform faster that a bit-banged CAN implementation.
我不认为,这样的软件存在。CAN 总线比 I2C 更复杂。基本上,您必须同时实现 CAN 控制器和 CAN 收发器的功能。有关更多详细信息,请参阅此线程(德语)。
或者,您可以使用其中一个CAN 屏蔽。另一种选择是使用BeagleBone和合适的CAN cape。
也看看AVR-CAN。