Disable of MSCAN failed after Init on S12DP512

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

Disable of MSCAN failed after Init on S12DP512

1,965 Views
Nj0rd
Contributor I

Hello,

I use a S12DP512 µC with CodeWarrior 3.1

What I liked to do is to disable the MSCAN block during the runtime of my Application.

I used the piece of code below:
    - Request init mode
    - Wait or Acknowledge
    - Disable MSCAN via CANE

void disableMSCAN3(void) {
  /* INITRQ = 1, request to enter initialisation-mode */
  CAN3CTL0_INITRQ = 1;
 
  // wait until initialisation-mode is entered
  while (!CAN3CTL1_INITAK);
 
  /* set MSCAN3 Control 1 Register
   * CANE = 0       -> disable MSCAN3
   *
   * other settings remains!
   */
  CAN3CTL1 = CAN3CTL1 & 0x7F; // or CAN3CTL1_CANE = 0

    #ifdef REPORTING
          if(CAN3CTL1_CANE){TxEventNotification(DISABLE_FAILED);}
    #endif
}

This code works fine when the µC has a connection with the Debug tool. But when the µC looses it connection to the Debug tool (caused by reset button on Application board) CAN3CTL1_CANE remains unchanged.
Why did the device behave differently? Did anyone have a clue?

Labels (1)
0 Kudos
Reply
2 Replies

951 Views
Lundin
Senior Contributor IV
Yes I have a clue. The CANE bit in CANCTL1 is a write-once bit. In normal single chip mode, you can only write to it once. In special single chip mode, ie when the BDM is connected, you can write to it several times.

Read about the CANCTL0 register in the manual for details.
0 Kudos
Reply

951 Views
Nj0rd
Contributor I

Grr nice feature :smileysad:. Who needs such a feature. Thanks for your reply.

Is there a possibilty to put the device into any special mode without usage of BDM ?

0 Kudos
Reply