2017-10-07 05:24 AM
I am using the latest HAL library to transmit CAN messages using interrupts. I am aware of the 3 mailboxes limitation but I would like to know if someone had implemented a queue system that transmit most of the CAN messages.
I tried to follow the HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan) function.
So putting counters on every return of this function equals 1 vs the TX interrupt, my counters are not matching.
To enable the TX interrupts, I simply set:
HAL_NVIC_SetPriority(CAN1_TX_IRQn,3, 0);
HAL_NVIC_EnableIRQ(CAN1_TX_IRQn);Do I need to set another flag? from my understanding, using the HAL_CAN_Transmit_IT will generate an interrupt, is that correct?
#hal #can2017-10-10 11:36 PM
I don't use the HAL transmitter software system itself, I just load the buffers and trigger the flags.
this leaves the interrupts in place and very little software overhead for every frame.
maybe you are looking for something like this ;
if (((CAN->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) ||
((CAN->TSR & CAN_TSR_TME1) == CAN_TSR_TME1) ||
((CAN->TSR & CAN_TSR_TME2) == CAN_TSR_TME2)�?�?�?)
{
if(HAL_CAN_Transmit_IT(&CanHandle) != HAL_OK)
{
cantx_counter++;
return 0;
}
else
{
packetsend_counter++;
return 1;
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
2017-10-13 12:21 AM
Thanks everybody. I found another function where I wasn't pushing the CAN message to the Queue, instead I was trying to transmit and that was causing the confusion on available Mailboxes.
My CAN TX Queue is working fine. Now that I have that I am dealing with my CAN RX Interrupt stops firing when I start sending CAN messages from another node too fast (every 4 ms) Interrupt works a short time and then it doesn't trigger.
I will need to open another post related to this issue
2017-10-15 07:00 PM
Hey
talledo.jean
,looks like you're working on a C++ CANOpen stack? I might be interested in participating in my free time. Is the source open by any chance?
Cheers!