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
CAN bus driver - transmission abort Topic is solved
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: CAN bus driver - transmission abort
Return from can_lld_transmit this kind of info would be platform-specific, better add a field in the can frame which is defined in the low level. Then you could add an STM32-specific function from the low level driver (adding platform-specific APIs is allowed by the rules), for example:
canSTM32AbortTransmission()
Care should be taken to make the function do nothing if the frame is already "gone".
Giovanni
canSTM32AbortTransmission()
Care should be taken to make the function do nothing if the frame is already "gone".
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: CAN bus driver - transmission abort
Hello,
Ok, this thread is eight years old, but, the question is still of interest.
Aborting an ongoing transmission to be able to send an higher priority message is described in the standard (at least in the book "Understanding and Using the Controller Area Network Communication Protocol", page 30) as a desired (yet not mandatory) feature.
Could the canSTM32AbortTransmission(canmbx_t mailbox) be in the standard ChibiOS CAN API ?
Alexandre
Ok, this thread is eight years old, but, the question is still of interest.
Aborting an ongoing transmission to be able to send an higher priority message is described in the standard (at least in the book "Understanding and Using the Controller Area Network Communication Protocol", page 30) as a desired (yet not mandatory) feature.
Could the canSTM32AbortTransmission(canmbx_t mailbox) be in the standard ChibiOS CAN API ?
Alexandre
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: CAN bus driver - transmission abort
Moving to change request, I can add the API but implementing in LLD and testing is something I cannot do, that would require a special setup and instruments.
Giovanni
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: CAN bus driver - transmission abort
Thank you,
I have a little experimental working CAN network, nothing shiny, few F767 drone autopilot with CAN transceiver wired together.
With a saleae logic pro, supporting can 2.0b frame, I can begin to experiment, I'll post here results.
I want to eventually use uavcan to connect sensors to the autopilot, at least sensors that have to be far from the autopilot, and don't need too much bandwidth.
Bandwidth problem can probably be resolved using fdcan, but the reading of the fdcan reference manual promises headaches for designing a driver
Alexandre
I have a little experimental working CAN network, nothing shiny, few F767 drone autopilot with CAN transceiver wired together.
With a saleae logic pro, supporting can 2.0b frame, I can begin to experiment, I'll post here results.
I want to eventually use uavcan to connect sensors to the autopilot, at least sensors that have to be far from the autopilot, and don't need too much bandwidth.
Bandwidth problem can probably be resolved using fdcan, but the reading of the fdcan reference manual promises headaches for designing a driver
Alexandre
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: CAN bus driver - transmission abort
Hi,
I added a new canTryAbortX() function and added an LLD implementation, not tested but it just sets a bit into a register.
This is some kind of record, implemented after 8 years...
Giovanni
I added a new canTryAbortX() function and added an LLD implementation, not tested but it just sets a bit into a register.
This is some kind of record, implemented after 8 years...
Giovanni
Who is online
Users browsing this forum: No registered users and 16 guests