2016-04-19 03:03 PM
hcan is locked permanently in HAL_CAN_Transmit_IT when all transmit boxes are full.
Bellow is compressed HAL_CAN_Transmit_IT function: HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan) { uint32_t transmitmailbox = CAN_TXSTATUS_NOMAILBOX; /* Check the parameters */ assert_param(IS_CAN_IDTYPE(hcan->pTxMsg->IDE)); assert_param(IS_CAN_RTR(hcan->pTxMsg->RTR)); assert_param(IS_CAN_DLC(hcan->pTxMsg->DLC)); if((hcan->State == HAL_CAN_STATE_READY) || (hcan->State == HAL_CAN_STATE_BUSY_RX)) { /* Process Locked */ __HAL_LOCK(hcan); //Here process is locked /* Select one empty transmit mailbox */ if(HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME0)) { ..... } else { transmitmailbox = CAN_TXSTATUS_NOMAILBOX; } if(transmitmailbox != CAN_TXSTATUS_NOMAILBOX) { ........... /* Process Unlocked */ __HAL_UNLOCK(hcan); ........... } //!!!!!!!!!!! when all mailboxes are full program goes here and exits with hcan no unlocked } else { return HAL_BUSY; } return HAL_OK; }2016-04-20 03:50 AM
Hi riabovas.justas,
Same issue is already reported and fixed for STM32F4.Refer to this [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/HAL_CAN_Transmit_IT%28%29%20Missing%20__HAL_UNLOCK%28%29&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=117]thread.Regards2016-04-20 03:52 AM
Hi riabovas.justas,
Thanks for highlighting this issue.It is a known bug, but the fix has not yet been released on the web. -Syrine-