STM32F4-DISCOVERY Can Filters Problem
Posted: Wed May 21, 2014 12:39 pm
Hi,
I wanted to run the filters on the CAN bus (for double FIFO on can rx).I use both CAN1 and CAN2. Both has to be filtered equally. For example, they only accept a frame with ID 0x05. I tried to use function canSTM32SetFilters but with no result. Frames are not received or only one CAN recives but all frames.
I tried to use this code:
Does anyone know what is wrong in my program?
I wanted to run the filters on the CAN bus (for double FIFO on can rx).I use both CAN1 and CAN2. Both has to be filtered equally. For example, they only accept a frame with ID 0x05. I tried to use function canSTM32SetFilters but with no result. Frames are not received or only one CAN recives but all frames.
I tried to use this code:
Code: Select all
const CANFilter testfilter_struct = {1, 1, 1, 0, 5, 5};
void canDriver_CAN1_CAN2_Configure(const CANConfig *config)
{
chThdYield();
canStop(&CAND2);
canStop(&CAND1);
canSTM32SetFilters(2, 1, &testfilter_struct);
palSetPadMode(GPIOD, 0, PAL_MODE_ALTERNATE(9));
palSetPadMode(GPIOD, 1, PAL_MODE_ALTERNATE(9));
palSetPadMode(GPIOB, 5, PAL_MODE_ALTERNATE(9));
palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(9));
canStart(&CAND1, config);
canStart(&CAND2, config);
}
Does anyone know what is wrong in my program?