fix CAN filters
This commit is contained in:
parent
2b91ec2df0
commit
3f1e4c84f0
@ -109,26 +109,39 @@ void ECAN_Initialize(void)
|
|||||||
........................................................
|
........................................................
|
||||||
........................................................
|
........................................................
|
||||||
*/
|
*/
|
||||||
// mask 0 is 11 bits for filter 0 and 1
|
|
||||||
|
/*
|
||||||
|
* Mask 0 is 11 bits for filters 0 and 1 only
|
||||||
|
* filter set for 3 recipient bits
|
||||||
|
* Mask 1 is copy of mask 0 but for other filters
|
||||||
|
*/
|
||||||
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXM0EIDH, &RXM0EIDL, &RXM0SIDH, &RXM0SIDL);
|
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXM0EIDH, &RXM0EIDL, &RXM0SIDH, &RXM0SIDL);
|
||||||
// filter 0 and 1 is broadcast message
|
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXM1EIDH, &RXM1EIDL, &RXM1SIDH, &RXM1SIDL);
|
||||||
|
|
||||||
|
// filter 0 is broadcast message
|
||||||
convertCANid2Reg(0x000, dSTANDARD_CAN_MSG_ID_2_0B, &RXF0EIDH, &RXF0EIDL, &RXF0SIDH, &RXF0SIDL);
|
convertCANid2Reg(0x000, dSTANDARD_CAN_MSG_ID_2_0B, &RXF0EIDH, &RXF0EIDL, &RXF0SIDH, &RXF0SIDL);
|
||||||
|
|
||||||
|
// filter 1 is message for controller
|
||||||
convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL);
|
convertCANid2Reg(0x010, dSTANDARD_CAN_MSG_ID_2_0B, &RXF1EIDH, &RXF1EIDL, &RXF1SIDH, &RXF1SIDL);
|
||||||
|
|
||||||
|
// filter 2 is message for recipient n°7, not yet defined
|
||||||
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL);
|
convertCANid2Reg(0x070, dSTANDARD_CAN_MSG_ID_2_0B, &RXF2EIDH, &RXF2EIDL, &RXF2SIDH, &RXF2SIDL);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
Enable Filters
|
* ENABLE FILTERS
|
||||||
|
*
|
||||||
|
* Filter 0 set on mask 0
|
||||||
|
* Filter 1 set on mask 0
|
||||||
|
* Filter 2 set on mask 1
|
||||||
*/
|
*/
|
||||||
RXFCON0 = 0x01; // Filter 0 is activated
|
RXFCON0 = 0x07;
|
||||||
RXFCON1 = 0x00;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assign Filters to Masks
|
Assign Filters to Masks
|
||||||
*/
|
*/
|
||||||
MSEL0 = 0x00; // filter 0 is assigned to mask 0
|
// Filter 0 & 1 assigned to mask 0 and filter 2 assigned to mask 1
|
||||||
MSEL1 = 0x00;
|
MSEL0 = 0x10;
|
||||||
MSEL2 = 0x00;
|
|
||||||
MSEL3 = 0x00;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize CAN Timings
|
Initialize CAN Timings
|
||||||
|
@ -85,7 +85,7 @@ bool CAN_processEvent(Event* ev) {
|
|||||||
// Send a message
|
// Send a message
|
||||||
if (ev->id == evCAsend) {
|
if (ev->id == evCAsend) {
|
||||||
uCAN_MSG canMsg;
|
uCAN_MSG canMsg;
|
||||||
canMsg.frame.idType = 0; // I don't understand what is it
|
canMsg.frame.idType = dSTANDARD_CAN_MSG_ID_2_0B; // standard
|
||||||
canMsg.frame.dlc = 4; // 4 bytes to send
|
canMsg.frame.dlc = 4; // 4 bytes to send
|
||||||
canMsg.frame.rtr = 0; // no remote frame
|
canMsg.frame.rtr = 0; // no remote frame
|
||||||
canMsg.frame.data3 = (uint8_t) data;
|
canMsg.frame.data3 = (uint8_t) data;
|
||||||
|
@ -210,6 +210,7 @@
|
|||||||
<property key="debugoptions.debug-startup" value="Use system settings"/>
|
<property key="debugoptions.debug-startup" value="Use system settings"/>
|
||||||
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
|
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
|
||||||
<property key="debugoptions.useswbreakpoints" value="false"/>
|
<property key="debugoptions.useswbreakpoints" value="false"/>
|
||||||
|
<property key="firmware.download.all" value="false"/>
|
||||||
<property key="hwtoolclock.frcindebug" value="false"/>
|
<property key="hwtoolclock.frcindebug" value="false"/>
|
||||||
<property key="memories.aux" value="false"/>
|
<property key="memories.aux" value="false"/>
|
||||||
<property key="memories.bootflash" value="true"/>
|
<property key="memories.bootflash" value="true"/>
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user