CAN Port
Purpose
Set up a CAN communication port
Library
STM32
Description
The block sets up a CAN (Controller Area Network) communication port.
The input en determines the CAN port state. Setting en to zero will force the CAN port to the bus-off state, while setting the port to \(1\) allows the CAN port to transition to bus-on. A bus-off condition has to be cleared by setting the enable signal to \(0\), and then back to \(1\).
The output on is \(1\) to signal bus-on status, \(0\) otherwise. The output ea is \(1\) to signal error active status, \(0\) otherwise.
Parameters
Main
- CAN interface
Selects the CAN interface to use.
- CAN protocol
Selects the CAN protocol to use.
CAN FDsupports bit rates higher than \(1\,\mathrm{Mbit/s}\) and payloads larger than \(8\,\mathrm{bytes}\).- Automatic Bus-Off recovery
Selects whether the CAN controller automatically re-enters Error-Active mode or requires a manual reset after entering Bus-Off mode.
GPIO
- Tx port
Selects the port used to transmit data.
- Tx pin
Selects the pin used to transmit data.
- Rx port
Selects the port used to receive data.
- Rx pin
Selects the pin used to receive data.
Bit rate configuration
- Bit rate switching
Enables or disables bit rate switching by setting this parameter to
EnabledorDisabledrespectively. This option is only available if CAN protocol is set toCAN FD.- Nominal bit rate
Defines the bit rate during the nominal phase (also known as arbitration phase) that is used on the connected CAN bus, in bits per second \((\mathrm{bit}/\mathrm{s})\).
- Nominal bit sample point
Defines the point in the sample period where the bus level is read and interpreted in the nominal phase, in percent \((\%)\).
- Data bit rate
Defines the bit rate during the data phase that is used on the connected CAN bus, in bits per second \((\mathrm{bit}/\mathrm{s})\). This parameter is only accessible when Bit rate switching is
Enabled.- Data bit sample point
Defines the point in the sample period where the bus level is read and interpreted in the data phase, in percent \((\%)\). This parameter is only accessible when Bit rate switching is
Enabled.
Advanced
- Advanced configuration
If set to
Enabled, advanced bit timing settings can be configured. When set toDisabledthe bit timing will be automatically deduced from the configured bit rate and sampling point. The following default configuration will be used in this case:Nominal/Data rate bit length is maximized to have as much as possible time quanta to construct a bit time. This will result in a low bit rate prescaler (BRP).
Nominal/Data SJW is chosen to be as large as possible.
SSP offset is set to be in the middle of the data bit: \((\mathrm{1 + Tseg1 + Tseg2})/2\).
SSP filter is set to \(0\).
All following parameters are only available if the advanced configuration is set to Enable and CAN FD protocol is used.
- Nominal rate bit length
Defines the sum of all bit time segments during the nominal phase expressed in time quanta \((\mathrm{Tq})\) as \(\mathrm{1 + Tseg1 + Tseg2}\).
- Nominal rate SJW
Synchronization jump width during nominal phase expressed in time quanta \((\mathrm{Tq})\).
- Data rate bit length
Defines the sum of all bit time segments during the data phase expressed in time quanta \((\mathrm{Tq})\) as \(\mathrm{1 + Tseg1 + Tseg2}\).
- Data rate SJW
Synchronization jump width during data phase expressed in time quanta \((\mathrm{Tq})\).
- Secondary sampling point (SSP)
If set to
Enabledadvanced secondary sampling point settings can be configured and the automatic transceiver delay compensation is enabled.- SSP offset
Defines the secondary sampling point offset expressed in time quanta \((\mathrm{Tq})\).
- SSP filter
Defines the secondary sampling point filter expressed in time quanta \((\mathrm{Tq})\).