Describe CubeMX settings
33
README.md
|
@ -42,3 +42,36 @@ cDefinitions:
|
||||||
4. To transmit messages, call `ftcan_transmit()`
|
4. To transmit messages, call `ftcan_transmit()`
|
||||||
5. When a message is received, `ftcan_msg_received_cb()` is called. It has a
|
5. When a message is received, `ftcan_msg_received_cb()` is called. It has a
|
||||||
default empty implementation, which you can simply override.
|
default empty implementation, which you can simply override.
|
||||||
|
|
||||||
|
## Enabling CAN in STM32CubeMX
|
||||||
|
|
||||||
|
This isn't specific to `can-halal`, but for completeness sake is included here.
|
||||||
|
|
||||||
|
### bxCAN (e.g. STM32F3xx)
|
||||||
|
|
||||||
|
1. Enable the CAN peripheral
|
||||||
|

|
||||||
|
2. Setup the [bit timings](http://bittiming.can-wiki.info/).
|
||||||
|
**Note:** the baud rate depends on your system clock, so make sure that is
|
||||||
|
setup correctly first!
|
||||||
|

|
||||||
|
3. Make sure the CAN_RX0 interrupt is enabled
|
||||||
|

|
||||||
|
|
||||||
|
### FDCAN (e.g. STM32H7xx)
|
||||||
|
|
||||||
|
1. Enable the CAN peripheral
|
||||||
|

|
||||||
|
2. Setup the frame format, nominal SJW, filters, and FIFOs. The numbers for
|
||||||
|
filters/FIFOs in the screenshot are examples.
|
||||||
|
**Note:** You need to tell `can-halal` about the number of filters by
|
||||||
|
defining `FTCAN_NUM_FILTERS` (see above).
|
||||||
|

|
||||||
|
3. Setup the [bit timings](http://bittiming.can-wiki.info/). We only use CAN in
|
||||||
|
classic mode, not FD mode, so we only need to worry about the nominal bit
|
||||||
|
timings
|
||||||
|
**Note:** the baud rate depends on your system clock, so make sure that is
|
||||||
|
setup correctly first!
|
||||||
|

|
||||||
|
4. Make sure the interrupts are enabled
|
||||||
|

|
||||||
|
|
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 17 KiB |