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。
帮顶 学习学习 是定的的8字节数组,哪里有错了? 谢谢分享 这样定义也许不是错误的,只是和CAN协议不同,初次见到会觉得有问题 对不对不能确定,但显然太随意了,浪费空间。 他这样定义确实有些奇怪,但是他发送或接受的时候是没错的,注意给它赋值的时候就不要用memcpy这类接口函数了,你8个字节其实只是对数组的前两个成员赋值了,你需要一个个单独赋值 这也有错????
页:
[1]