AnsweredAssumed Answered

STM32F1xx CAN Again

Question asked by marco on Jul 5, 2017

Hi,

 

i'm working with little project on STM32F105, but libraries have never been corrected from STM and bugs are presents also on last version

* @version V1.0.4
* @date 29-April-2016

.

Now i have a little doubts about STM library, on HAL_CAN_Receive_IT function.

 

First question is:

Its correct enable the Transmit mailbox empty Interrupt (CAN_IT_TME ) on receive ?

 

Secondt question:

Its correct to UNLOCK the can before enable the message pending Interrupt (CAN_IT_FMP0 or CAN_IT_FMP1) ? Or is better enable all needed interrupt and unlock after ?

 

Sorry for my english

 

/* Enable interrupts: */
/* - Enable Error warning Interrupt */
/* - Enable Error passive Interrupt */
/* - Enable Bus-off Interrupt */
/* - Enable Last error code Interrupt */
/* - Enable Error Interrupt */
/* - Enable Transmit mailbox empty Interrupt */
/* __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EWG |
CAN_IT_EPV |
CAN_IT_BOF |
CAN_IT_LEC |
CAN_IT_ERR |
CAN_IT_TME );

 

__HAL_UNLOCK(hcan); // its correct this line here ?

 

if(FIFONumber == CAN_FIFO0)
{
// Enable FIFO 0 message pending Interrupt //
__HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP0);
}
else
{
// Enable FIFO 1 message pending Interrupt //
__HAL_CAN_ENABLE_IT(hcan, CAN_IT_FMP1);
}*/

Outcomes