Coder Social home page Coder Social logo

canopenstm32's Introduction

CANopenNode STM32

CANopenSTM32 is a CANopen stack running on STM32 microcontroller based on CANOpenNode stack.

How to run demos

Examples are developed in STM32CubeIDE tool, official ST development studio for any STM32 microcontroller. You can directly open projects in the STM32CubeIDE and run examples on the relevant boards.

Repository directories

  • .\CANopenNode : Includes the stack implemenation, for most of usecases you don't need to touch these files as they are constant between all the variations and ports (i.e. Linux, PIC, STM32 and etc.)
  • .\CANopenNodeSTM32 : Includes the implementation of low-level driver for STM32 microcontrollers, support both CAN based controllers and FDCAN without any changes. It automatically detect the controller type and activate the relevant calls to STM32 HAL libraries
  • .\examples : It include many examples on various boards including STM32F4-Discovery, STM32G0C1 Evaluation board, STM32F076 Nucleo Board, STM32H735G-Development Kit.
  • .\Legacy : It include an older version of CANOpenSTM32 implementation, specifically made for FDCAN controllers, however it was stable and include the FreeRTOS implementation.

Supported boards and MCUs

It has many features of STM32H7xx series and includes 3 CAN transceivers on the board. You do not need any additional hardware to connect to existing CAN network. It also includes built-in programmer and virtual COM port for communication, hence evaluation is quick and easy.

CanOpen demo works at FDCAN1 port. Use connector CN18.

FDCAN IP block is same for any STM32H7xx MCU family, hence migration to your custom board should be straight-forward.

  • Runs out of the box on STM32H735G-DK board
  • Bare metal, and FreeRTOS operating system examples
  • FDCAN1 (CN18) hardware is used for communication at 125kHz
  • CANopen LED control is well integrated
  • Debug messages are available through VCP COM port at 115200 bauds
  • Can be used as a reference code for end product

The STM32G0C1E-EV Evaluation board is a high-end development platform for the STM32G0C1VET6 microcontroller. It has many features including two CAN FD controller and physical layer on board. You don't need any additional hardware to connect to existing CAN network. It also includes built-in programmer and virtual COM port for communication, hence evaluation is quick and easy.

CanOpen demo works at FDCAN1 port. Use connector CN12. FDCAN IP block is same for any STM32G0xx MCU family, hence migration to your custom board should be straight-forward.

Nucleo includes an arduino compatible headers which can be used to add MAX33040ESHLD to it and this bundle provide the minimum required components to establish a CAN communication and CanOpenNode on top of that.

This project is tied to the CubeMX configuration, so it is up to the user to provide compatible configuration using CubeMX (bitrate, interrupt activiation and etc).

STM32F4DISCOVERY + Any CAN Bus Physical Layer Module

Have a look at STM32CubeMX configuration file for pin mapping.

Video Tutorial

To get a good grasp of CANOpenNode Stack and CANOpenNodeSTM32 stack, you can refer to this video, which explains from basics to implementation and porting of the CANOpenNode stack.

CANOpen Node STM32 From basics to coding

00:00 Introduction and Overview 1:13 Why CAN ? 4:51 CAN Bus 8:55 Why CANOpen ? 13:27 CANOpen architecture 20:00 Object dictionary 21:38 Important CANOpen concepts 23:29 PDO 27:25 SDO 32:23 NMT 33:25 CANOpenNode Open-Source Stack 39:26 STM32 Practical implementation 40:29 CANOpen Tutorial code preparation 43:09 Importing examples to STM32CubeIDE and programming them 47:04 Examples explanation 57:00 Porting to custom STM32 board 1:18:20 EDS Editor (Object dictionary editor) 1:25:54 Creating a TPDO 1:39:55 Accessing OD Variables 1:54:08 Creating an RPDO 2:05:50 Using the SDOs 2:52:52 Node guarding 3:04:38 Transmitting PDOs manually

Porting to other STM32 microcontrollers checklist :

  • Create a new project in STM32CubeMXIDE
  • Configure CAN/FDCAN to your desired bitrate and map it to relevant tx/rx pins - Make sure yo activate Auto Bus recovery (bxCAN) / protocol exception handling (FDCAN)
  • Activate the RX and TX interrupt on the CAN peripheral
  • Enable a timer for a 1ms overflow interrupt and activate interrupt for that timer
  • Copy or clone CANopenNode and CANopenNodeSTM32 into your project directory
  • Add CANopenNode and CANopenNodeSTM32 to Source locations in Project Properties -> C/C++ General -> Paths and Symbols -> Source Locations
    • add an exclusion filter for example/ folder for CANopenNode folder
  • Add CANOpenNode and CANopenNodeSTM32 to Project Properties -> C/C++ General -> Paths and Symbols -> Includes under GNU C items
  • In your main.c, add #include "CO_app_STM32.h"
      /* Private includes ----------------------------------------------------------*/
      /* USER CODE BEGIN Includes */
      #include "CO_app_STM32.h"
      /* USER CODE END Includes */
    • Make sure that you have the HAL_TIM_PeriodElapsedCallback function implmented with a call to canopen_app_interrupt.
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */

  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM1) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */
  // Handle CANOpen app interrupts
  if (htim == canopenNodeSTM32->timerHandle) {
      canopen_app_interrupt();
  }
  /* USER CODE END Callback 1 */
}
  • Now based on your application, you'll take one of the following approaches :

    In Baremetal application

  • In your main.c, add following codes to your USER CODE BEGIN 2

      /* USER CODE BEGIN 2 */
      CANopenNodeSTM32 canOpenNodeSTM32;
      canOpenNodeSTM32.CANHandle = &hcan;
      canOpenNodeSTM32.HWInitFunction = MX_CAN_Init;
      canOpenNodeSTM32.timerHandle = &htim17;
      canOpenNodeSTM32.desiredNodeID = 29;
      canOpenNodeSTM32.baudrate = 125;
      canopen_app_init(&canOpenNodeSTM32);
      /* USER CODE END 2 */
  • In your main.c, add following codes to your USER CODE BEGIN WHILE

    /* USER CODE BEGIN WHILE */
    while (1)
    {
        canopen_app_process();
      /* USER CODE END WHILE */

    In FreeRTOS Applications

  • You need to create a task for CANOpen, we call it canopen_task with a high priority and in that task use the following code :

void canopen_task(void *argument)
{
  /* USER CODE BEGIN canopen_task */
  CANopenNodeSTM32 canOpenNodeSTM32;
  canOpenNodeSTM32.CANHandle = &hfdcan1;
  canOpenNodeSTM32.HWInitFunction = MX_FDCAN1_Init;
  canOpenNodeSTM32.timerHandle = &htim17;
  canOpenNodeSTM32.desiredNodeID = 21;
  canOpenNodeSTM32.baudrate = 125;
  canopen_app_init(&canOpenNodeSTM32);
  /* Infinite loop */
  for(;;)
  {
	  //Reflect CANopenStatus on LEDs
    HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, !canOpenNodeSTM32.outStatusLEDGreen);
    HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, !canOpenNodeSTM32.outStatusLEDRed);
    canopen_app_process();
    // Sleep for 1ms, you can decrease it if required, in the canopen_app_process we will double check to make sure 1ms passed
    vTaskDelay(pdMS_TO_TICKS(1));
  }
  /* USER CODE END canopen_task */
}

