diff --git a/README.md b/README.md index fe49799..823df03 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,36 @@ cDefinitions: 4. To transmit messages, call `ftcan_transmit()` 5. When a message is received, `ftcan_msg_received_cb()` is called. It has a 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 + ![Connectivity -> CAN -> Activated](doc/bxcan-activate.png) +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! + ![Connectivity -> CAN -> Parameter Settings -> Bit Timings Parameters](doc/bxcan-bittimings.png) +3. Make sure the CAN_RX0 interrupt is enabled + ![Connectivity -> CAN -> NVIC Settings -> CAN_RX0 interrupt](doc/bxcan-interrupt.png) + +### FDCAN (e.g. STM32H7xx) + +1. Enable the CAN peripheral + ![Connectivity -> FDCAN(1)](doc/fdcan-activate.png) +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). + ![Connectivity -> FDCAN(1) -> Parameter Settings -> Basic Parameters](doc/fdcan-basic.png) +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! + ![Connectivity -> FDCAN(1) -> Parameter Settings -> Bit Timings Parameters](doc/fdcan-bittimings.png) +4. Make sure the interrupts are enabled + ![Connectivity -> FDCAN(1) -> NVIC Settings](doc/fdcan-interrupt.png) diff --git a/doc/bxcan-activate.png b/doc/bxcan-activate.png new file mode 100644 index 0000000..c24851f Binary files /dev/null and b/doc/bxcan-activate.png differ diff --git a/doc/bxcan-bittimings.png b/doc/bxcan-bittimings.png new file mode 100644 index 0000000..e594d30 Binary files /dev/null and b/doc/bxcan-bittimings.png differ diff --git a/doc/bxcan-interrupt.png b/doc/bxcan-interrupt.png new file mode 100644 index 0000000..1959520 Binary files /dev/null and b/doc/bxcan-interrupt.png differ diff --git a/doc/fdcan-activate.png b/doc/fdcan-activate.png new file mode 100644 index 0000000..2d31913 Binary files /dev/null and b/doc/fdcan-activate.png differ diff --git a/doc/fdcan-basic.png b/doc/fdcan-basic.png new file mode 100644 index 0000000..d21c3aa Binary files /dev/null and b/doc/fdcan-basic.png differ diff --git a/doc/fdcan-bittimings.png b/doc/fdcan-bittimings.png new file mode 100644 index 0000000..060cd9e Binary files /dev/null and b/doc/fdcan-bittimings.png differ diff --git a/doc/fdcan-interrupt.png b/doc/fdcan-interrupt.png new file mode 100644 index 0000000..400f7ed Binary files /dev/null and b/doc/fdcan-interrupt.png differ