J-f-Jensen / libraries

Libraries
4 stars 2 forks source link

STM32H743ZI 'CAN_HandleTypeDef' does not name a type #1

Open shaneyake opened 3 years ago

shaneyake commented 3 years ago

Hello,

I am trying to get this to work on a NUCLEO-H743ZI2, This is the error I am getting. Any help would be greatly appreciated.

Thanks

In file included from /var/folders/f7/7flfjpj52dj5srbc18wdqr680000gn/T/arduino_modified_sketch_180005/CAN_TrafficSnooper.ino:7:
/Users/shane/Documents/Arduino/libraries/STM32CAN/STM32CAN.h:164:32: error: expected ')' before '*' token
  164 |     stm32Can( CAN_HandleTypeDef* pCanHandle, int portNumber );
      |             ~                  ^
      |                                )
/Users/shane/Documents/Arduino/libraries/STM32CAN/STM32CAN.h:215:21: error: 'CAN_HandleTypeDef' has not been declared
  215 |     void      init( CAN_HandleTypeDef* CanHandle, int baudrate, bool UseAltPins, bool loopBack );
      |                     ^~~~~~~~~~~~~~~~~
/Users/shane/Documents/Arduino/libraries/STM32CAN/STM32CAN.h:216:34: error: 'CAN_HandleTypeDef' has not been declared
  216 |     void      calculateBaudrate( CAN_HandleTypeDef *CanHandle, int Baudrate );
      |                                  ^~~~~~~~~~~~~~~~~
/Users/shane/Documents/Arduino/libraries/STM32CAN/STM32CAN.h:226:5: error: 'CAN_HandleTypeDef' does not name a type; did you mean 'DAC_HandleTypeDef'?
  226 |     CAN_HandleTypeDef *n_pCanHandle;
      |     ^~~~~~~~~~~~~~~~~
      |     DAC_HandleTypeDef
exit status 1
Error compiling for board Nucleo-144.
J-f-Jensen commented 3 years ago

It looks like you not have added the curtom hal file in your project. If you look in the example folder you can see one for a stm32f103, dont remember if it works for alle stm32

shaneyake commented 3 years ago

Thanks for a response. I am trying to compile your example. Compiles with no issues for the stm32f103.

Do you have any idea of were I should start to try debug this? I am very new to STM32.

J-f-Jensen commented 3 years ago

You need to copy the hal_conf_extra.h file from the libray/example folder to you NUCLEO-H743ZI2 project folder (eg the folder where the ino file is placed), this file enable the lowlevel stm32 hal CAN functionality needed

shaneyake commented 3 years ago

Yes, I understand. I have done that. If I choose stm32f103 as the selected board then it complies without any errors but when I select the stm32H743ZI then it has the above error. The stm32H743ZI is on the supported list for the stm32-core so I am not sure where the problem would come from.

If you select NUCLEO-144 with the H743ZI2 in the tools menu you would get the same error, if you would like to recreate it on your side.

If you could look into this for me, I would really appreciate it.

J-f-Jensen commented 3 years ago

Please try to open the hal_conf_extra.h file and replace HAL_CAN_MODULE_ENABLED with HAL_FDCAN_MODULE_ENABLED

If this don't solve the problem the this library cannot be used with the STM32Hxxxx without major modifications. And sorry to say I do not have a board with STM32Hxxxx serie controller enabling me to update/test

shaneyake commented 3 years ago

It looks like FDCAN is quite diffrent from CAN, sadly your library won't compile. Thanks for looking into this for me.