MPC5674 CAN init after BAM

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

MPC5674 CAN init after BAM

864 Views
oloooloo
Contributor III

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 (;;) {
    
  }

Tags (1)
0 Kudos
Reply
2 Replies

690 Views
oloooloo
Contributor III

works now, thank You!!

0 Kudos
Reply

690 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can find FlexCAN example here: https://community.nxp.com/message/533052 

BR, Petr