AnsweredAssumed Answered

MPC5674 CAN init after BAM

Question asked by oloo on Sep 19, 2017
Latest reply on Sep 20, 2017 by oloo

Can someone provide piece of code of CAN init and sending can msg after successfull BAM procedure. I have MPC 5674F chip. Currently i am trying something like that, but doest send anything via CAN:

 

int main(void) {
//disable core watchdog 
  __asm
  {
      li r6,0;
      mtspr 430, r6;
  }
    
  SIU.PCR[83].R = 0x062C;         /* MPC555x: Configure pad as CNTXA, open drain */
  SIU.PCR[84].R = 0x0500;         /* MPC555x: Configure pad as CNRXA */
  CAN_A.MCR.R = 0x0000003F;
 
  CAN_A.BUF[0].CS.B.IDE = 0;           /* Use standard ID length */
  CAN_A.BUF[0].CS.B.RTR = 0;           /* Data frame, not remote Tx request frame */
  CAN_A.BUF[0].CS.B.LENGTH = 8; /* # bytes to transmit w/o null */
  CAN_A.BUF[0].ID.B.STD_ID = 0x555;      /* Transmit ID is 555 */

    CAN_A.BUF[0].DATA.W[0] = *((int*)0x0); //example data taken from beginning of flash area
    CAN_A.BUF[0].DATA.W[1] = *((int*)0x4);      //example data

  CAN_A.BUF[0].CS.B.SRR = 1;           /* Tx frame (not req'd for standard frame)*/
  CAN_A.BUF[0].CS.B.CODE = 0xC;         /* Activate msg. buf. to transmit data frame */
 
  /* Loop forever */
  for (;;) {
    
  }

Outcomes