Configuring CAN Filters Through DebugFS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring CAN Filters Through DebugFS

1,534 Views
swhite39
Contributor II

I am using the S32G274A with BSP v38. I see this new version of the BSP has support for configuring CAN filters through debugfs in linux. The examples I have seen are for complex routing scenarios, and I would like to get a simple example of how to configure a CAN Filter to receive all MSG ID's on llce_can5 interface. Could you please provide an example? 

 

Thanks,
Scott

0 Kudos
Reply
4 Replies

1,508 Views
swhite39
Contributor II

Hi Daniel,

I am using a custom board that is basically equivalent to the RDB2.

I have all of my buses physcially routed to a specific interface, and I have no need to do Can2Can routing/bridging. All I would like to do is configure a filter to receive all messages received on llce_can5 bus. My current issue is that I can transmit frames on all of my CAN buses, but I am not receiving any frames. This is on tested hardware, so I know it is not a hardware or setup issue. When trying to receive CAN messages on this board, with an older BSP, I have no issues. With BSP v38, however, I can't receive any messages on any of my CAN buses. I am suspect of the added filtering support causing issues, and packets being dropped at the hardware level, which is why I want to know how to configure a filter to receive all messages on this bus.

It might also be worth noting that I am using LLCE firmware v1.0.7. 

Thanks,

Scott

0 Kudos
Reply

1,498 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Thanks for your feedback. Can you help us share the logs of the configurations you are trying to implement to enable the basic filters? To try and replicate the outcome from our side, if possible.

Also, we see the following information is provided by a different team:

"

for example,
llcecan14 is tag 0xe
llcecan15 is tag 0xf

# llcecan link up
ip link set up llcecan14 type can bitrate 500000 dbitrate 5000000 fd on
ip link set up llcecan15 type can bitrate 500000 dbitrate 5000000 fd on

# disable current basic filter
echo disabled > /sys/kernel/debug/llce_can_core/can_filters/set_status/status
echo 512 > /sys/kernel/debug/llce_can_core/can_filters/set_status/addr
echo 1 > /sys/kernel/debug/llce_can_core/can_filters/set_status/execute
echo 513 > /sys/kernel/debug/llce_can_core/can_filters/set_status/addr
echo 1 > /sys/kernel/debug/llce_can_core/can_filters/set_status/execute

# llcecan14 basic filte

echo 0xFF >  /sys/kernel/debug/llce_can_core/can_filters/add/can_dest
echo 0x7F0 > /sys/kernel/debug/llce_can_core/can_filters/add/can_mask_id
echo mask > /sys/kernel/debug/llce_can_core/can_filters/add/entry
echo 14 > /sys/kernel/debug/llce_can_core/can_filters/add/hw_ctrl
echo 0xe > /sys/kernel/debug/llce_can_core/can_filters/add/tag
echo 0x10 > /sys/kernel/debug/llce_can_core/can_filters/add/mb_count
echo long > /sys/kernel/debug/llce_can_core/can_filters/add/mb_type
echo 0x543 > /sys/kernel/debug/llce_can_core/can_filters/add/msg_id
echo enabled > /sys/kernel/debug/llce_can_core/can_filters/add/status
echo disabled > /sys/kernel/debug/llce_can_core/can_filters/add/opt_auth
echo disabled > /sys/kernel/debug/llce_can_core/can_filters/add/opt_custom
echo disabled > /sys/kernel/debug/llce_can_core/can_filters/add/opt_host
echo disabled > /sys/kernel/debug/llce_can_core/can_filters/add/logging
echo 1 > /sys/kernel/debug/llce_can_core/can_filters/add/execute

candump any,0:0,#FFFFFFFF >log &

# accepted
cansend llcecan15 546#22335566

#discarded
cansend llcecan15 556#22335566

"

Don't know if it is of use for your current application.

Please, let us know.

0 Kudos
Reply

1,462 Views
swhite39
Contributor II

Thank you for the example! The default without any CAN filters does indeed receive all messages, with any ID. We found our problem, and I will share in case it saves someone else.

The ip linux utility brings up a CAN interface just fine, but when trying to bring up the interface with networkd, the interface comes up without any idication of error and has all the stats that it does using the ip utility, but something isn't configured correctly and there is no indication of what is different.

This configuration works.

/etc/systemd/network/10-acan.link:

[Match]
Path=platform-43ff8000.llce:llce_can6
Type=can
 
[Link]
Name=acan

/etc/systemd/network/10-acan.network:
[Match]
Name=acan
 


/usr/lib/systemd/system/acan-bitrate.service:

[Unit]
After=sys-subsystem-net-devices-acan.device
Description=Configure acan with appropriate bittiming
 
[Service]
Type=oneshot
ExecStart=sh -c '/sbin/ip link set acan down && /sbin/ip link set acan up type can tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1'
 
[Install]
WantedBy=sys-subsystem-net-devices-acan.device

This configuration brings up the interface without problem, allows transmission, but not reception of messages.

 /etc/systemd/network/10-acan.link:
[Match]
Path=platform-43ff8000.llce:llce_can6
Type=can
 
[Link]
Name=acan

/etc/systemd/network/10-acan.network:
[Match]
Name=acan
 
[CAN]
TimeQuantaNSec=125
PropagationSegment=6
PhaseBufferSegment1=7
PhaseBufferSegment2=2
SyncJumpWidth=1 

1,509 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Are you using any NXP reference board? If so, which one?

Also, can you help us elaborate more on the following comment:

"I would like to get a simple example of how to configure a CAN Filter to receive all MSG ID's on llce_can5 interface"

Are you looking to create internal routing (through LLCE) for all other interfaces to send information to BCAN_5? Or do you have physically connected BCAN_5 to a CAN message generator and would like for it receive all messages (no internal routing)?

Please, let us know.

0 Kudos
Reply