|
| 1 | +# stm32f413 |
| 2 | + |
| 3 | +It also works with the following STM32F4 series. |
| 4 | +- STM32F412 |
| 5 | +- STM32F413 |
| 6 | + |
| 7 | +I used [this](https://github.com/seeers/CAN-Bus-Arduino_Core_STM32) as a reference. |
| 8 | + |
| 9 | +# Changes from the original |
| 10 | + |
| 11 | +- frame format |
| 12 | +This example support Extended frame format: with 29 identifier bits. |
| 13 | + |
| 14 | +- CAN port |
| 15 | +In this example, you can select the CAN port. |
| 16 | + |
| 17 | +- CAN1 and CAN2 |
| 18 | +In this example, you can use CAN1 and CAN2 port. |
| 19 | + |
| 20 | + |
| 21 | +# Remap CAN port |
| 22 | +STM32F412/413 has two CAN ports. |
| 23 | +These GPIOs can be used as CAN. |
| 24 | +|CAN|RX|TX|| |
| 25 | +|:-:|:-:|:-:|:-:| |
| 26 | +|CAN1|PA11|PA12|| |
| 27 | +|CAN1|PB8|PB9|| |
| 28 | +|CAN1|PD0|PD1|| |
| 29 | +|CAN1|PG0|PG1|| |
| 30 | +|CAN2|PB5|PB6|| |
| 31 | +|CAN2|PB12|PB13|| |
| 32 | +|CAN2|PG11|PG12|| |
| 33 | + |
| 34 | +CAN1_RX mapped to PA11, CAN1_TX mapped to PA12 |
| 35 | +CAN2_RX mapped to PB5 , CAN2_TX mapped to PB6 |
| 36 | +``` |
| 37 | +CANInit(CAN_1000KBPS, 0); // CAN_RX mapped to PA11, CAN_TX mapped to PA12 |
| 38 | +``` |
| 39 | + |
| 40 | +CAN1_RX mapped to PG0 , CAN1_TX mapped to PG1 |
| 41 | +CAN2_RX mapped to PG11, CAN2_TX mapped to PG12 |
| 42 | +``` |
| 43 | +CANInit(CAN_1000KBPS, 1); // CAN_RX mapped to PG0 , CAN_TX mapped to PG1 |
| 44 | +``` |
| 45 | + |
| 46 | + |
| 47 | +CAN1_RX mapped to PB8 , CAN1_TX mapped to PB9 |
| 48 | +CAN2_RX mapped to PB12, CAN2_TX mapped to PB13 |
| 49 | +``` |
| 50 | +CANInit(CAN_1000KBPS, 2); // CAN_RX mapped to PB8, CAN_TX mapped to PB9 |
| 51 | +``` |
| 52 | + |
| 53 | +CAN1_RX mapped to PD0 , CAN1_TX mapped to PD1 |
| 54 | +CAN2_RX mapped to PB12, CAN2_TX mapped to PB13 |
| 55 | +``` |
| 56 | +CANInit(CAN_1000KBPS, 3); // CAN_RX mapped to PD0, CAN_TX mapped to PD1 |
| 57 | +``` |
0 commit comments