lpcware

LPCXpresso 1769 CAN acceptance filter

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by inspire on Wed Jan 02 15:08:40 MST 2013
Hi,

I'm struggling with the CAN acceptence filter mechanism and I just can't make it work correctly.

When I set multiple CAN identifiers that shall pass the acceptence filter only messages with the first one get through. These are the acceptence filter lines:

const int8_t TTCAN_SetACCF_Lookup(const uint32_t * const identifier, const uint16_t identifierCount) {
    uint32_t address = 0;
    uint32_t i, j;
    uint32_t ID_high, ID_low;

    LPC_CANAF->SFF_sa = address;

    // register all identifiers for filtering standard identifier
    j = 0;
    for (i = 0; i < identifierCount * 2; i += 2) {
        ID_low = (i << 29) | (identifier[j] << 16);
        ID_high = ((i + 1) << 13) | (identifier[j] << 0);
        *((volatile uint32_t *) (LPC_CANAF_RAM_BASE + address)) = ID_low | ID_high;
        address += 4;

        j++;
    }

    // disable the other registers
    LPC_CANAF->SFF_GRP_sa = address;
    LPC_CANAF->EFF_sa = address;
    LPC_CANAF->EFF_GRP_sa = address;
    LPC_CANAF->ENDofTable = address;

    // set end of table
    LPC_CANAF->ENDofTable = address;

    return TTCAN_OK;
}
The function is almost copy-pasted from the LPC examples but I want to set two or more specific messages to be received.
With a parameter identifier where
identifier[0] = 0x010 and
identifier[1] = 0x080
only messages with 0x010 are received.

Does anyone see the mistake?

Thanks!
inspire

EDIT: okay problem solved! ID_high had to be (i  << 13) | (identifier[j] << 0);

Outcomes