CANopen-ESP32-nodes
CANopen-ESP32-nodes copied to clipboard
Playing around with CANopenNode to fully expand the true potential of CAN bus on ESP32.
CANopen-ESP32-nodes
Playing around with CANopenNode to fully expand the true potential of CAN bus on ESP32 while obeying ESP-idf rules. Link to this repo on Github
- CANopen-ESP32-nodes - Why use CAN? - Why use CANopen?
- Forks
- Requirements
- How to use
- License
Why use CAN?
- Better wired communication between multiple ESP32s and other CAN enabled chips like STM32.
- High reliability over long distances.
- Great for home automation.
- Widely used protocol by big industries.
Why use CANopen?
- Like anything else, a higher level protocol is essential to avoid re-inventing the wheel, and to guarantee reliability in a commercial product.
Forks
The Forks folder consists of projects I've seen over the internet, and I've tried to re-write in ESP-idf platform:
-
Alexander Miller's implementation uses the Apache License 2.0
- Only implements the Master Node. Alexander has other CANopen devices to play with like the Dunker motor
- Both nodes communicate, but I don't know how PDO mapping and the object dictionary works.
-
Guillermo-ruffino's implementation:
- Consists of an LSS Slave node.
- Node two implements Guillermo's code, but node one is a raspberry pi, so I don't have enough info. Thus, node one uses Alexander's node one.
Requirements
You will need the following materials:
- ESP32 (2 or more)
- SN65HVD230 (or SN65HVD233) CAN bus transceiver chip for each ESP32.
- A PC (preferably Linux)
How to use
- Download esp-idf, and follow their instructions.
- Enter into a root directory for one of the nodes for this repo, like
cd ./Forks/Alexander_Miller/node_one/
- You should edit your
GPIO
configurations in theCO-config.h
(located in thecomponents/CANopen
for each esp-idf project) for your CAN transceiver.- For my case, all my
node_one's
are: (GPIO_TX, GPIO_RX) = (12, 32) And all mynode_two's
are: (GPIO_TX, GPIO_RX) = (16, 17). - Make sure you connect your CAN transceiver to your chosen GPIO pins (it doesn't matter which GPIO you choose).
- For my case, all my
- Enter into terminal
-
idf.py menuconfig
- You will see a GUI, but we can skip this.
-
Ctrl + C
to exit
-
- You will see a GUI, but we can skip this.
- Build and upload to port (I'm on linux so
/dev/ttyUSB0
and my second port is/dev/ttyUSB1
):-
idf.py build && idf.py -p /dev/ttyUSB0 flash monitor
-
- You can exit the monitor by pressing
Ctrl + ]
. - To view the serial again:
-
idf.py -p /dev/ttyUSB0 monitor
-
-
- Most of the code here requires multiple terminals to be open to see the output for each CAN node. So, redo step 2 and 3 for as many nodes.
Note: if builds fail, then try to run idf.py fullclean
. and run build idf.py build
again
License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
...