STM32Cube Expansion Pack CAN Stack
|
coming soon (who want to do this?) It should be the same es in German
At first wyou get the sections to integrate the pack.
Inside the CanIf_AppDemo.ioc
file view you can find at the top middle the menu "Select Packs/Manage Software Packs"
You can choose to load the pack from the local disc space or via URL from a web space. In my case I have the pack saved on disc space coming with the repository.
If you have read the license info and agree to it, click on "finish".
You can find some useful details if you click on the ExpansionPack inside the new view. For example there is something with the MX-functions coming from HAL code generation.
Back on the CanIf_Appdemo.ioc
view you can find the menu "Software Packs/Select Components". On this, you open the "Software Pack Component Selector". Here is a small picture on it. Don't worry about no readable, I will go to details on next.
You can find all ExpansionPacks delivered from the STMicroelectronics server. With a click on Install
you can download and install the ExpansionPack. If you scroll down you can find our ExpansionPack TM_Engineering.CAN_Stack
.
With a click on the ">" it will show you the bundles and the components of the pack. For the first try we select the Demo Application CanIf_AppDemo
.
There will be some warnings signaled with the yellow triangle.
With a click in the button (like the biscuit/red arrow in the picture) you can find more details to the bundle or component. Here is some text to explain the waring(s): "This component has unresolved dependencies". So we know there must be some more components to use this one. The next line says: "There are solutions within this pack". There must be an other component inside our pack. We don't need an other pack.
The button (like green/red arrow) will show you the needed dependencies. So, the
DemoApplication
needs a component named bxCAN/Master
.
You can choose your way to select the other components. The "Component Dependencies" view gives you some shortcuts
After all you should have selected the following components and get green checkmark for solved dependencies
Bundle | Module | Content |
---|---|---|
CanDrv | CanDrv_APIclass | This module contains a virtual class Can which describes the API for all compatible CanDrv |
bxCAN / Master | Here is the CanDrv_bxCAN for the STM bxCAN Controller. We need in the tutorial the Master controller only | |
CanIf | general | The component includes compiler dependencies and runtime version management |
ComIf | This component includes a virtual C++ class to abstract communication interfaces like the AUTOSAR idea. | |
CanIf | This is the derived interface class for communication on the CAN |
Now you can close the "Software Pack Component Selector".
Back in the CanIf_AppDemo.ioc
viewer you can find on the left column a new point named "Software Packs". Here will be listed all ExpansionPacks you have selected in the previous window. So you can see the TM_Engineering.CAN_Stack
at this time. If you select it, there will be created a second column with to sections. On the top there is the c Mode Section. Here you can activate and deactivate the modules. On activation of a mode there will appear the configuration tab(s) on the lower section.
The CAN Driver tab contains the configuration parameters for the access to the CAN bus.
If you need some more help you can select the (i) button at the upper right side in the tab. It will give you some more information about the selected parameter.
The "Bitrate Generator" is inside the code generation ftl file. It will calculate the needed timing parameters like SeqmentTime1
, SeqmentTime2
or SyncJumpWidth
. This calcualtion based on the APB1
clock which drives the CAN controller.
Parameter | Beschreibung |
---|---|
List of Bitrates | Give comma seperated list with bitrate values This values are selectable inside the startup configuration and can be switched during runtime |
Bittiming Sample Point | Sample Point can be given as a percent value (50%-100%) or as a float value (0.5 - 1.0) |
This are the startup parameter for th bxCAN Master controller or the bxCAN Slve controller, if activated.
Parameter | Value Type | Beschreibung |
---|---|---|
Initial Bitrate | [Number, Integer] | select a value you have defined in the "Bitrate Generator" |
Controller Mode | Normal | Standard. The controller works as normal CAN device |
Loopback | This is an internal loopback of CAN-Tx und CAN-Rx lines. So it doesn't needs a second CAN device for testing. | |
Silent | The controller don't do the arbitration. | |
Silent & Loopback | combines the two above | |
Time Triggered Mode | true / false | Time triggered communication mode |
Auto Bus off | true | The Bus-Off state is left automatically by hardware once 128 occurrences of 11 recessive bits have been monitored. |
false | The Bus-Off state is left on software request, once 128 occurrences of 11 recessive bits have been monitored and the software has first set and cleared the INRQ bit of the CAN_MCR register. | |
- | For more information see the CAN-Error Management | |
Auto Wake up | true | The Sleep mode is left automatically by hardware on CAN message detection |
false | The Sleep mode is left on software request by clearing the SLEEP bit of the CAN_MCR register | |
Auto Retransmission | true | The CAN hardware will automatically retransmit the message until it has been successfully transmitted according to the CAN standard. |
false | A message will be transmitted only once, independently of the transmission result (successful, error or arbitration lost) | |
| This value is inverted to the Bit 4 NART: No automatic retransmission of the bxCAN controller. The inversion is done inside the HAL Init function. | |
Receive FIFO Locked | true | Receive FIFO locked against overrun. Once a receive FIFO is full the next incoming message will be discarde |
false | Receive FIFO not locked on overrun. Once a receive FIFO is full the next incoming message will overwrite the previous one. | |
time based priority on transmission | true | Priority driven by the request order (chronologically) |
false | Priority driven by the identifier of the message | |
CAN Hardware filter | [Number, Integer] | This gives the maximum count of used hardware filters for use on the bxCAN Master. The bxCAN has 28 filter banks. The remaining filters will be used by the bxCAN Slave |
The bxCAN controller has only a three message sized receive FIFO and three transmit mailboxes So we have configurable software buffers in the CanDrv. The size of this buffers will be given with this two values