In RTOS applications, be very careful when accessing OD variables, CAN Send and EMCY variable. You should lock the these critical sections to make sure prevent race conditions. Have a look at CO_LOCK_CAN_SEND, CO_LOCK_OD and CO_LOCK_EMCY.

  • Run your project on the target board, you should be able to see bootup message on startup

Known limitations :

  • We have never tested the multi CANOpen on a single STM32 device, but the the original CANOpenNode has the capability to use multi modules, which you can develop yourself.

Clone or update

Clone the project from git repository and get submodules:

git clone https://github.com/CANopenNode/CANopenSTM32
cd CANopenSTM32
git submodule update --init --recursive

Update an existing project including submodules:

cd CANopenSTM32
git pull
git submodule update --init --recursive

License

This file is part of CANopenNode, an opensource CANopen Stack. Project home page is https://github.com/CANopenNode/CANopenNode. For more information on CANopen see http://www.can-cia.org/.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

canopenstm32's People

Contributors

hamedjafarzadeh avatar majerle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canopenstm32's Issues

Nested OC_LOCK_OD causing permanently disabled interrupts.

Hi

After the update in CanopenNode where OD is always locked on a SDO call (Always call OD lock macros on SDO operations), my code broke down; the interrupts isnt enabled again.

This change caused nested OC_LOCK_OD to happen and since there is only one variable for storing the primask in the CO_CANmodule_t struct, the interrupts will never be enabled again.

The result was that the code stopped working on a HAL_Delay (infinite while loop) in anothert part of the application since OC_LOCK/__disable_irq apparantly also disable systicks.

I noticed this during a eeprom save (0x1010) because I had OC_LOCK_OD/UNLOCK on the OD-entry to be saved in the "storeEeprom"-function.

Is there any better way to implement this?
Ie. not disabling global interrupts, only the timer in charge of the interrupts and some other way of storing primask?

Issue with running on STM32H735-DK

Hello,
First of all, thank you to the contributors for this useful project!

I was attempting to implement the example on my STM32H735-development kit.
I currently have the dev kit setup connected with the PEAK P-CAN USB adapter, and the CAN Open Magic Lite software.

However, once the project is built and loaded, I am still not able to receive the bootup frame.
Not sure what the issue could be. We would appreciate some assistance with this.
Thank you!

build still failing: fatal: No url found for submodule path 'libs/lwrb/third_party/embedded-libs' in .gitmodules Failed to recurse into submodule path 'libs/lwmem' Failed to recurse into submodule path 'libs/lwrb'

I will try the workaround you gave in the other issue, but here for your information:

$ git clone https://github.com/CANopenNode/CANopenSTM32
Cloning into 'CANopenSTM32'...
remote: Enumerating objects: 300, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (8/8), done.
Receiving oremote: Total 300 (delta 2), reused 5 (delta 1), pack-reused 291
Receiving objects: 100% (300/300), 1.24 MiB | 7.49 MiB/s, done.
Resolving deltas: 100% (105/105), done.

