This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
CMS3in1/1.Cabin/4.MISC/CMS_BMS/readme.txt

11 lines
680 B
Plaintext
Raw Normal View History

USB数据传输采用USBCDC类虚拟串口进行传输上位机可以直接通过串口与下位机通讯也能使用USB协议与下位机通讯
USB通讯采用端点传输方式具体参数可在 "usbd_cdc.h"中进行修改
USB通过“usbd_cdc_if.c”中的static int8_t CDC_Receive_HS(uint8_t* Buf, uint32_t *Len)函数接受数据通过uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len)发送数据
当上位机向单片机发送/接受数据时单片机进入“void OTG_HS_IRQHandler(void)”中断执行HAL_PCD_IRQHandler(&hpcd_USB_OTG_HS) 函数
**单片机向上位机发送的数据不能是64的整数倍
参考资料http://t.csdn.cn/4oRNV