2

I'm programming a dsPIC30F4011 for CAN. But I have problems with specifying the identifier, the mask and the filter.

I use the Standard identifier and the extendet identifier. In bit 16-23 I'll write the adress of the tranceiver. so, it looks like 00000 00000001 0000000000000001 the spaces are just to show the tranceiver part I set following bits:

// PRIO
C1TX0SIDbits.SID10_6 = 0x0000; 
// SCR
C1TX0SIDbits.SID5_0 = 0x0000;   
C1TX0EIDbits.EID17 = 0x0000;
C1TX0EIDbits.EID16 = 0x0001;
// DEST
C1TX0EIDbits.EID15 = 0x0000;    
C1TX0EIDbits.EID14 = 0x0000;
C1TX0EIDbits.EID13 = 0x0000;
C1TX0EIDbits.EID12 = 0x0000;
C1TX0EIDbits.EID11 = 0x0000;
C1TX0EIDbits.EID10 = 0x0000;
C1TX0EIDbits.EID9 = 0x0000;
C1TX0EIDbits.EID8 = 0x0000;
// CMD
C1TX0DLCbits.EID5_0 = 0x0001;

now I have problems with the mask and the filter I set them

// Mask
C1RXM0SID = 0x00FD;
C1RXM0EIDH = 0x0C00;
C1RXM0EIDL = 0x0000;
// Filter
C1RXF0SID = 0x0000;
C1RXF0EIDH = 0x0400;
C1RXF0EIDL = 0x0000;

Now I don't receive anythin. If I set

C1RXM0SID = 0x000FC;

I receive all messages. I tried it with the transceiver-adress

0b00000000

and

0b00000001

So, did I do anything wrong? (I think so, but I don't know what)

Lundin
  • 195,001
  • 40
  • 254
  • 396
Johannes
  • 31
  • 1

1 Answers1

0

now I have problems with the mask and the filter I set them

// Mask
C1RXM0SID = 0x00FD;
C1RXM0EIDH = 0x0C00;
C1RXM0EIDL = 0x0000;
// Filter
C1RXF0SID = 0x0000;
C1RXF0EIDH = 0x0400;
C1RXF0EIDL = 0x0000;

Now I don't receive anythin. If I set

C1RXM0SID = 0x000FC;

This is because you are setting bit 0 of C1RXM0SID. According to the register description in the reference manual this will match only message types (standard or extended address) as determined by EXIDE bit in filter. Bit 1 of this register is unimplemented. Assuming that the SID mask you want is 0xFD then what you want for this register is

C1RXM0SID = 0x00FD << 2;
bigwillydos
  • 1,321
  • 1
  • 10
  • 15