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
PCAN-Router not running new code
Re: PCAN-Router not running new code
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
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
--------------------------------------------
PEAK-System HW development Team
support@peak-system.com
phone: +49-6151-8173-20
fax: +49-6151-8173-29
--------------------------------------------
-
- Posts: 1
- Joined: Fri 13. Mar 2015, 20:49
Re: PCAN-Router not running new code
What is the maximum number of CAN ids that can be added in harware filtering (CAN_FilterAddId( ))?
Thanks
Shufeng
Thanks
Shufeng
Re: PCAN-Router not running new code
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
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
--------------------------------------------
PEAK-System HW development Team
support@peak-system.com
phone: +49-6151-8173-20
fax: +49-6151-8173-29
--------------------------------------------