MPC5604B FlexCAN sample code not working

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MPC5604B FlexCAN sample code not working

1,244件の閲覧回数
vasanthakumarra
Contributor II

Hi,

I am trying to run the FlexCAN sample code mentioned in the following link and its not working.

http://www.nxp.com/assets/documents/data/en/application-notes/AN2865.pdf  (Section 25.3.2)

Below are the setup details:

Processor board : TRK-USB-MPC5604B

Serial board : TWR-SER

IDE : Code warrior 10.6.4

Issue details:

When transmission is done, I am able to see the data in MB01. But, in RecieveMsg() function, its stuck in the while loop.

I am new to this domain and any help will be appreciated..!!

0 件の賞賛
返信
5 返答(返信)

1,036件の閲覧回数
vasanthakumarra
Contributor II

Hi Petr,

Thanks for the reply.

Sorry, I meant to say first message buffer. Yes, in transmit end CAN0 MB0 and receive end CAN1 MB4 is used.

I have two sets of processor and serial boards and CAN ports are connected via jumper wires.

I modified the code to only initialize only the CAN0 in transmit side and CAN1 in receive side. 

And in processor board J6 and J7 pins 1-2 are connected. 

Requesting to confirm the above setup is fine and explain how to connect TX/RX pins in parallel before transceiver.

  

With Regards,

Vasanth.

0 件の賞賛
返信

1,036件の閲覧回数
vasanthakumarra
Contributor II

Hi Petr,

Can you please help me to solve the above mentioned issue.

With Regards, 

Vasanth.

0 件の賞賛
返信

1,036件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi Vasanth,

When using TRK-USB-MPC5604B + TWR-SER + primary elevator just a CAN0 module is connected to the CAN transceiver.

So if you have 2 sets of boards, then you need to modify the code to use only CAN0 module, set one message buffer to TX operation and another MB for RX operation.

Also do not use open drain config for the CANTX pin, the AN2865’s code uses this option, but ion your case it is not needed at all.

BR, Petr

1,036件の閲覧回数
vasanthakumarra
Contributor II

Hi Petr,

Thank you for the information.

And it worked fine after configuring the CAN0 in RX end and not using open drain config..!!

Below are the RX end CAN0 configuration,

CAN_0.MCR.R = 0x5000003F; /* Put in Freeze Mode & enable all 64 msg bufs */
CAN_0.CR.R = 0x04DB0006; /* Configure for 8MHz OSC, 100KHz bit time */

for (i=0; i<64; i++) {
CAN_0.BUF[i].CS.B.CODE = 0; /* Inactivate all message buffers */
}

SIU.PCR[16].R = 0x0604; /* MPC56xxB: Config port B0 as CAN0TX, no open drain */
SIU.PCR[17].R = 0x0100; /* MPC56xxB: Configure port B1 as CAN0RX */

CAN_0.BUF[4].CS.B.IDE = 0; /* MB 4 will look for a standard ID */
CAN_0.BUF[4].ID.B.STD_ID = 555; /* MB 4 will look for ID = 555 */
CAN_0.BUF[4].CS.B.CODE = 4; /* MB 4 set to RX EMPTY */
CAN_0.RXGMASK.R = 0x1FFFFFFF; /* Global acceptance mask */
SIU.PSMI[0].R = 0x00;
CAN_0.MCR.R = 0x0000003F;

Thanks a lot again.

With Regards,

Vasanth.

0 件の賞賛
返信

1,036件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

The demo example from AN2865 does a communication between two FlexCAN modules on the MPC5604B and requires parallel connection of TX/RX pins before transceiver.

In this demo CAN0 MB0 is used to transmit a message and CAN1 MB4 is configured as received buffer. There is no usage of MB1.

Did you do any modification of the code?

How did you do a connection between modules on mentioned boards?

BR, Petr

0 件の賞賛
返信