cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown type for CanTxMsgTypeDef

Radu Ghiga
Associate II
Posted on May 03, 2018 at 08:39

Hello,

I have a similar code, where I define a message buffer of type 

CanTxMsgTypeDef. However, when compiling, I get an error saying  CanTxMsgTypeDef is an unknown type. So I guess this needs to be defined somewhere, or there is a file where it is already defined that needs to be included in the project? I am using STM32CubeMX to configure the CAN peripheral and I was thinking it should take care of all the include files.

Thanks in advance for the help!

Radu

5 REPLIES 5
T J
Lead
Posted on May 03, 2018 at 13:01

I found your

unknown type

here;

  in stm32f0xx_can.h    in folder ..\Drivers\STM32F0xx_HAL_Driver\Inc

/**

  * @brief  CAN Tx message structure definition   

  *

  */

typedef struct

{

  uint32_t StdId;    /*!< Specifies the standard identifier.

                          This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */

  uint32_t ExtId;    /*!< Specifies the extended identifier.

                          This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */

  uint32_t IDE;      /*!< Specifies the type of identifier for the message that will be transmitted.

                          This parameter can be a value of @ref CAN_identifier_type */

  uint32_t RTR;      /*!< Specifies the type of frame for the message that will be transmitted.

                          This parameter can be a value of @ref CAN_remote_transmission_request */

  uint32_t DLC;      /*!< Specifies the length of the frame that will be transmitted.

                          This parameter must be a number between Min_Data = 0 and Max_Data = 8. */

  uint8_t Data[8];  /*!< Contains the data to be transmitted.

                          This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */

}CanTxMsgTypeDef;
Posted on May 03, 2018 at 13:27

Thank you T J!

I have looked for it as well and in my case (I forgot to mention I am using an STM32F767) the Driver version is FW_F7_1.11.0.  For this version the CAN Driver has been modified and that typedef struct is different. So it seems I have to adapt to the new drivers and I cannot use 

CanTxMsgTypeDef;

The typedef struct from the new firmware is like this:

typedef struct

{

uint32_t StdId; /*!< Specifies the standard identifier.

                        This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */

uint32_t ExtId; /*!< Specifies the extended identifier.

                         This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */

uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.

                           This parameter can be a value of @ref CAN_identifier_type */

uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted.

                           This parameter can be a value of @ref CAN_remote_transmission_request */

uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted.

                            This parameter must be a number between Min_Data = 0 and Max_Data = 8. */

FunctionalState TransmitGlobalTime; /*!< Specifies whether the timestamp counter value captured on start

                                                               of frame transmission, is sent in DATA6 and DATA7 replacing pData[6] and                                                                          pData[7].

                                                               @note: Time Triggered Communication Mode must be enabled.

                                                               @note: DLC must be programmed as 8 bytes, in order these 2 bytes are sent.

                                                                 This parameter can be set to ENABLE or DISABLE. */

} CAN_TxHeaderTypeDef;

I do not know if this applies for the drivers of the other STM32F series.

Thank you again!

Radu

Amel NASRI
ST Employee
Posted on May 03, 2018 at 17:34

Hello

radu.ghiga

‌,

I make a branch of your post to a new question to manage it separately.

This should be better as it may be a different issue than what was reported in

https://community.st.com/0D50X00009XkXapSAF

.

I would like to come back to your initial description. So, please precise the CubeMX version you are using. If it is not the last one (V4.25), please migrate to use this one.

If the compilation issue is faced with CubeMX 4.25, we need to reproduce it at our end. So please share your .ioc file.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on May 04, 2018 at 07:47

Hello Amel and thank you for your reply. I am using the following tools:

STM32CubeMX Version 4.0

STM32-MAT/Target Version 4.4.2

STM32F7 FW 1.0

Matlab/Simulink 2017b

Atolic TrueStudio for STM32 V9.0.0

Please find attached the .ioc file that I used in my Simulink model.

Thank you and best regards,

Radu

________________

Attachments :

Nucleo_CAN.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxeF&d=%2Fa%2F0X0000000b0X%2FU475EBw7hJcQyE37FDpVB41Ouc8jtXVIeVPibjiRZ14&asPdf=false
Amel NASRI
ST Employee
Posted on May 04, 2018 at 13:13

Hello

radu.ghiga

‌,

This is the same request as

https://community.st.com/0D50X00009XkWQeSAN

.

Please avoid duplicating same entry in more than one discussion.

Your request will be followed in the other discussion.

Thanks for your understanding.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.