danny wang a136536ff5 watchrobot first commit | 2 rokov pred | |
---|---|---|
.. | ||
avr-can-lib | 2 rokov pred | |
.gitignore | 2 rokov pred | |
CMakeLists.txt | 2 rokov pred | |
README.md | 2 rokov pred | |
can_config.h | 2 rokov pred | |
canard_avr.c | 2 rokov pred | |
canard_avr.h | 2 rokov pred |
This driver is based on the Universal CAN Library for AVR controllers (AT90CAN, MCP2515, SJA1000) by RCA (Roboterclub Aachen e.V.).
Github: https://github.com/dergraaf/avr-can-lib
Only tested for AT90CAN128!
Currently the driver works only with additional buffer from the avr-can-lib (see below) as the internal CAN Buffer (MOb's) are not read fast enough and therefore overflow occur even with hardware filter enabled.
#define CAN_RX_BUFFER_SIZE 16
#define CAN_TX_BUFFER_SIZE 8
#define CAN_FORCE_TX_ORDER 1
Adjust file can_config.h
to your needs.
In file CMakeLists.txt
set your controller and corresponding frequency:
set(MCU at90can128)
set(F_CPU 16000000)
After finishing configuration:
$ cmake .
$ make
Include the following files in your project:
avr-can-lib/can.h
avr-can-lib/libcan.a
can_config.h
canardAVRInit(CAN_BITRATE)
with appropriate bitrate (bits/sec.)canardAVRConfigureAcceptanceFilters(NODE_ID)
with node ID from above