Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#28238] Missing APIs to drop messages in tx/rx queues in CAN driver without re-configure or restart #2906

Closed
keelung-yang opened this issue Jan 3, 2019 · 5 comments
Assignees

Comments

@keelung-yang
Copy link

In some application scope, we need drop messages in tx/rx queues, such as in in ISO 14229-1, some request messages should be sent to functional ECUs before enter programming session. Since we don't care responses from functional ECUs including self, we need to drop them.

I know I can reveive and drop them manually, but it's better to add can_drop_tx_queue()/can_drop_rx_queue() APIs to driver.

In our application, all messages in red should be dropped before send 10 02 request. And this is just one example. So it's better if droping APIs added into driver.

image

@Alvin1Zhang Alvin1Zhang changed the title Missing APIs to drop messages in tx/rx queues in CAN driver without re-configure or restart [TW#28238] Missing APIs to drop messages in tx/rx queues in CAN driver without re-configure or restart Jan 4, 2019
@jcsbanks
Copy link

jcsbanks commented Jan 4, 2019

Software filtering based on CAN ID (because of shortage of hardware filters on SJA1000) could be a useful addition, but conditional filtering like this I put in higher layers and send only the data to the highest layer for which an ISO 15765 conversation is setup.

@Dazza0 Dazza0 self-assigned this Jan 7, 2019
@keelung-yang
Copy link
Author

@jcsbanks It's not about filtering, but drop messages after filtering.

Now just one question: How to clean CAN tx/rx queue?

@jcsbanks
Copy link

jcsbanks commented Jan 9, 2019

I have a task that processes the Rx queue which copes with a full CAN bus during testing or flashing ECUs, with no hardware filtering. Sorry I thought of it as ISO 15765 conversation filtering in a higher level than the driver. It seems like you want to peek the queues directly. My ISO 15765/14229 payloads end up pointed to by another queue as the variable length of header bytes including for extended addressing made it pointless to try to preserve the raw CAN queue, but can imagine other use cases and will watch with interest.

@Dazza0
Copy link
Collaborator

Dazza0 commented Jan 9, 2019

Clearing the queue entirely will risk clearing messages of other IDs as well. To clear messages of a particular ID within a queue will require going through the whole queue item by item which is no different in terms of efficiency when compared to dropping those messages manually.

I think a run-time reconfigurable software filter would be more appropriate. A software filter would ideally be implemented in the CAN driver's ISR, and will prevent unwanted messages from being put into the queue to begin with.

Referring to the screenshot above, a software filter could first be configured to reject messages of ID 0x7EB, then after sending the request of ID 0x7E3 , the software filter will be reconfigured at run time to being accepting messages of ID 0x7EB.

@keelung-yang
Copy link
Author

@jcsbanks I've implemented ISO 15765 on ESP32, as a tester.

@Dazza0 It's not about application scope but driver's APIs design. I checked this with several colleagues who developed applications on several MCUs with CAN controller, most of MCU SDK supply such APIs to clean tx/rx quene.

@igrr igrr closed this as completed in 099b83a Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants