CANopen Master Documentation
Version 6.06.02
Loading...
Searching...
No Matches
STM32G474E-EVAL board

The CANopen FD Master protocol stack for the STM32G474E-EVAL runs on a bit-rate of 500 kBit/s on interface CAN2. Please make sure that:

  • the CAN cable is connected to CN10
  • jumper JP2 is set (termination resistor fitted)

For display of the CANopen network state the example uses the LEDs LD1 (green) and LD3 (red), the symbol COM_LED_SUPPORT is configured to 1.

Board STM32G474E-EVAL

The example uses Classical CANopen configuration (COM_FD_SUPPORT = 0) as default. Refer to the How to build section if the target should run in CANopen FD configuration.

Prerequisites

The example project can be built if the following programs are installed:

Please make sure that the value of WIN_TOOLCHAIN_PATH (for Windows) or UNIX_TOOLCHAIN_PATH (for macOS / Linux) inside the cmake/toolchain-gcc-<version>.cmake file is equal to the install path of the GNU Arm Embedded Toolchain.

cmake
#-----------------------------------------------------------------------------------------------------------------------
# set paths to the desired toolchains of corresponding OS
#
set(WIN_TOOLCHAIN_PATH "D:/devtools/GNU_ARM/10 2020-q4-major" CACHE PATH "Windows toolchain for GNU ARM")
set(UNIX_TOOLCHAIN_PATH "/Applications/ARM/gcc-arm-none-eabi-10-2020-q4-major" CACHE PATH "Unix toolchain for GNU ARM")

How to build

Create a local build directory and start the build process within this directory. Make sure to pass the correct toolchain (i.e. GNU Arm Embedded Toolchain) to the CMake process via the parameter -DCMAKE_TOOLCHAIN_FILE. The following examples assume a GNU Arm Embedded Toolchain version 10.2.1.

Passing the value -DCAN_FD=1 to the CMake command line will generate code for CANopen FD.

Debug build

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../../../../../../cmake/module/toolchain-gcc-10.2.1.cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .

For generation of CANopen FD code use the following build steps:

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../../../../../../cmake/module/toolchain-gcc-10.2.1.cmake -DCMAKE_BUILD_TYPE=Debug -DCAN_FD=1 ..
cmake --build .

Release build

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../../../../../../cmake/module/toolchain-gcc-10.2.1.cmake ..
cmake --build .

For compilation in Windows you have to execute following command:

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=./../../../../../cmake/module//toolchain-gcc-10.2.1.cmake ..