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.
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!
Hi yu-jung Chuang,
I can see you enabled 8MHz external crystal, but configured MCG works in FEI mode.
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.
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!
-----------------------------------------------------------------------------------------------------------------------
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
According to the CAN1.c, the CAN0_TX(PTB18 pin97) and CAN0_RX(PTB19 pin98) are initialized.
But according to the OSC.png and CAN0.png, the CAN0_TX(PTA12 pin64) and CAN0_RX(PTA13 pin65) are connected to CAN transceiver.
I am afraid you have select the wrong pins in Processor Expert.
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.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------