SPI CAN Error

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

SPI CAN Error

1,246 Views
fabiansonnleitn
Contributor II

Hi,

 

i am using a S912ZVCA with following SPI inti:

 

 

// SPIE=0, SPE=1, SPTIE=1, MSTR=1, SSOE=1

 

SPI0CR1 = 0x72;   

// XFRW=1, MODFEN=1

 

SPI0CR2 = 0x50;

// set to 16bit mode, set MODFEN -> SS aktive low durring transmission

 

SPI0BR = 0x77;

// set baudrate to 12.21 kbit/s

When this gets initialised, the CAN stops working. With out that init CAN is working. I am using CANH,CANL for CAN and  PS2-PS4 for SPI.

 

How do I get both to work at the same time?

 

 

Thanks.

Labels (1)
Tags (3)
0 Kudos
Reply
4 Replies

905 Views
RadekS
NXP Employee
NXP Employee

Hi Fabian,

The default SPI0 routing is to PS0-PS3 pins (please check SPI0 pins again). SPI0 could be optionally routed to PT4-PT7 by MODRR0_SPI0RR bit setting.

msCAN module is routed by default to CAN PHY. msCAN module signal could be optionally routed to PS2,PS3 pins (MODRR0_ M0C0RR[2:0], Conformance test setting, CANPHY is routed to PS0,PS1 pins). In that case, msCAN signals have higher priority than SPI0 therefore, msCAN/CANPHY overtake appropriate pins.

Be aware that MODRR0 register could be written just once in normal mode. So, all configurations have to be part of one command.

For example:

NOK:                                                                    OK:

MODRR0_SPI0RR=1;                                      MODRR0=0x0E;

MODRR0_M0C0RR = 0x06;

Could you please specify whether and how did you configure MODRR0 register?

Are you sure that there isn’t any external connection between SPI0 and CAN signals?


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

905 Views
fabiansonnleitn
Contributor II

Hi RadekS,

thank you for the quick answer.

SPI0 is routed to PS0-PS3 due to the lack of pins PT5 & PT6 on the 48-pin Version I am using.

MODRR0 is set to  MODRR0=0x00;

Could you please tell me the right  MODRR0 Settings to use CAN on CANH/CANL and SPI on PS1(MOSI), PS2(SCK) and PS3(SS).

Thank you very much.

0 Kudos
Reply

905 Views
RadekS
NXP Employee
NXP Employee

Hi Fabian,

Setting MODRR0=0x00; should be OK in this case,

In fact I am not sure what could be a reason for that behavior.

Could you please share here your code and potentially also related part of your schematic?

If not, please create ticket and send it to us for short review.

https://community.freescale.com/docs/DOC-329745

Have a great day,
RadekS

905 Views
fabiansonnleitn
Contributor II

Thank you,

I had a other Problem with an Interrupt, that caused the behavior.

Now it works flawless.

All the best.

0 Kudos
Reply