CAN message identifiers are 11-bit values. Your IDs are 0x301 = 0b01100000001, 0x308 = 0b01100001000, and 0x309 = 0b01100001001.

The eight most significant bits are with respect to the 11-bit value; it does not depend on which is the highest bit in your ID.

That is, the eight most significant bits of your IDs are 0x60 = 0b01100000, 0x61 = 0b01100001, and 0x61 = 0b01100001.

AMR selects which bits of ACR are compared. A zero bit in AMR means the corresponding bit in ACR is used, a set bit that the ACR bit is irrelevant.

Therefore, here the register values must be

` ACR = 0x60 or 0x61 `(both work equally well)

` AMR = 0x01`In binary,

` ACR = 0b0110000x `(where

`x` indicates the bit value does not matter)

` AMR = 0b00000001 `This configuration matches all CAN IDs between 0x300 = 0b01100000000 through 0x30F = 0b01100001111.

The above assumes you do use BasicCAN mode, and not the full SJA1000 ACR/AMR capabilities as described in e.g

NXP SJA1000 datasheet (PDF). The NXP SJA1000 has four ACR and four AMR registers, 8 bits each, that can be used as either a single 32-bit acceptance filter, or as a dual 16-bit acceptance filter (see pages 26 and 44-45 of the datasheet).

In your case, the alternative suggestion, using ACR0=0x60, ACR1=0x00, ACR2=0x00, ACR3=0x00, AMR0=0x01, AMR2=0xFF, AMR3=0xFF, implements the single-filter version of the BasicCAN filter above, but in SJA1000 "native" (PeliCAN?) mode.

You could also use the dual filter mode (see page 46 of the datasheet), by setting the AFM bit to zero (acceptance filter mode, MOD.3).

Essentially, the filter is split into two equal parts, and if either filter signals acceptance, the message is accepted.

In your case, the first filter could match 0x301 and 0x309, and the second filter 0x308. That way only these three messages match, and none else.

ACR0=0x60, ACR1=0x20, AMR0=0x01, AMR1=0x1F

ACR2=0x61, ACR3=0x00, AMR2=0x00, AMR3=0x1F

Essentially, the first filter is 0b0110000x001zzzzz, and the second filter is 0b01100001000zzzzz, where x indicates either 0 or 1 is accepted, and z are set according to the datasheet on page 44.

TL;DR:

ACR=0x60 (or 0x61) and AMR=0x01 uses the BasicCAN mode to match message IDs 0x300 through 0x30F, inclusive.

ACR=0x60000000 (or 0x61000000 or 0x61FFFFFF) and AMR=0x01FFFFFF uses the non-BasicCAN single filter mode (set MOD.3 bit!)

to match message IDs 0x300 through 0x30F, inclusive.

ACR=0x60206100 (or 0x61206100 or 0x612F610F) and AMR=0x011F001F uses the non-BasicCAN dual filter mode (clear MOD.3 bit!)

to match message IDs 0x301, 0x308, and 0x309.

(Apologies about the

*numerous* edits. I'm not familiar with this device, took me a bit to get it right.)