PCAN-Router not running new code

Universal CAN Converter
Post Reply
murpia
Posts: 1
Joined: Wed 21. Sep 2011, 11:56

PCAN-Router not running new code

Post by murpia » Wed 21. Sep 2011, 12:49

Hi,

We wish to use a PCAN-Router to translate 1Mbps CAN to 500kbps CAN, with message filtering, to produce a 'gateway'.

Following all instructions in the manual I am able to build new software with the new bit rates and message filtering in software.

Is example code available for using the hardware message filtering of the PCAN-Router?

Thanks, Ian

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

Re: PCAN-Router not running new code

Post by P.Steil » Wed 21. Sep 2011, 14:01

Hello Ian,

in can_init.c ( near line 91) you can find code like:

CAN_InitFilters();
CAN_SetFilterMode ( AF_ON_BYPASS_ON);


This code will disable (bypass) the filter. To get hardware filtering for CAN-IDs you can use
code like this:


CAN_InitFilters();

// filter ID 0x500 explicit
CAN_FilterAddId ( CHANNEL_0, FILTER_11BIT_ID, 0x500);

// filter ID 0x600 - 0x605 as range
CAN_FilterAddId ( CHANNEL_0, FILTER_11BIT_ID_RANGE, 0x600, 0x605);

// filter ID 0x4875 explicit
CAN_FilterAddId ( CHANNEL_1, FILTER_29BIT_ID, 0x4875);

// activate Filter
CAN_SetFilterMode ( AF_ON);



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

shufenghan
Posts: 1
Joined: Fri 13. Mar 2015, 20:49

Re: PCAN-Router not running new code

Post by shufenghan » Fri 13. Mar 2015, 20:56

What is the maximum number of CAN ids that can be added in harware filtering (CAN_FilterAddId( ))?

Thanks
Shufeng

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

Re: PCAN-Router not running new code

Post by P.Steil » Mon 16. Mar 2015, 14:44

Hello,

you can add a maximum of 2048 bytes of Filter Tables. The sizes are as follows:

- standard single -> 2 byte
- standard range -> 4 byte
- extended single -> 4 byte
- extended range -> 8 byte

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

Post Reply