CAN bus driver - transmission abort
Posted: Tue Sep 27, 2011 10:18 am
Hi,
for my project I need to be able to abort a pending CAN transmission (as I want to use an Earliest Deadline First scheduler to assign message priority, i have to update CAN ID while the time goes on), that can be done (on STM32) by setting a bit in the CAN transmit status register (CAN_TSR) for the corresponding mailbox (ABRQ0-1-2).
To be able to set this bit I need to know in wich mailbox the CANTxFrame has been copied, that means returning/storing (canp->can->TSR & CAN_TSR_CODE) >> 24) value used to select a free mailbox in can_lld_transmit.
How do you suggest to accomplish this? It would be better to add a field in the CANTxFrame structure, or to return it from can_lld_transmit and add a pointer to the CanTransmit() function in wich the value has to be stored? Is it a feature that can be included in the HAL or it looks like too custom to be integrated in ChibiOS?
Thanks,
Martino
for my project I need to be able to abort a pending CAN transmission (as I want to use an Earliest Deadline First scheduler to assign message priority, i have to update CAN ID while the time goes on), that can be done (on STM32) by setting a bit in the CAN transmit status register (CAN_TSR) for the corresponding mailbox (ABRQ0-1-2).
To be able to set this bit I need to know in wich mailbox the CANTxFrame has been copied, that means returning/storing (canp->can->TSR & CAN_TSR_CODE) >> 24) value used to select a free mailbox in can_lld_transmit.
How do you suggest to accomplish this? It would be better to add a field in the CANTxFrame structure, or to return it from can_lld_transmit and add a pointer to the CanTransmit() function in wich the value has to be stored? Is it a feature that can be included in the HAL or it looks like too custom to be integrated in ChibiOS?
Thanks,
Martino