$ cd CANopenSTM32/
$ git submodule update --init --recursive
Submodule 'CANopenNode' (https://github.com/CANopenNode/CANopenNode) registered for path 'CANopenNode'
Submodule 'libs/lwmem' (https://github.com/MaJerle/lwmem) registered for path 'libs/lwmem'
Submodule 'libs/lwprintf' (https://github.com/MaJerle/lwprintf) registered for path 'libs/lwprintf'
Submodule 'libs/lwrb' (https://github.com/MaJerle/lwrb) registered for path 'libs/lwrb'
Cloning into 'C:/mx/Projects/CANopenSTM32/CANopenNode'...
Cloning into 'C:/mx/Projects/CANopenSTM32/libs/lwmem'...
Cloning into 'C:/mx/Projects/CANopenSTM32/libs/lwprintf'...
Cloning into 'C:/mx/Projects/CANopenSTM32/libs/lwrb'...
Submodule path 'CANopenNode': checked out '8c7d852902b2d307e8b91a43332c14e366641e00'
Submodule path 'libs/lwmem': checked out '06ffc8ae8ab86a4ca3ef86b2d0911a9f7ba81b31'
Submodule 'third_party/embedded-libs' (https://github.com/MaJerle/embedded-libs) registered for path 'libs/lwmem/third_party/embedded-libs'
Cloning into 'C:/mx/Projects/CANopenSTM32/libs/lwmem/third_party/embedded-libs'...
error: RPC failed; curl 56 OpenSSL SSL_read: No error
fatal: clone of 'https://github.com/MaJerle/embedded-libs' into submodule path 'C:/mx/Projects/CANopenSTM32/libs/lwmem/third_party/embedded-libs' failed
Failed to clone 'third_party/embedded-libs'. Retry scheduled
Cloning into 'C:/mx/Projects/CANopenSTM32/libs/lwmem/third_party/embedded-libs'...
error: RPC failed; curl 56 OpenSSL SSL_read: No error
fatal: clone of 'https://github.com/MaJerle/embedded-libs' into submodule path 'C:/mx/Projects/CANopenSTM32/libs/lwmem/third_party/embedded-libs' failed
Failed to clone 'third_party/embedded-libs' a second time, aborting
Submodule path 'libs/lwprintf': checked out '13bcf006640daa8f8a109411457f31717e6462e9'
Submodule path 'libs/lwrb': checked out '764597326a1c833e3ff175e2f7ce0e3a4d38dc02'
Submodule 'third_party/Unity' (https://github.com/ThrowTheSwitch/Unity.git) registered for path 'libs/lwrb/third_party/Unity'
Submodule 'third_party/cmake-modules' (https://github.com/bilke/cmake-modules.git) registered for path 'libs/lwrb/third_party/cmake-modules'
fatal: No url found for submodule path 'libs/lwrb/third_party/embedded-libs' in .gitmodules
Failed to recurse into submodule path 'libs/lwmem'
Failed to recurse into submodule path 'libs/lwrb'

GitHub Desktop Clone Problem - No url found for submodule path

Attempting to clone the CanOpenSTM32 repository fails due to sub-module path not found. I have attached the log output from Github Desktop.

I believe its due to a missing link at this address: https://github.com/MaJerle/lwrb/tree/601bc87d20d85b229bdcd19b61a50e54a6a48efc/third_party

Any help on this matter would be appreciated!

Cloning into 'C:\Users\nkoni\OneDrive\Work\Winder Control\MCU\CanOpenSTM32'...
remote: Enumerating objects: 291, done.
remote: Counting objects: 100% (291/291), done.
remote: Compressing objects: 100% (207/207), done.
remote: Total 291 (delta 103), reused 264 (delta 76), pack-reused 0
Receiving objects: 100% (291/291), 1.23 MiB | 1.10 MiB/s, done.
Resolving deltas: 100% (103/103), done.
Submodule 'CANopenNode' (https://github.com/CANopenNode/CANopenNode) registered for path 'CANopenNode'
Submodule 'libs/lwmem' (https://github.com/MaJerle/lwmem) registered for path 'libs/lwmem'
Submodule 'libs/lwprintf' (https://github.com/MaJerle/lwprintf) registered for path 'libs/lwprintf'
Submodule 'libs/lwrb' (https://github.com/MaJerle/lwrb) registered for path 'libs/lwrb'
Cloning into 'C:/Users/nkoni/OneDrive/Work/Winder Control/MCU/CanOpenSTM32/CANopenNode'...
remote: Enumerating objects: 4157, done.
remote: Counting objects: 100% (789/789), done.
remote: Compressing objects: 100% (224/224), done.
remote: Total 4157 (delta 581), reused 750 (delta 564), pack-reused 3368
Receiving objects: 100% (4157/4157), 2.47 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (3111/3111), done.
Cloning into 'C:/Users/nkoni/OneDrive/Work/Winder Control/MCU/CanOpenSTM32/libs/lwmem'...
remote: Enumerating objects: 1676, done.
remote: Counting objects: 100% (345/345), done.
remote: Compressing objects: 100% (177/177), done.
remote: Total 1676 (delta 175), reused 276 (delta 130), pack-reused 1331
Receiving objects: 100% (1676/1676), 386.62 KiB | 610.00 KiB/s, done.
Resolving deltas: 100% (801/801), done.
Cloning into 'C:/Users/nkoni/OneDrive/Work/Winder Control/MCU/CanOpenSTM32/libs/lwprintf'...
remote: Enumerating objects: 1277, done.
remote: Counting objects: 100% (534/534), done.
remote: Compressing objects: 100% (298/298), done.
remote: Total 1277 (delta 208), reused 456 (delta 156), pack-reused 743
Receiving objects: 100% (1277/1277), 720.45 KiB | 785.00 KiB/s, done.
Resolving deltas: 100% (529/529), done.
Cloning into 'C:/Users/nkoni/OneDrive/Work/Winder Control/MCU/CanOpenSTM32/libs/lwrb'...
remote: Enumerating objects: 1185, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 1185 (delta 86), reused 158 (delta 51), pack-reused 970
Receiving objects: 100% (1185/1185), 261.95 KiB | 548.00 KiB/s, done.
Resolving deltas: 100% (546/546), done.
Submodule path 'CANopenNode': checked out '1c9fd7b12d76f52cdf5201383d35aaecceb19d5b'
Submodule path 'libs/lwmem': checked out '28bf5455679f2ea35891d2f151e71c30ec923ac0'
Submodule 'third_party/embedded-libs' (https://github.com/MaJerle/embedded-libs) registered for path 'libs/lwmem/third_party/embedded-libs'
Cloning into 'C:/Users/nkoni/OneDrive/Work/Winder Control/MCU/CanOpenSTM32/libs/lwmem/third_party/embedded-libs'...
remote: Enumerating objects: 1649, done.
remote: Total 1649 (delta 0), reused 0 (delta 0), pack-reused 1649
Receiving objects: 100% (1649/1649), 20.30 MiB | 4.19 MiB/s, done.
Resolving deltas: 100% (941/941), done.
Submodule path 'libs/lwmem/third_party/embedded-libs': checked out 'b92511a69ee11f11efe3fb27adf53cf841291a5e'
Submodule path 'libs/lwprintf': checked out '2801bb30b865183a4c4dd27cdf87c8242ab0993b'
Submodule path 'libs/lwrb': checked out '601bc87d20d85b229bdcd19b61a50e54a6a48efc'
fatal: No url found for submodule path 'libs/lwrb/third_party/embedded-libs' in .gitmodules
Failed to recurse into submodule path 'libs/lwrb'

Configuring the micro as MASTER problem, CO_NMT_sendCommand() not defined.

Currently, I am working on configuring my code to enable the microcontroller as a master and send NMT command messages. I used the editor for configuration; however, I am facing difficulties as the CO_NMT_sendCommand() function is not available in the microcontroller's IDE.

Someone can explain me the rigth passage to configure the micro as Master?

Thanks

SDO download fails with message flood

Using candump, I often times observe the following behaviour on the CAN bus when my PI (using python-canopen) tries to upload an SDO to Node-id 3 (stm32).

can0  603   [8]  21 00 70 01 40 00 00 00
can0  583   [8]  60 00 70 01 00 00 00 00
can0  603   [8]  00 00 80 00 C0 C0 00 00
can0  583   [8]  20 00 00 00 00 C0 00 00
can0  583   [8]  00 00 00 00 00 20 00 00
can0  583   [8]  00 20 00 00 00 00 00 00
can0  583   [8]  00 00 00 00 00 00 00 20
can0  583   [8]  00 00 00 00 00 20 00 00
can0  583   [8]  00 00 00 00 20 00 00 00
can0  583   [8]  00 00 00 20 00 00 00 00
can0  603   [8]  10 00 00 00 00 00 00 00
can0  583   [8]  30 00 00 00 00 00 00 00
can0  583   [8]  30 00 00 00 30 00 00 00
can0  583   [8]  00 00 00 00 30 00 00 30
can0  583   [8]  00 00 30 00 00 00 00 30
can0  583   [8]  00 00 30 00 00 30 00 00
can0  583   [8]  00 00 30 00 00 00 00 00
can0  583   [8]  00 00 30 00 00 00 30 00
can0  583   [8]  00 00 30 00 00 00 30 00
can0  583   [8]  00 00 30 00 00 30 00 00
can0  583   [8]  00 00 30 00 00 00 00 00
can0  083   [8]  00 00 00 01 00 00 00 00
can0  703   [1]  05
can0  603   [8]  80 00 00 00 00 00 04 05
can0  603   [8]  0F 00 00 00 00 00 00 00
can0  603   [8]  0F 00 00 00 00 00 00 00
can0  583   [8]  80 00 70 01 01 00 04 05

The way I see it, the node is putting out garbage on the bus starting from line 5.
This then disrupts the canopen stack on the PI and the SDO download fails.

Is there any obvious error in my thinking?
Is this a common error that is easily fixed?
Do those multiple messages from the node have any purpose, or are they really just a glitch?

Any help will be apreciated.

How can I detect that an slave node is connected to the CAN bus before the HeartBeat message

Hi, I am new in the communication with CANOpen stack and I am thinking how I can detect that some node is connected to the CAN BUS and in the case that I detect the node, send a message over NMT master to put this node in operational mode.

I could see that there is a function called CO_NMT_sendCommand for the communication of the state of the NTM to the slave, but firts I would like to know how to know if there is a new node connected to the CAN bus.

Any idea?

Error prevents LSS Service to be run

Correct me if I'm wrong, but I think line 166 is missing an exception. This should look like line 156. Otherwise the execution of the function is aborted for an unconfigured node and the CAN interface is not started. So the device can't be reached via LSS anymore. At least this is the case in my application.

if (err != CO_ERROR_NO && err != CO_ERROR_NODE_ID_UNCONFIGURED_LSS) {
if (err == CO_ERROR_OD_PARAMETERS) {
log_printf("Error: Object Dictionary entry 0x%X\n", errInfo);
} else {
log_printf("Error: CANopen initialization failed: %d\n", err);
}
return 3;
}
err = CO_CANopenInitPDO(CO, CO->em, OD, canopenNodeSTM32->activeNodeID, &errInfo);
if (err != CO_ERROR_NO) {
if (err == CO_ERROR_OD_PARAMETERS) {
log_printf("Error: Object Dictionary entry 0x%X\n", errInfo);
} else {
log_printf("Error: PDO initialization failed: %d\n", err);
}
return 4;
}

Adding second PDO breaks node

Hey, I'm following your YouTube example to send a counter using a TPDO and it's working as expected. I'm now trying to add a second PDO to send the counter as well, but as soon as I add it, things break (no bootup message sent, neither PDO sends, and the counter parameter stops incrementing) . If I delete either TPDO, the application and TPDO works as expected. I've tried reducing the transmit frequency and increasing the inhibit but neither helped.

Any obvious things to check or suggestions on how to debug?

image

image

image

Example improvement

Could you please imrpvoe the example to really focus only on peripherals required for FDCAN + CanOpenNode? No need for LTDC + OCTOSPI I believe.

Impossible to use more than 2 TPDOs

Hello,
When I m using more thant 2 TPDOs (configured with the OD_editor), the 2 first TPDOs are sent and then, nothing happens.
In CO_CANsend I have the error CO_ERROR_TX_OVERFLOW. If i only use 2 TPDOs, it works perfectly.

When i put a breakpoint before CO_process_TPDO, then it works and send all TPDOS, but the device will no longer receive any commands.

Overflow flag in STM32L4xx

// I didn't find overflow error register in STM32, if you find it please let me know

I found this comment. The STM32L4xxb and STM32F4xx sets the FOVR flag in the CAN_RFxR Register when an overrun occurs. I think overrun in STM language is the same as overflow in CanOpen language. This flag exists for each receive fifo.

STM Reference manual manual says:

Overrun
Once the FIFO is in pending_3 state (i.e. the three mailboxes are full) the next valid
message reception will lead to an overrun and a message will be lost. The hardware
signals the overrun condition by setting the FOVR bit in the CAN_RFR register.

Not sure if the flag also exists when using the FDCAN driver.

HAL_FDCAN_ActivateNotification asserts

Hi,

First a big thank to contributers of CanOpenSTM32. It's a super library.

I use the library with a STM32G4xx, which has FDCAN.

I activated USE_FULL_ASSERT and see that in the HAL file stm32g4xx_hal_fdcan my program asserts.

`
HAL_StatusTypeDef HAL_FDCAN_ActivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t ActiveITs,
uint32_t BufferIndexes)
{
HAL_FDCAN_StateTypeDef state = hfdcan->State;
uint32_t ITs_lines_selection;

/* Check function parameters */
assert_param(IS_FDCAN_IT(ActiveITs));
if ((ActiveITs & (FDCAN_IT_TX_COMPLETE | FDCAN_IT_TX_ABORT_COMPLETE)) != 0U)
{
assert_param(IS_FDCAN_TX_LOCATION_LIST(BufferIndexes)); // <<<< here it asserts
}
`
The BufferIndexes must have a different value.

Missing CO_new() in canopen_app_process ?

I'm not running CanOpenSTM32 on an STM microcontroller, but I used it as a basis for a port. As a result I might miss something, but ...

It looks like that in case of a comms reset, memory of all CO objects is freed in canopen_app_process() (CO_app_STM32.c, line 219) but not allocated again before calling canopen_app_resetCommunication() in lin 221.

Should canopen_app_init() be called instead of canopen_app_resetCommunication() which does the allocation and calls canopen_app_resetCommunication() or is CO_delete() not meant to be in line 219?

STM32F4+FreeRTOS

Hi,

I am using STM32F4 with freeRTOS. Is there a reason why the ```
CANopenNodeSTM32*
canopenNodeSTM32 resets to junk value when it enters the canopen_app_process? I just see the CANopen app interrupt in between . Do I need to protect these variables using mutex?

Error when compiling the project after porting to stm32F4

I'm trying to port the application CANOpenNode-NUCLEO-STM32F303ZE on STM32 NUCLEO-F446RE for this I have done the following steps:
-through Cubemx I set the peripherals of the project CANopen_F446.ioc similar to the project CANOpenNode-NUCLEO-STM32F303ZE.ioc:
Set the right baudrate for CAN (with TimeSeg1 set to 10 and TimeSeg2 set to 1) in the CubeMX GUI
Activate the RX and TX interrupt on the CAN peripheral
Configure a timer for a 1ms overflow interrupt (TIM17 used in these examples)
From Project Manager tab in the STM32Cube and Code Generator section, choose Generate peripheral initialization as a pair of '.c/.h' files per peripheral to create Tim.H and can.h files

  • then I copied the CANopenNode folder inside the project and i removed example folder from build in that directory.
  • set CO_CONFIG_STORAGE_ENABLE to 0x00 in 301\CO_config.t.

When i build , ihave this errors:

16:06:53 **** Incremental Build of configuration Debug for project CANopen_F446 ****
make -j4 all 

arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o"
arm-none-eabi-gcc "../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.d" -MT"Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.o"
arm-none-eabi-gcc "../Core/Src/can.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/can.d" -MT"Core/Src/can.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/can.o"
arm-none-eabi-gcc "../Core/Src/gpio.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/gpio.d" -MT"Core/Src/gpio.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/gpio.o"
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
arm-none-eabi-gcc "../Core/Src/rtc.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/rtc.d" -MT"Core/Src/rtc.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/rtc.o"
arm-none-eabi-gcc "../Core/Src/stm32f4xx_hal_msp.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32f4xx_hal_msp.d" -MT"Core/Src/stm32f4xx_hal_msp.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/stm32f4xx_hal_msp.o"
arm-none-eabi-gcc "../Core/Src/stm32f4xx_it.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32f4xx_it.d" -MT"Core/Src/stm32f4xx_it.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/stm32f4xx_it.o"
arm-none-eabi-gcc "../Core/Src/syscalls.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/syscalls.d" -MT"Core/Src/syscalls.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/syscalls.o"
arm-none-eabi-gcc "../Core/Src/sysmem.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/sysmem.d" -MT"Core/Src/sysmem.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/sysmem.o"
arm-none-eabi-gcc "../Core/Src/system_stm32f4xx.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32f4xx.d" -MT"Core/Src/system_stm32f4xx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/system_stm32f4xx.o"
arm-none-eabi-gcc "../Core/Src/tim.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/tim.d" -MT"Core/Src/tim.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/tim.o"
arm-none-eabi-gcc "../Core/Src/usart.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/usart.d" -MT"Core/Src/usart.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/usart.o"
arm-none-eabi-gcc "../Core/Src/usb_otg.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/usb_otg.d" -MT"Core/Src/usb_otg.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/usb_otg.o"
arm-none-eabi-gcc "C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storage.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"CANopenNode/storage/CO_storage.d" -MT"CANopenNode/storage/CO_storage.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "CANopenNode/storage/CO_storage.o"
arm-none-eabi-gcc "C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storageEeprom.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"CANopenNode/storage/CO_storageEeprom.d" -MT"CANopenNode/storage/CO_storageEeprom.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "CANopenNode/storage/CO_storageEeprom.o"
arm-none-eabi-gcc "C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/extra/CO_trace.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"CANopenNode/extra/CO_trace.d" -MT"CANopenNode/extra/CO_trace.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "CANopenNode/extra/CO_trace.o"
arm-none-eabi-gcc "C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/309/CO_gateway_ascii.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F446xx -c -I../Core/Inc -I"C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode" -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"CANopenNode/309/CO_gateway_ascii.d" -MT"CANopenNode/309/CO_gateway_ascii.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "CANopenNode/309/CO_gateway_ascii.o"
In file included from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storage.h:29,
                 from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storage.c:25:
C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/301/CO_driver.h:32:10: fatal error: CO_driver_target.h: No such file or directory
   32 | #include "CO_driver_target.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storage.h:29,
                 from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storageEeprom.h:29,
                 from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/storage/CO_storageEeprom.c:25:
C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/301/CO_driver.h:32:10: fatal error: CO_driver_target.h: No such file or directory
   32 | #include "CO_driver_target.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [CANopenNode/storage/subdir.mk:22: CANopenNode/storage/CO_storage.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [CANopenNode/storage/subdir.mk:24: CANopenNode/storage/CO_storageEeprom.o] Error 1
In file included from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/extra/CO_trace.h:29,
                 from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/extra/CO_trace.c:25:
C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/301/CO_driver.h:32:10: fatal error: CO_driver_target.h: No such file or directory
   32 | #include "CO_driver_target.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [CANopenNode/extra/subdir.mk:19: CANopenNode/extra/CO_trace.o] Error 1
In file included from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/309/CO_gateway_ascii.h:30,
                 from C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/309/CO_gateway_ascii.c:27:
C:/Dati/Documenti/GitHub/CanOpenSTM32/CANopenNode/301/CO_driver.h:32:10: fatal error: CO_driver_target.h: No such file or directory
   32 | #include "CO_driver_target.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [CANopenNode/309/subdir.mk:19: CANopenNode/309/CO_gateway_ascii.o] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

16:07:02 Build Failed. 9 errors, 0 warnings. (took 9s.83ms)

CanopenNode STM32 with FreeRtOS and CRC-Unit

I have observed an interesting phenomenon. The following scenario: I ran CanopenNode_STM32 under FreeRtOS. There are three tasks in total. One task is the send and process routine for CanopenNode. One task is a controller. The third task is the receive routine for CanopenNode, so basically the function "canopen_app_interrupt()".

void start_CO_TI_Thread(void *argument)
{
  for(;;)
  {
	canopen_app_interrupt();
        osDelay(1);
  }
  osThreadTerminate(NULL);
}

Everything works fine until I enable CRC. In this case FreeRtOS ignores the delay function (osDelay(1)) and does not process any other task except the receive routine. Why the CRC unit does this is beyond me, but in this case it is because of the macros "CO_LOCK_OD" and "CO_UNLOCK_OD". After some research I rewrote the macro "CO_UNLOCK_OD" from

#define CO_UNLOCK_OD(CAN_MODULE)                __set_PRIMASK((CAN_MODULE)->primask_od
 

to


#define CO_UNLOCK_OD(CAN_MODULE)                do{__set_PRIMASK((CAN_MODULE)->primask_od);__enable_irq();}while(0)

And now my code seems to work even with CRC unit turned on. Tests are still pending. I am not a computer scientist, so please correct me if my approach was stupid.

CanOpenSTM32 submodule

Could there be a CanOpenSTM32 Submodule and an example that includes that sub module. That way developers can get updates and don't have to pull in non need code. Like examples, STM32_HAL, CMSIS...
STM32_HAL and CMSIS should really just use ST's github submodules.
It would also be nice if the code didn't call out "main.h" but rather somthing like "stm32_platform.h" where the user could put the header files need. Rather than giving access to all of main.h which could have lots of stuff in it.

STM32H735_DK Example Issue With SDO

Following along with the https://www.youtube.com/watch?v=R-r5qIOTjOo&t=3028s&ab_channel=Hamed video. The example for the STM32H735 variant doesn't seem to have functioning SDO

Scanning the network reveals no devices with CAN magic, but I can see the STM32H735 transmitting the Boot msg, Heartbeat and PDO's when setup. Writing or reading SDO results in timeout as device doesn't respond.

Is there a setting I'm overlooking to have working SDO's or should the example work by default? SDO are just failing to respond.

Looks like the device isn't receiving any frames.

Any help or suggestions would be appreciated.

Undefined references CO_process_SYNC,CO_process_RPDO, CO_process_TPDO

Why am I getting these undefined references when I compile
CANopenNode_STM32/CO_app_STM32.c:260: undefined reference to CO_process_SYNC' ../CANopenNode_STM32/CO_app_STM32.c:263: undefined reference to CO_process_RPDO'
../CANopenNode_STM32/CO_app_STM32.c:266: undefined reference to `CO_process_TPDO'

Code for STM Nucleo F-303ZE

I bought 2 Nucleo-F303ZE boards, downloaded the project following the guide, compiled it and finally flashed the 2 boards.
I connected the 2 boards using 2 can SN65HVD230 transceivers.

Then I used teraterm to see the debug messages by setting the baud rate 115200 but I only get the following screen when I load the code:



Allocated 4356 bytes for CANopen objects
                                        CANopenNode - Reset communication...
                                                                            CANopenNode - Running...

how can i solve them and test correctly this example?

Parameter mismatch in CO_CANinterrupt_TX

There is a parameter argument mismatch in CO_CANinterrupt_TX, see
CanOpenSTM32/stm32f0xx_can/Core/CANOpen_STM32F0xx/CO_driver_STM32F0xx.c
CanOpenSTM32/stm32f3xx_can/Core/CANOpen_STM32F3xx/CO_driver_STM32F3xx.c

It is declared as
void CO_CANinterrupt_TX(CO_CANmodule_t *CANmodule, uint32_t MailboxNumber)

but used as

void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan){
	CO_CANinterrupt_TX(hcan,CAN_TX_MAILBOX0);
}
void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan){
	CO_CANinterrupt_TX(hcan,CAN_TX_MAILBOX0);
}
void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan){
	CO_CANinterrupt_TX(hcan,CAN_TX_MAILBOX0);
}

Remove the dependency on TICK timer

Hi,

I noticed that the dependency on tick timer can be removed and it can be replaced with 1ms timer that we already have for other CANOpen tasks. Alternatively, It can be somehow integrated in to the System Tick timer to free up the 1ms Timer. This is open for discussion.

build fails with: No rule to make target 'C:/mx/Projects/CanOpenSTM32-master/libs/lwrb/lwrb/src/lwrb/lwrb.c', needed by 'lwrb/lwrb.o'

Tried to "build all" on a fresh IDE STM32CubeIDE 1.8.0 on win64. Fails with:

11:03:50 **** Incremental Build of configuration Debug for project CANOpenNode-STM32H735G-DK-FreeRTOS ****
make -j8 all
make: *** No rule to make target 'C:/mx/Projects/CanOpenSTM32-master/libs/lwrb/lwrb/src/lwrb/lwrb.c', needed by 'lwrb/lwrb.o'. Stop.
"make -j8 all" terminated with exit code 2. Build might be incomplete.

11:03:50 Build Failed. 1 errors, 0 warnings. (took 395ms)

TPDO not working on STM32F1

I am having trouble with the TX PDO Mapping. I have successfully produced a recurring heartbeat and whilst following the Tutorial and the examples. I cannot implement the Counter TXPDO example. Please assist. I am sure it has to do with the Odject Dictionary Editor. I can also successfully read the counter manually through Magic Can.
image
image
image
image

connectivity issue with Nucleo-F103RB

Hi, I am trying to connect a Nucleo-F103RB and can't seem to get the node running. the system is setup according to these steps:
https://github.com/CANopenNode/CanOpenSTM32#when-usingporting-nucleo-examples-do-not-forget-to-

the status LED's are connected, and the green light typically is blinking. when I don't have a CAN bus running, the red light is blinking. opening CANopen magic lite and pressing 'Scan Network' seems to push the node to 'pre-operational' (green LED is blinking, frequency ca 2.5Hz) but it is not detected on the network as a node in bootup mode.

are there particular steps i can double check or do in addition with the F103RB? or is there a specific example I could reference to for the CubeMX setup? CAN config:
CAN network 1
image

many thanks for any help!

node ID is not added to COB ID in EDS file

Got the system running and regenerated a working EDS file. the only problem I encountered so far was that the Node ID was not added to the COB ID in the EDS file:

image

I have tried to add $NODEID + COBID in the EDS editor:
image

but this is not allowed.
I can do this in the Object Dictionary:
image
but whenever I change the PDO and save it, the value is overwritten with 0x180.

I have now changed this in the PLC directly:
image
and this works, but is still a manual input.

is it possible to set the EDSeditor in such a way that when I create a PDO, the +$NODEID is automatically added to the EDS file?

there are default S/PDO's which do have this addition in the EDS file:
image

maybe I missed a simple setting?

Interrupt Use?

Does your port use interrupts, or does it just poll the device?

CUBEMX for STM32H7 initialise issue

When setting up the FDCAN peripheral for STM32H7 through CUBE MX, the user must add a value to Tx Fifo Queue Elmts Nbr to allow transmission of data packets. Otherwise the check for free fifo level will fail constantly .

CO_driver_STM32.c .Line 259,
if (HAL_FDCAN_GetTxFifoFreeLevel(((CANopenNodeSTM32*)CANmodule->CANptr)->CANHandle) > 0) will always evaluate to false otherwise

Send/Receive simultaneously with 2 Nodes

I have a question, i have at the moment 2 Nodes. Both Nodes run with canOpen and RTOS. I put the canopen_app_interrupt() method in a Task with 1ms Delay instead of the HAL_TIM_PeriodElapsedCallback().
The other Code canopen_app_process() and send function is in a other Task (like the Example in this Repository). At this time i send the canopen var manually on the Bus with the CO_TPDOsendRequest(...).

But if i want that both nodes send and receive simultaneously i have to set the timing in the Task with the canopen_app_process(), to at least 100ms otherwise the nodes didn't receives nothing more. The delay is set with osDelay().

Maybe i missed something, is there a way that this scenario work with less than 100ms, for example with 50ms?

STM32H735 Example Nothing after bootup Message

I am playing around with the STM32h735 Example and I see the bootup message but then nothing else on the bus, the program is running the CANopen Process but no ISR's related to FDCAN are triggered and no PDO's are output even though it says the NMT state is operational.

Should I be seeing TXPDO on the network? or do I need to setup something additional? I see it has an Object Dictionary with everything mapped and not waiting on SYNC.

Trying to communicate with CAN 500kbps

I try to use the example demo with the eval kit stm32h7xx and it not works for me. I create a new project with RTOS with a Thread for the can_app_process().

I can see that the stack initialize correctly and sends data over the TX-FIFO. I configure the FD-CAN1 to 500kbps.

The code enters at HAL_FDCAN_AddMessageToTxFifoQ, but when I try to receive the data over the X-Analyzer I only receive error frames.

Captura
Captura1

HELP: Multi canopen in single stm32 device.

I wonder if its possible, there could be some examples with multi canopen in a single stm32 device.

Or you may tell me about the improving direction?

Hope to receive your kind reply, thanks.๐Ÿ˜Š

CAN FD Mode and BRS Support

Does this codebase support CAN-FD, or just standard CAN over the STM32 CANFD peripheral? I see the following:

.\CANopenNodeSTM32 : Includes the implementation of low-level driver for STM32 microcontrollers, support both CAN based controllers and FDCAN without any changes. It automatically detect the controller type and activate the relevant calls to STM32 HAL libraries

But then this is hard coded in the driver:

https://github.com/CANopenNode/CanOpenSTM32/blob/master/CANopenNode_STM32/CO_driver_STM32.c#L267

Error to compile the example for STM32 NUCLEO-F303ZE

I would like to compile the example CANopenNode for STM32 NUCLEO-F303ZE correctly.
I have downloaded the folder from the github repository the folder with the .project file, I have also downloaded and added the CANopenNode folder to the project but when I compile I get the following error:

c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/CANOpen_STM32F3xx/CO_storageBlank.o: in function `CO_storageBlank_init':
C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/CO_storageBlank.c:79: undefined reference to `CO_storage_init'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/CANOpen_STM32F3xx/main_STM32F3.o: in function `main_canopen':
C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:102: undefined reference to `CO_new'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:140: undefined reference to `CO_CANinit'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:152: undefined reference to `CO_LSSinit'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:161: undefined reference to `CO_CANopenInit'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:183: undefined reference to `CO_CANopenInitPDO'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:205: undefined reference to `CO_error'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:233: undefined reference to `CO_process'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:253: undefined reference to `CO_delete'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/CANOpen_STM32F3xx/main_STM32F3.o: in function `tmrTask_thread':
C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:271: undefined reference to `CO_process_SYNC'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:274: undefined reference to `CO_process_RPDO'
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/Dati/Download/CanOpenSTM32-master/stm32f3xx_can/Debug/../Core/CANOpen_STM32F3xx/main_STM32F3.c:277: undefined reference to `CO_process_TPDO'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:65: CANOpenNode-NUCLEO-STM32F303ZE.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

how can I solve this problem?

LSS fastscan Slaves not responding

When your device is not configured (desired NodeID = 0xFF), there is no way to configure it.
For instance in this example: If the NodeID is not valid, no can-module will be initialized. So there is no way to connect to the Device, and there is no way to configure the device per LSS, isnt it?

For my tests I comment out the return command, and I could assign a node id to the device. But with standard lss. With fastscan the Device is apparently not responding in the right way.

How to avoid adding node ID to TPDO

I am trying to prototype a system where there is one controller and 4 devices for a total of 5 nodes. I have more than 4 TPDOs and am trying to sort out how to assign all the PDOs to ensure the COB-IDs are unique. I've assigned device ID 1~4 to the 4 devices so adding the node ID to the PDO base address works well here. However, for the controller, I want it to use specific TPDOs to send to each device, and it would be easier it the tool didn't add the node ID to these. Is this possible to achieve using this library?

error handling requirement

can someone tell me how I can check for communication errors/heartbeat errors? i need to write all outputs to a required state (off) in case of any comms issue.

all in all everything is working really well, extremely pleased with the progress! this would be my last hurdle.

How to set the STM as a NMT master and send NMT commands?

Hi,

I have import the CANopenNodeSTM32 to my project and configurate the heartbeat and PDOs via CANopenEditor. Thats works fine. My second device is a slave and starts in the pre-operational mode. So I would send the NMT command from the STM to set the second device to the operational mode.

My question is now, how to set the STM to a NMT master and how can I send the NMT commands like the operational mode. I think it should be also possible to configurate it in the editor and send it.

Adapting to Nucleo-144 STM32F429

Hi. I would like to implement your code for STM32F429. Can you provide a list of things which i need to change in the code? And could this list be generalized so that your code can be adapted to other MUCs in the STm32 family?

STM32F4DISCOVERY CAN port cannot communicate

HI.

I have downloaded CanOpenSTM32 and am using the STM32F4DISCOVERY example. I am using a USB to CAN adapter to communicate with the STM32F4DISCOVERY via CAN. However, I found that the CAN communication is not working properly, even though the baud rate is correct. To rule out issues with my wiring, I used an Arduino CAN example program, and I found that the Arduino CAN program works fine.

I don't know how to solve this problem, has anyone else encountered this issue and can help me? Thank you very much,

warmest regards.

More than four event-driven TPDOs

I can't seem to get more than four TPDOs transmitting using event timers (TPDO type 254). Currently I have five TPDOs defined with the following COBs:

(0x40000180, 0x40000280, 0x40000380, 0x40000480, 0x40000181)

I can transmit any four of them on a timer (type=254) with one not transmitting (type=0). When I try to add the fifth (regardless of which one it is) I get an emergency message:
Error code: Communication - CAN overrun (objects lost) (0x8110)

image

I've tried increasing the timers, adding 10ms inhibit on each one, or varying the timers of each TPDO (thinking it would be a network buffer problem) but to no avail. I've had lots of data transmitting on the same hardware in the past successfully over CAN FD.

I'm running this on an STM32G4 and have largely just copy-pasted the example driver. Is this error a limitation of the default CanOpenSTM32 driver only being able to transmit four TPDOs? Or have I got something wrong with my configuration?

Any help much appreciated!! TIA from CANOpen newbie

Reading of Visible String Result in SDO protocol timed out

I want to read a Visible String data type, but I always get Abbort code 0504 0000h - SDO protocol timed out.

I guess that's because I have more than 4 bytes of data, but I think that should be handled by segment/block transfer. I am having trouble finding the instructions on how to set up the block/segmented transfer options.

CANopenNodeSTM32.baudrate should be uint16_t

CANopenNodeSTM32.baudrate is currently uint8_t, so when entering a rates above 250kbps it gets truncated to 8 bits.

diff --git a/CANopenNode_STM32/CO_app_STM32.h b/CANopenNode_STM32/CO_app_STM32.h
index b91d75d..16ef037 100644
--- a/CANopenNode_STM32/CO_app_STM32.h
+++ b/CANopenNode_STM32/CO_app_STM32.h
@@ -31,7 +31,7 @@ typedef struct {
 	 * be the final NodeID, after calling canopen_app_init() you should check ActiveNodeID of CANopenNodeSTM32 structure for assigned Node ID.
 	 */
     uint8_t activeNodeID; /* Assigned Node ID */
-    uint8_t baudrate;     /* This is the baudrate you've set in your CubeMX Configuration */
+    uint16_t baudrate;     /* This is the baudrate you've set in your CubeMX Configuration */
     TIM_HandleTypeDef*
         timerHandle; /*Pass in the timer that is going to be used for generating 1ms interrupt for tmrThread function,
 	 * please note that CANOpenSTM32 Library will override HAL_TIM_PeriodElapsedCallback function, if you also need this function in your codes, please take required steps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.