From 681dce3c903107848b4dd7035d52a93f1d9b8082 Mon Sep 17 00:00:00 2001 From: NeoZng Date: Thu, 13 Apr 2023 18:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DCAN=E7=9A=84=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Drobot=5Fdef=E5=A4=84=E5=AE=8F=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- Src/can.c | 4 ++-- application/robot_def.h | 3 --- basic_framework.ioc | 6 ++++-- bsp/can/bsp_can.md | 4 +--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index d709577..664d149 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Thu Apr 13 11:37:21 CST 2023] +# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Thu Apr 13 18:20:17 CST 2023] ########################################################################################################################## # ------------------------------------------------ diff --git a/Src/can.c b/Src/can.c index fe60482..41173da 100644 --- a/Src/can.c +++ b/Src/can.c @@ -47,7 +47,7 @@ void MX_CAN1_Init(void) hcan1.Init.TimeTriggeredMode = DISABLE; hcan1.Init.AutoBusOff = DISABLE; hcan1.Init.AutoWakeUp = DISABLE; - hcan1.Init.AutoRetransmission = DISABLE; + hcan1.Init.AutoRetransmission = ENABLE; hcan1.Init.ReceiveFifoLocked = DISABLE; hcan1.Init.TransmitFifoPriority = ENABLE; if (HAL_CAN_Init(&hcan1) != HAL_OK) @@ -79,7 +79,7 @@ void MX_CAN2_Init(void) hcan2.Init.TimeTriggeredMode = DISABLE; hcan2.Init.AutoBusOff = DISABLE; hcan2.Init.AutoWakeUp = DISABLE; - hcan2.Init.AutoRetransmission = DISABLE; + hcan2.Init.AutoRetransmission = ENABLE; hcan2.Init.ReceiveFifoLocked = DISABLE; hcan2.Init.TransmitFifoPriority = ENABLE; if (HAL_CAN_Init(&hcan2) != HAL_OK) diff --git a/application/robot_def.h b/application/robot_def.h index 107eb7d..0e58bb7 100644 --- a/application/robot_def.h +++ b/application/robot_def.h @@ -188,10 +188,7 @@ typedef struct /* @todo : 对于平衡底盘,需要新增控制模式和控制数据 */ typedef struct { -#ifdef CHASSIS_BOARD attitude_t chassis_imu_data; -#endif // CHASSIS_BOARD - // 后续增加底盘的真实速度 // float real_vx; // float real_vy; diff --git a/basic_framework.ioc b/basic_framework.ioc index 011cd40..45bd186 100644 --- a/basic_framework.ioc +++ b/basic_framework.ioc @@ -13,14 +13,16 @@ CAN1.BS1=CAN_BS1_10TQ CAN1.BS2=CAN_BS2_3TQ CAN1.CalculateBaudRate=1000000 CAN1.CalculateTimeQuantum=71.42857142857143 -CAN1.IPParameters=CalculateTimeQuantum,BS1,BS2,Prescaler,CalculateBaudRate,TXFP +CAN1.IPParameters=CalculateTimeQuantum,BS1,BS2,Prescaler,CalculateBaudRate,TXFP,NART +CAN1.NART=ENABLE CAN1.Prescaler=3 CAN1.TXFP=ENABLE CAN2.BS1=CAN_BS1_10TQ CAN2.BS2=CAN_BS2_3TQ CAN2.CalculateBaudRate=1000000 CAN2.CalculateTimeQuantum=71.42857142857143 -CAN2.IPParameters=CalculateTimeQuantum,BS1,BS2,Prescaler,CalculateBaudRate,TXFP +CAN2.IPParameters=CalculateTimeQuantum,BS1,BS2,Prescaler,CalculateBaudRate,TXFP,NART +CAN2.NART=ENABLE CAN2.Prescaler=3 CAN2.TXFP=ENABLE Dma.ADC1.8.Direction=DMA_PERIPH_TO_MEMORY diff --git a/bsp/can/bsp_can.md b/bsp/can/bsp_can.md index 39c5cab..0e75446 100644 --- a/bsp/can/bsp_can.md +++ b/bsp/can/bsp_can.md @@ -2,9 +2,7 @@

neozng1@hnu.edu.cn

-> TODO: -> -> 1. 增加自动检测ID冲突的log输出。 +# 请注意使用CAN设备的时候务必保证总线只接入了2个终端电阻!开发板一般都有一个,6020电机和HT、LK电机也都有终端电阻,注意把多于2个的全部断开(通过拨码) ## 使用说明