CAN bus data transmission

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CAN bus data transmission

1,387 次查看
monstor
Contributor II

I try to send out two 8bytes data in my firmware by using S12DP512. Once I set the CANXTFLG to 0x01, data would be sent on the CAN bus continuously. It is non stop.

 

Can anyone tell me what's happen to the bus? Below is my source code.

 

// *******************************************

if(CANXTFLG != 7) {

    CANXTARQ = 0x7;

  }

  while(CANXTFLG != 7);

 

 

  b_ptr = (unsigned char*)(&(cdata.c118));

  CANXTBSEL = 0x01;

 

  CANXTXIDR0 = ID118_0;

  CANXTXIDR1 = ID118_1;

  CANXTXIDR2 = ID118_2;

  CANXTXIDR3 = ID118_3;

 

 

  CANXTXDSR0 = *b_ptr++;

  CANXTXDSR2 = *b_ptr++;

  CANXTXDSR1 = *b_ptr++;

  CANXTXDSR3 = *b_ptr++;

  CANXTXDSR5 = *b_ptr++;

  CANXTXDSR4 = *b_ptr++;

  CANXTXDSR6 = *b_ptr++;

  CANXTXDSR7 = *b_ptr++;

 

 

  JEVS_CANXTXDLR   = 8;

  JEVS_CANXTXTBPR  = 1;

  JEVS_CANXTFLG    = 0x01;                      

    

  b_ptr = (unsigned char*)(&(cdata.c109));

  JEVS_CANXTBSEL = 0x02;      

 

 

  JEVS_CANXTXIDR0 = ID119A_0;

  JEVS_CANXTXIDR1 = ID119A_1;

  JEVS_CANXTXIDR2 = ID119A_2;

  JEVS_CANXTXIDR3 = ID119A_3;

 

  CANXTXDSR0 = *b_ptr++;

  CANXTXDSR2 = *b_ptr++;

  CANXTXDSR1 = *b_ptr++;

  CANXTXDSR3 = *b_ptr++;

  CANXTXDSR4 = *b_ptr++;

  CANXTXDSR5 = *b_ptr++;

  CANXTXDSR6 = *b_ptr++;

  CANXTXDSR7 = *b_ptr++;

 

  CANXTXDLR   = 8;

  CANXTXTBPR  = 2;

  CANXTFLG    = 0x02;

 

  CANXTIER_TXEIE1 = 1;

标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

1,094 次查看
GottiLuca
Contributor IV

Hi Mr. Wu,

There is at least another active CAN node on the same CAN BUS line ?

If no other node assert the acknoledgment bit, your device will continuosly re-send the very same frame .

0 项奖励
回复

1,094 次查看
monstor
Contributor II

Dear GottiLuca,

I am using something like CAN emulator on PC side. I am sending a CAN data

frame from S12DP512 to this emulator.

I set the emulator to listen mode only. Should I set the emulator to

normal mode?

I have another question about the buffer configuration. if I only use one

CAN bus for communication, Can I only have 3-levels priority setting

because I only have 3 transmitting buffer, right?

0 项奖励
回复