problem to initiate the CANIDAC register on 9S08DZ60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem to initiate the CANIDAC register on 9S08DZ60

1,286 Views
cocheca
Contributor I
Hy,
I´m try to set up the MSCAN configuration but the register CANIDAC don´t change it factory value of 0x00.
Someone know this problem ???
I tried everything I know but any of them has worked. I need 4 acceptance filters of 16-Bits.
For example, in the initialization mode, I try:
"...
// CAN ID Acceptance Mode
// 0-> 2x32, 1-> 4x16, 2-> 8x8, 3-> closed
  CANIDAC = 0x10;

//or .. 
//  CANIDAC_IDAM = 0x01;

//or...
//  CANIDAC_IDAM1  = FALSE; //
//  CANIDAC_IDAM0  = TRUE;
..."

I all cases the register CANIDAC remains with the value 0x00  :smileysad:
I hope someone could help me.
Thanks, Jose.-


Labels (1)
0 Kudos
Reply
1 Reply

431 Views
cocheca
Contributor I
Hy,

EXCUSE ME !!!
I find the problem.


In the INIT routine i haven't setting CANE before the initialization mode start. Then the MC haven´t accept set up the CANIDAC register.

Thanks and Best Regards (sorry for my english).

--------------
Now, this is my the init routine:

#include "target.h"
#include "Commdef.h"
#include "mscanid.h"
#include "mscan.h"

void MSCANInit(void)
{
  UINT8 sj,p;
  UINT8 t_seg1, t_seg2;

  if (! CANCTL0_INITRQ)
    CANCTL0_INITRQ = TRUE;  // Active MSCAN initialization mode
   
  while (!CANCTL1_INITAK)   // Wait until the MSCAN is in initialization mode
    ;
 
  CANCTL1_CANE = TRUE;      // ENABLE MSCAN module
       
  sj    = (SJW-1)<<6;
  p     = (BRP-1);
 
  // Configures SJW and Tq clock Baud Rate Prescaler
  CANBTR0 = (sj | p);
 
  t_seg1 = (TSEG1-1);
  t_seg2 = (TSEG2-1)<<4;
 
  // Configure Time Segment 1 and 2, and one Sample per bit
  CANBTR1 = (t_seg1 | t_seg2);
 
  // CAN ID Acceptance Registers                                 
  CANIDAR0 = CAN_IDF0;
  CANIDAR1 = CAN_IDF1;
  CANIDAR2 = CAN_IDF2;
  CANIDAR3 = CAN_IDF3;
  CANIDAR4 = CAN_IDF4;
  CANIDAR5 = CAN_IDF5;
  CANIDAR6 = CAN_IDF6;
  CANIDAR7 = CAN_IDF7;
 
  // CAN ID Mask Filters - (0 match - 1 ignore)                                 
  CANIDMR0 = CAN_IDMF0;
  CANIDMR1 = CAN_IDMF1;
  CANIDMR2 = CAN_IDMF2;
  CANIDMR3 = CAN_IDMF3;
  CANIDMR4 = CAN_IDMF4;
  CANIDMR5 = CAN_IDMF5;
  CANIDMR6 = CAN_IDMF6;
  CANIDMR7 = CAN_IDMF7;
 
  // CAN ID Acceptance Mode - (CANIDAC_IDAM = 0 2x32, 1 4x16, 2 8x8, 3 closed)                                
#ifdef MASTER
  CANIDAC = CAN_FMODE_MASTER;
#endif
#ifdef SENSOR
  CANIDAC = CAN_FMODE_SENSOR;
#endif
 
  // Enable MSCAN, normal operation and select the bus clock as MSCAN clock source
   CANCTL1 = 0xC0;              // ENABLE MSCAN SIN LOOP BACK
  //  CANCTL1 = 0xE0;              // ENABLE MSCAN CON LOOP BACK
 
  // Active MSCAN Normal Operation
  CANCTL0 = 0x00;
 
  // Wait until the MSCAN operates normally
  while(CANCTL1_INITAK)
    ;
 
  // Wait until MSCAN is synchronized to the CAN bus
  while(! CANCTL0_SYNCH)
    ;

} //MSCANInit
---------------------

0 Kudos
Reply