CAN bus driver - transmission abort Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
tinito
Posts: 112
Joined: Tue Jun 07, 2011 10:32 am
Has thanked: 1 time
Been thanked: 1 time

CAN bus driver - transmission abort  Topic is solved

Postby tinito » 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

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: CAN bus driver - transmission abort

Postby Giovanni » Tue Sep 27, 2011 11:22 am

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

User avatar
alex31
Posts: 304
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 28 times
Been thanked: 37 times
Contact:

Re: CAN bus driver - transmission abort

Postby alex31 » Sat Sep 14, 2019 5:19 pm

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

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: CAN bus driver - transmission abort

Postby Giovanni » Sat Sep 14, 2019 5:55 pm

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

User avatar
alex31
Posts: 304
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 28 times
Been thanked: 37 times
Contact:

Re: CAN bus driver - transmission abort

Postby alex31 » Sat Sep 14, 2019 8:52 pm

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

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: CAN bus driver - transmission abort

Postby Giovanni » Sat Oct 05, 2019 9:04 am

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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests