1

Topic: Can filtering with can gateway

Hello Konstantin,

For a project i am using the Canny 7.2 as a gateway to relay messages between can 0 and can 1. So far everything seems to function fine. But some times it seems that the canny is missing a message that has been used for confirmation if a task is completed. This results in unnecessary execution of the process for finishing this task until the confirmation is received.

With the usage of the can filtering on CAN 0 or CAN 1 we can prevent this, if the  Canny has not been used as a Gateway. If the canny has been in use as a gateway we need to use the special feature: CAN Gateway Filtering Mode.
With the description of the can gateway filtering it tells me the following :
"only relay messages to the second CAN interface of the controller and transmit them to the function diagram (CANx driver) if they are accepted by the gateway selections ".

The can gateway selections as mentioned above are these the values selected with the can gateway selector value registers ?

2

Re: Can filtering with can gateway

You can filter CAN messages using the CAN Driver filters before they are forwarded to the CAN Gateway Driver.
Please see the CAN Gateway Driver operation diagram: https://cannylogic.com/docs/c72duo/cang … on_diagram

The CAN Gateway Driver filtering mode is designed to discard all messages that do not fall into the Selectors. But in this mode, the controller is forced to process each received CAN message from CAN Driver in firmware what affects perfomance. While when using CAN Driver filters, messages that do not pass the filter are blocked by HW, which saves controller resources.

Hope this helps.

3

Re: Can filtering with can gateway

Hi konstantin,

I have added the can filtering modem on the can driver for CAN1 as shown on the attached file. But still it seems that the system is missing the command.

System should operate as follow:
As soon as the message with can id 18FF120D shows a value greater than 1 in the second bit. The can gateway should convert the data in the 6th bit of can ID 18FDD6ED  to 0.

As shown in the can data attached, after message 18FF120D 2nd bit greater than 1. Several times the replacement of the value in the 6th bit of message 18FDDED is delayed. Resulting in a value of greater than 1 in 2nd bit of can message 18FDDED.
The delay and the resulting value is not always there.

Can you tell me if the filtering on can message 18FF120D is set correct ?

Post's attachments

Attachment icon can gateway data.zip 1.82 mb, 20 downloads since 2024-08-13 

4

Re: Can filtering with can gateway

Your diagram contains serious errors. A lot.
It looks like if you fix it, you may not need to use CAN Driver filters at all.
Analyzing all the errors will take a long time and I am not ready for this now.

This is just  a couple:

Your diagram seems to be based on the example from here (Figure #4): https://cannylogic.com/docs/c72duo/cang … processing
Take a look at this example and notice block number #2 in it. Do you clearly understand why the check it performs is necessary? And it must be present on your diagram at least 4 times or more. But you basically threw it out of your diagram. Why?

You can see such block in every CAN RX diagram in the documentation: https://cannylogic.com/docs/c72duo/can/ … ve_example
Do you think this is just a coincidence?

Next, what does block #6 do in conjunction with block #8 and with block #7 in your diagram? In my opinion, its only possible function in your diagram is to increase chaos.

It is important to understand the working principle of the controller, CAN Driver and CAN Gateway driver. Please read the documentation carefully. Every word in documentation matters. Study each block in each example. Divide your task into the smallest subtasks and solve them one at a time. Understand how it works.

5

Re: Can filtering with can gateway

Hello Konstantin,

Thank you for the response, with the comments of your last reply you are right that there were several errors in the diagram.

Last week i have reviewed it and also simplified the diagram, but still experience the issue.
The problem seems that some times the controller is just to slow, and is missing a message.

Attached i have done a can recording of the issue.

page 1
On this page the system functions as designed. 5th bit of can ID 18FDD6ED (value EF) tells me that a button is pressed.
Corresponding to this button is the 5th bit of can ID 18FDD6EB (value 10).
Main goals should be that as soon as bit D1 of can ID 18FF120D is set to a value equal to or greater than 1, the 5th bit of 18FDD6EB should be set to 00.

page 2
On this page the error is shown. 5th bit of can ID 18FDD6ED (value EF) tells me that a button is pressed.
Corresponding to this button is the 5th bit of can ID 18FDD6EB (value 10).
Main goals should be that as soon as bit D1 of can ID 18FF120D is set to a value equal to or greater than 1, the 5th bit of 18FDD6EB should be set to 00. In this example after the value of the 1th bit in canID 18FF120D has set to 1, there is still a value of 10 with canID 18FDD6EB. 



The diagram should operate as following:

With block 9 we are activating the gateway and a value for the replacement section is given.  If can message with canid 18FF120D is detected and data in second bit (D1) is equal or greater than 01 and digital input 8 is low.  Gateway mode is set to active (1), replace mask setting value will be changed. Also a value (1) for the replace value selection block is given.

With block 10 the replace mask is set for selector 0. If the gateway mode gets set to 1 the replace mask will be set for bite D5.

With block 11 the selector 0 replacement value is given. As soon as the replace value selection is 1 the value in bite D5 will be replaced to  00.

With block 12 the can gateway configuration is triggered. As soon as the message with can ID 18FDD6EB is available.

Can you tell me if there is an option to "repair" this issue or do I made a mistake ?

Post's attachments

Attachment icon single replacement.zip 20.49 kb, 15 downloads since 2024-08-29 

6

Re: Can filtering with can gateway

Canny01 wrote:

Thank you for the response, with the comments of your last reply you are right that there were several errors in the diagram.

But I still can see the old problem:

Konstantin, CANNY logic. wrote:

Your diagram seems to be based on the example from here (Figure #4): https://cannylogic.com/docs/c72duo/cang … processing
Take a look at this example and notice block number #2 in it. Do you clearly understand why the check it performs is necessary? And it must be present on your diagram at least 4 times or more. But you basically threw it out of your diagram. Why?

Let's, finally, read the manual together: https://cannylogic.com/docs/c72duo/can/

(please see picture)

So, if you try (and you actually do it) to get, for example, CAN1 RX ID, D1:D0 etc registers in time when CAN1 Data Set Ready Register = 0 you will get not valid data.


Canny01 wrote:

The problem seems that some times the controller is just to slow, and is missing a message.

The controller is lightning fast. You can be sure of that. Just fix the errors. So as I said before:

Konstantin, CANNY logic. wrote:

It is important to understand the working principle of the controller, CAN Driver and CAN Gateway driver. Please read the documentation carefully. Every word in documentation matters. Study each block in each example. Divide your task into the smallest subtasks and solve them one at a time. Understand how it works.

Post's attachments

can_DSR.png, 43.59 kb, 860 x 256
can_DSR.png 43.59 kb, 15 downloads since 2024-08-29