S32K144 FLEXCAN

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

S32K144 FLEXCAN

2,518 Views
yashwanthk
Contributor II

Hi,

 

I am working on FLEX CAN in S32K144 EVB. I configured CAN bus to 500 Kbps. I am getting Synchronization error while participating in bus. I configured CAN as per example code given in S32K design studio. I am actually participating in CAN bus with simulator (Other controller) which is configured to 500 kbps. When I communicates with simulator with other controller, I'm getting response from simulator. But when I communicating with S32K144, it is giving synchronization error. I am thinking that S32K144 EVB is not configured to 500 Kbps.

 

I selected 8 MHz crystal oscillator as CAN clock source.

PSEG2 = 3

PSEG1 = 3

RJW = 3

PROPSEG = 6

PRESDIV = 0

 

In ESR1 register SYNCH bit is showing 0 that means CAN is not synchronized with the bus. Actually I'm not using SBC chip as CAN transceiver. I am using other transceiver that is working fine when I tested with other micro controller. 

 

The ESR1 and ECR registers values are

ESR1 = 0x00010112

ECR = 00008100

 

In example interrupts are not enabled but I enabled error interrupts and Bus off interrupts. I am using interrupt method.

 

When I writing 0x7E0 CAN ID in RAM register in 18 th position. It is storing like

Data Byte 0(DB-0) =  0x01

DB1 = 0xE0

DB2 = 0x00

DB3 = 0x00

but I'm thinking that it should store like

DB0 = 0x01

DB1 = 0xF0

DB2 = 0x00

DB3 = 0x00

 

When I write 0x7E8 also it is storing like 0x1EA but i'm thinking that it should store like 0x1FA. Why it is storing like that i'm not understanding. 

 

Please help me. Waiting for your response.

 

 

Regards,

Yashwanth

0 Kudos
1 Reply

1,072 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi Yashwanth,

The CAN bit timing is correct.

The SYNCH=0 indicates the module cannot synchronize to the bus, meaning it does not see bus recessive. Could be caused by transceiver, connection between MCU and transceiver or the MCU pin assignment. For the first 2 you can measure the lines with the scope, if proper signals are seen.

The pin assignment can be tested if the transceiver is unconnected and TX/RX pins are connected. Then you should be able to transmit a message and see it on TX/RX line, it will not be ACKed.

 

For the ID assignment; it looks you write the ID incorrectly. What is the code you are using?

The standard ID = 0x7E0 should be written as

DB0 = 0x1F

DB1 = 0x80

DB2 = 0x00

DB3 = 0x00

 

The standard ID = 0x7E8 then as

DB0 = 0x1F

DB1 = 0xA0

DB2 = 0x00

DB3 = 0x00

BR, Petr

0 Kudos