captainliuy 发表于 2015-3-26 10:45:27

stm32f1xx HAL库CanRxMsgTypeDef定义错误【已解决】

本帖最后由 captainliuy 于 2015-10-21 10:24 编辑

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 received.
                           This parameter can be a value of @ref CAN_identifier_type */

uint32_t RTR;         /*!< Specifies the type of frame for the received message.
                           This parameter can be a value of @ref CAN_remote_transmission_request */

uint32_t DLC;         /*!< Specifies the length of the frame that will be received.
                           This parameter must be a number between Min_Data = 0 and Max_Data = 8. */

uint32_t Data;   /*!< Contains the data to be received.
                           This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */

uint32_t FMI;         /*!< Specifies the index of the filter the message stored in the mailbox passes through.
                           This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */

uint32_t FIFONumber;/*!< Specifies the receive FIFO number.
                           This parameter can be a value of @ref CAN_receive_FIFO_number_constants */

}CanRxMsgTypeDef;uint32_t Data; /*!< Contains the data to be received.
This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */
can接收数据应该是8个字节


在“STM32Cube_FW_F1_V1.2.0”中已fix。

肖久 发表于 2015-3-27 09:13:27

帮顶 学习学习

党国特派员 发表于 2015-3-27 09:32:13

是定的的8字节数组,哪里有错了?

wambob 发表于 2015-3-30 14:17:31

谢谢分享

captainliuy 发表于 2015-5-5 14:14:16

这样定义也许不是错误的,只是和CAN协议不同,初次见到会觉得有问题

Tension 发表于 2015-5-6 17:05:12

对不对不能确定,但显然太随意了,浪费空间。

jameslee 发表于 2015-8-4 14:01:41

他这样定义确实有些奇怪,但是他发送或接受的时候是没错的,注意给它赋值的时候就不要用memcpy这类接口函数了,你8个字节其实只是对数组的前两个成员赋值了,你需要一个个单独赋值

晴天-380557 发表于 2016-2-26 14:59:28

这也有错????
页: [1]
查看完整版本: stm32f1xx HAL库CanRxMsgTypeDef定义错误【已解决】