CAN can't soft reset

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

CAN can't soft reset

1,173 Views
dlysam2716
Contributor III

Hello, This is my first time programming. I've been having some trouble with sending out a CAN message from the MK10FN1M0VLQ12. I used the example code try to send the message to test that can we connect with the device which is I-7565-H1. But it doesn't work. I always stop at this line (as the attachment). I doubt maybe there are my CPU clock has something wrong. But I have no idea how to deal with this problem.

5 Replies

1,003 Views
dlysam2716
Contributor III

Hi! Robin. I already change my PIN on PTA13 and PTA14. But about CPU clock still have problem, I try to adjust many times, then my debug always stop on " while((MCG_S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
}"

I have no idea how to deal with it, can you help me to solve this problem? Thank you!

0 Kudos

1,003 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I can not find the MyCANPtr = CAN1_Init(NULL); in your main.

Please try the attached example.

I have test it on TWR-K60F120M board.

Have you try to check the 50MHz external reference clock by using oscilloscope?

1,003 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi yu-jung Chuang,

I can see you enabled 8MHz external crystal, but configured MCG works in FEI mode.

Cpu.png
Not sure which clock source will you want to select for FlexCAN module. If OSC0ERCLK is selected, please make sure the 8MHz external crystal is working. You can use an oscilloscope to observe the waveform of XTAL0 or EXTAL0.

Clock path CAN_LDD.pngFlexCAN clocking.png
Would you please attach your project and schematic, so that we can check it easier.

 

Best Regards,

Robin

 

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

1,003 Views
dlysam2716
Contributor III

Hi! Robin! Thank you for your respond, but I still can't transmit data. I think my code already finish Initial, it loop in  "while (!DataFrameTxFlg) {
}" code. I attach my schematic and code, hope you can give me some advice or other example code

0 Kudos

1,003 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

According to the CAN1.c, the CAN0_TX(PTB18 pin97) and CAN0_RX(PTB19 pin98) are initialized.

CAN0 PTB18 PTB19 CAN1c.png
But according to the OSC.png and CAN0.png, the CAN0_TX(PTA12 pin64) and CAN0_RX(PTA13 pin65) are connected to CAN transceiver.

CAN0 64 65.png
I am afraid you have select the wrong pins in Processor Expert.

select Rx Tx pins.png

By the way:
I am not sure if you really want to use FEI mode.
Select PEE mode will use external 50MHz reference clock and increase the frequency of Core\Bus.

PEE 50MHz.png

 

Best Regards,

Robin

 

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