提交 a282faf2 编写于 作者: ZZJ!'s avatar ZZJ! 提交者: guo

[bsp/stm32] fix the bug of 'can' being stucked when short cricuit the canH and...

[bsp/stm32] fix the bug of 'can' being stucked when short cricuit the canH and canL, change some wrong annotations
上级 10b71175
...@@ -343,7 +343,7 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg) ...@@ -343,7 +343,7 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg)
} }
/** /**
* ID | CAN_FxR1[31:24] | CAN_FxR1[23:16] | CAN_FxR1[15:8] | CAN_FxR1[7:0] | * ID | CAN_FxR1[31:24] | CAN_FxR1[23:16] | CAN_FxR1[15:8] | CAN_FxR1[7:0] |
* MASK | CAN_FxR2[31:24] | CAN_FxR1[23:16] | CAN_FxR1[15:8] | CAN_FxR1[7:0] | * MASK | CAN_FxR2[31:24] | CAN_FxR2[23:16] | CAN_FxR2[15:8] | CAN_FxR2[7:0] |
* STD ID | STID[10:3] | STDID[2:0] |<- 21bit ->| * STD ID | STID[10:3] | STDID[2:0] |<- 21bit ->|
* EXT ID | EXTID[28:21] | EXTID[20:13] | EXTID[12:5] | EXTID[4:0] IDE RTR 0| * EXT ID | EXTID[28:21] | EXTID[20:13] | EXTID[12:5] | EXTID[4:0] IDE RTR 0|
* @note the 32bit STD ID must << 21 to fill CAN_FxR1[31:21] and EXT ID must << 3, * @note the 32bit STD ID must << 21 to fill CAN_FxR1[31:21] and EXT ID must << 3,
...@@ -482,7 +482,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t ...@@ -482,7 +482,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t
if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME0) != SET) if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME0) != SET)
{ {
/* Change CAN state */ /* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR; // hcan->State = HAL_CAN_STATE_ERROR;
/* Return function status */ /* Return function status */
return -RT_ERROR; return -RT_ERROR;
} }
...@@ -491,7 +491,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t ...@@ -491,7 +491,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t
if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME1) != SET) if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME1) != SET)
{ {
/* Change CAN state */ /* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR; // hcan->State = HAL_CAN_STATE_ERROR;
/* Return function status */ /* Return function status */
return -RT_ERROR; return -RT_ERROR;
} }
...@@ -500,7 +500,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t ...@@ -500,7 +500,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t
if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME2) != SET) if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME2) != SET)
{ {
/* Change CAN state */ /* Change CAN state */
hcan->State = HAL_CAN_STATE_ERROR; // hcan->State = HAL_CAN_STATE_ERROR;
/* Return function status */ /* Return function status */
return -RT_ERROR; return -RT_ERROR;
} }
...@@ -732,6 +732,10 @@ void CAN1_TX_IRQHandler(void) ...@@ -732,6 +732,10 @@ void CAN1_TX_IRQHandler(void)
/* Write 0 to Clear transmission status flag RQCPx */ /* Write 0 to Clear transmission status flag RQCPx */
SET_BIT(hcan->Instance->TSR, CAN_TSR_RQCP2); SET_BIT(hcan->Instance->TSR, CAN_TSR_RQCP2);
} }
else
{
rt_hw_can_isr(&drv_can1.device, RT_CAN_EVENT_TX_FAIL | 0 << 8);
}
rt_interrupt_leave(); rt_interrupt_leave();
} }
...@@ -852,6 +856,10 @@ void CAN2_TX_IRQHandler(void) ...@@ -852,6 +856,10 @@ void CAN2_TX_IRQHandler(void)
/* Write 0 to Clear transmission status flag RQCPx */ /* Write 0 to Clear transmission status flag RQCPx */
SET_BIT(hcan->Instance->TSR, CAN_TSR_RQCP2); SET_BIT(hcan->Instance->TSR, CAN_TSR_RQCP2);
} }
else
{
rt_hw_can_isr(&drv_can2.device, RT_CAN_EVENT_TX_FAIL | 0 << 8);
}
rt_interrupt_leave(); rt_interrupt_leave();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册