How can I change the acceptance filter with CAN_FilterAdd

Universal Programmable Converter for CAN FD and CAN
Locked
Hi-Tanaka
Posts: 2
Joined: Tue 21. Jan 2020, 10:18

How can I change the acceptance filter with CAN_FilterAdd

Post by Hi-Tanaka » Tue 17. Mar 2020, 11:03

I am planning to use the Router FD as a ID-selectable Router that performs to receive and transfer
the CAN message between CAN1/BUS1 and CAN2/BUS2 excluding the ID specified via RS-232 interface.
I am using, PCAN-Router FD IPEH-002214 #05185 with PCAN-USB FDx2, and PCAN-Explorer6,PCAN-Flash.

I could specify the ID for the masking via RS-232. *it is achieved by modifying CAN_TO_SER_ASCII example.
When the router receives the code via RS-232, the router program calls CAN_FilterAdd API to change the Acceptance
filter for masking the specified code.

It works fine, the first calling CAN_FilterAdd after PowerON reset.
But, it doesn’t work, the second or later calling during the PowerON.
It seems the range of acceptance filter is overwritten.

for example:
- After PowerON reset, the router set up the filter to exclude 0x650. *hard coding

in the CAN_UserIniti (void)

Code: Select all

	// Init CAN1
	CAN_Initialize ( CAN_BUS1, &Timing_CANx[CAN_BUS1]);
	// set acceptance area excluding 0x650
	CAN_FilterAdd ( CAN_BUS1, CAN_MSGTYPE_STANDARD, 0x000, 0x64F);
	CAN_FilterAdd ( CAN_BUS1, CAN_MSGTYPE_STANDARD, 0x651, 0x7FF);
	// init CAN2
	CAN_Initialize ( CAN_BUS2, &Timing_CANx[CAN_BUS2]);
	// receive all 11 bit standard CAN-IDs
	CAN_FilterAdd ( CAN_BUS2, CAN_MSGTYPE_STANDARD, 0x000, 0x7FF);
- Then I send the code:0x611(11bit) to change the masked code 0x650 to 0x611.
- After I send the message(0x000~0x7FF) to CAN1, the router could routing the message to CAN2 excluding 0x650
- Then, I send the 0x611 via RS-232 to change the masked code 0x650 to 0x611.

Code: Select all

		 :
	CAN_UnInitialize( CAN_BUS1 )	* I think that it does not need to call just first calling after PowerON reset. 
	CAN_Initialize( CAN_BUS1, &Timing_CANx[CAN_BUS1] )
	CAN_FilterAdd( CANBUS_1, CAN_MSGTYPE_STANDARD, 0x000, 0x610 )
	CAN_FilterAdd( CANBUS_1, CAN_MSGTYPE_STANDARD, 0x612, 0x7FF )
		 :
Then the router forwards all CAN messages CAN1 to CAN2....
*I expected the filter was cleared when I call CAN_UnInitialize or CAN_Initialize API, and change the masked code 0x650 to 0x611
*above filter change calling sequence is performed in the big while-loop like as in ROUTING example.
*in case of exchange 0x611:hard coding, 0x650 specify via RS-232, the router could mask the 0x610 until the filter change like above,
but after call CAN_FilterAdd, the router forward all CAN messages.

Is there any way that I can change the filter without PowerON reset?
Please tell me if there is any solution to this matter.
Thanks.
Last edited by M.Gerber on Tue 17. Mar 2020, 13:11, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
P.Steil
Hardware Development
Hardware Development
Posts: 32
Joined: Fri 14. Jan 2011, 10:27

Re: How can I change the acceptance filter with CAN_FilterAdd

Post by P.Steil » Tue 17. Mar 2020, 14:59

Hello,

the filter can only be expanded in this version of the LIB. Please contact us at support@peak-system.com .
Actually we are working on next LIB version, so you can get a v2 beta or an intermediate version of v1.

Regards
--------------------------------------------
PEAK-System HW development Team
support@peak-system.com
phone: +49-6151-8173-20
fax: +49-6151-8173-29
--------------------------------------------

Hi-Tanaka
Posts: 2
Joined: Tue 21. Jan 2020, 10:18

Re: How can I change the acceptance filter with CAN_FilterAdd

Post by Hi-Tanaka » Thu 19. Mar 2020, 02:17

Hello Steil-san,

Thank you for your quick reply and suggestion! :)
I will contact your support soon.

Best Regards,

Hideto Tanaka

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: How can I change the acceptance filter with CAN_FilterAdd

Post by PEAK-Support » Fri 20. Mar 2020, 16:11

- lib was send - thread is closed -
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Locked