Question
HAL_CAN_Transmit_IT(): Missing __HAL_UNLOCK() ?
Posted on July 17, 2015 at 11:28
We have experienced EWG error when calling HAL_CAN_Transmit_IT() repeatedly with the same CAN handle.
Making following changes in the hal_can could we solve this problemHAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)
{ ... tmp = hcan->State; if((tmp == HAL_CAN_STATE_READY) || (tmp == HAL_CAN_STATE_BUSY_RX)) { __HAL_LOCK(hcan); /* Select one empty transmit mailbox */ if((hcan->Instance->TSR&CAN_TSR_TME0) == CAN_TSR_TME0) { transmitmailbox = 0; } else if((hcan->Instance->TSR&CAN_TSR_TME1) == CAN_TSR_TME1) { transmitmailbox = 1; } else if((hcan->Instance->TSR&CAN_TSR_TME2) == CAN_TSR_TME2) { transmitmailbox = 2; } else { transmitmailbox = CAN_TXSTATUS_NOMAILBOX; } if(transmitmailbox != CAN_TXSTATUS_NOMAILBOX){
.... } /* new code */ else { __HAL_UNLOCK(hcan); return HAL_BUSY; } /* end of new code */ .... + Did anyone experienced a similar problem ? + HAL should contemplate this case -> STMCubeF4 V1.7 should be fixed ? Thanks in advance! #stmcube-stm32f4-can