danny wang a136536ff5 watchrobot first commit | 2 роки тому | |
---|---|---|
.. | ||
avr-can-lib | 2 роки тому | |
.gitignore | 2 роки тому | |
CMakeLists.txt | 2 роки тому | |
README.md | 2 роки тому | |
can_config.h | 2 роки тому | |
canard_avr.c | 2 роки тому | |
canard_avr.h | 2 роки тому |
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