<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10 in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670793#M7340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I went through this example many times, changed the code to align and I still get the trap. I can see 48Mhz on the CLKOUT pin and when I read &amp;nbsp; &amp;nbsp; u32_freq_bus = CLOCK_GetFreq(kCLOCK_BusClk); I get 48Mhz. If I enable the OSCERCLK the device traps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a MK20DX256ZVLL10, however I have accounted for MCG_C7 and it is selected to the External Oscillator, and as I said this part works on the MQX system perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the registers when it hits the FLEXCAN_Init, I have disabled the OSCERCLK or the system will not lock. As can be seen I have a lock on the PLL. Can you see anything in error? Someone suggested to use the low power mode for the MCG_C1 &amp;nbsp;HGO0 fields, High Gain, Low Power... is that a reason? What I don't understand is why the system will trap, if it has a valid status lock on the PLL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19543iA3E4E21D4CE2A649/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 May 2017 07:31:10 GMT</pubDate>
    <dc:creator>Cdn_aye</dc:creator>
    <dc:date>2017-05-15T07:31:10Z</dc:date>
    <item>
      <title>Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670788#M7335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a working MQX 4.0.1 system for Tx of CAN0 messages on an in-house board using the MK20DX256VLL10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot get the correct timing for the messages using code from the example for flexcan on the same board, SDK v2.2. We are using the MCG in PEE&amp;nbsp;mode. A 16Mhz xtal, clocked up to 96Mhz. This is working correctly I believe as it passes all the wait on LOCK tests.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We need to Tx on CAN0 at 500,000. When I look at the mcg registers between the mqx setup and sdk setup, they are identical for the key bits. There are some alerts and trim values that are different but the timing portions for dividers and clock selects are identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the data viewed on the logic analyzer is completely wrong for the FreeRTOS &amp;amp; SDK v2.2 code. The values are wrong I believe because the baud rate is not right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use&amp;nbsp;kFLEXCAN_ClkSrcPeri as the clock, the code hangs waiting for exit from low power tests in fsl_clock.c. I have to use &amp;nbsp;kFLEXCAN_ClkSrcOsc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are unable to set the clksrc&amp;nbsp;as per the example,&amp;nbsp;flexcanConfig.clkSrc &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= kFLEXCAN_ClkSrcOsc; This gives a bit time on the first dominant bit of .75usec, in the working code the first bit is 2 usec and the data is totally wrong. Here is the working capture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19278i620BBA8EE324B860/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the Flexcan from my SDK v2.2 code, with the same values for data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19321i2D8CDBEFC069D466/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry about the size; I can't get this web page to display it larger. As can be seen the data is not even close. I don't understand why I am even getting any response given the data is wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can tell me what is wrong it would be very appreciated. I am assuming that flexcanConfig.length = 1, is an 8 byte frame. I can't find any documentation on this field other than the type. Is this correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no clue how to set these clocks based on the documentation. The doc set tells nothing I can find for the definitions for&amp;nbsp;meaning and why a particular field should be one value or another, only programming data types. Can you tell me which clock output the CAN system should use if we are using the PLL in PEE mode, with an external xtal of 16Mhz, clocked to 96Mhz for the core? In MQX we just picked the baudrate and the RTOS driver set the correct dividers. Why do we have to set a baudrate and also a clock source, this seems counter intuitive since not all clock sources will work apparently. Which clock source should I use and how do I select it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We generated the clock code using the Configuration Tool as well as the mux pin assignments. Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char c_tx_buff[] = {0x02, 0x01, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00};&lt;BR /&gt;char static c_rx_buff[8], c_test[8];&lt;/P&gt;&lt;P&gt;flexcan_handle_t flexcanHandle;&lt;BR /&gt;flexcan_mb_transfer_t txXfer;&lt;BR /&gt;flexcan_mb_transfer_t rxXfer;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;flexcan_config_t flexcanConfig;&lt;BR /&gt;flexcan_rx_mb_config_t mbConfig;&lt;BR /&gt; &lt;BR /&gt;flexcan_frame_t rxFrame; &lt;BR /&gt;flexcan_frame_t txFrame;&lt;/P&gt;&lt;P&gt;uint32_t u32_freq_bus, u32_freq_periph, u32_freq_osc_clk; // just for debug validation&lt;/P&gt;&lt;P&gt;FLEXCAN_GetDefaultConfig(&amp;amp;flexcanConfig); &lt;BR /&gt; &lt;BR /&gt; flexcanConfig.baudRate = 500000U;&lt;BR /&gt; flexcanConfig.clkSrc = kFLEXCAN_ClkSrcPeri; // default was kFLEXCAN_ClkOscOsc;&lt;/P&gt;&lt;P&gt;// u32_freq_osc_clk = flexcanConfig.clkSrc;&lt;BR /&gt;// u32_freq_periph = kFLEXCAN_ClkSrcPeri;&lt;BR /&gt;// u32_freq_bus = CLOCK_GetFreq(kCLOCK_BusClk);&lt;BR /&gt; &lt;BR /&gt; FLEXCAN_Init(CAN0,&lt;BR /&gt; &amp;amp;flexcanConfig,&lt;BR /&gt; CLOCK_GetFreq(kCLOCK_BusClk));&lt;/P&gt;&lt;P&gt;FLEXCAN_TransferCreateHandle(CAN0, // Create FlexCAN handle structure and set call back function&lt;BR /&gt; &amp;amp;flexcanHandle,&lt;BR /&gt; flexcan_callback,&lt;BR /&gt; NULL);&lt;/P&gt;&lt;P&gt;FLEXCAN_SetRxMbGlobalMask(CAN0, // Set Rx Masking mechanism&lt;BR /&gt; FLEXCAN_RX_MB_STD_MASK(CAN0_RX_IDENTIFIER, 0, 0));&lt;/P&gt;&lt;P&gt;mbConfig.format = kFLEXCAN_FrameFormatStandard; // Setup Rx Message Buffer&lt;BR /&gt; mbConfig.type = kFLEXCAN_FrameTypeData; // remote frame data type&lt;BR /&gt; mbConfig.id = FLEXCAN_ID_STD(CAN0_RX_IDENTIFIER);&lt;/P&gt;&lt;P&gt;FLEXCAN_SetRxMbConfig(CAN0,&lt;BR /&gt; RX_MESSAGE_BUFFER_NUM,&lt;BR /&gt; &amp;amp;mbConfig,&lt;BR /&gt; true);&lt;/P&gt;&lt;P&gt;FLEXCAN_SetTxMbConfig(CAN0, // Setup Tx Message Buffer&lt;BR /&gt; CAN0_TX_MAILBOX_NUM,&lt;BR /&gt; true);&lt;/P&gt;&lt;P&gt;txFrame.id = FLEXCAN_ID_STD(CAN0_TX_IDENTIFIER);&lt;BR /&gt; txFrame.format = kFLEXCAN_FrameFormatStandard;&lt;BR /&gt; txFrame.type = kFLEXCAN_FrameTypeData;&lt;BR /&gt; txFrame.length = 1;&lt;/P&gt;&lt;P&gt;memcpy(&amp;amp;txFrame.dataWord0, &amp;amp;c_tx_buff[0], 4);&lt;BR /&gt; memcpy(&amp;amp;txFrame.dataWord1, &amp;amp;c_tx_buff[4], 4);&lt;/P&gt;&lt;P&gt;txXfer.frame = &amp;amp;txFrame;&lt;BR /&gt; txXfer.mbIdx = TX_MESSAGE_BUFFER_NUM; // might be 1 of 16 buffers on CAN device, no doc on this&lt;/P&gt;&lt;P&gt;while(1){&lt;BR /&gt; FLEXCAN_TransferSendNonBlocking(CAN0,&lt;BR /&gt; &amp;amp;flexcanHandle,&lt;BR /&gt; &amp;amp;txXfer);&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; uint32_t u32_i = 0, u32_j = 0;&lt;BR /&gt; for(u32_i = 0; u32_i &amp;lt; 0xFFFFFF; u32_i++){&lt;BR /&gt; u32_j++;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 04:29:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670788#M7335</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-08T04:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670789#M7336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Robert,&lt;/P&gt;&lt;P&gt;As you know that Can module can transfer data based on handshaking signal(ACK), so the two Can node should have the same baudrate.&lt;/P&gt;&lt;P&gt;Regarding the can module clock, pls refer to the following figure:&lt;/P&gt;&lt;P&gt;The OSCERCLK is the external clock from Extal0/Xtal0 pins, for you case, it is 16MHz because you connect clock source or crystal with 16MHz to the pins. The Bus clock is the bus clock, for your case, it is 48MHz if you run core/system clock in 96MHz. The CLKSRC bit in CANx_CTRL1 register determines which clock source is selected. From software perspective:&lt;/P&gt;&lt;P&gt;typedef enum _flexcan_clock_source&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kFLEXCAN_ClkSrcOsc = 0x0U,&amp;nbsp; /*!&amp;lt; FlexCAN Protocol Engine clock from Oscillator. */&amp;nbsp; 16MHz external clock&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kFLEXCAN_ClkSrcPeri = 0x1U, /*!&amp;lt; FlexCAN Protocol Engine clock from Peripheral Clock. */ 48MHz bus clock&lt;BR /&gt;} flexcan_clock_source_t;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the baudrate of Can module, as you know that one CAN bit consists of multiple Can Serial Clock, the Can Serial Clock is&amp;nbsp; a divider of the FlexCAN clock.&lt;/P&gt;&lt;P&gt;1)Can Serial Clock frequency=(FlexCAN clock frequency)/Prescaler; &lt;/P&gt;&lt;P&gt;The Prescaler is defined PRESDIV bits in CANx_CTRL1 register, Prescaler=PRESDIV+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)CAN bit rate is Can Serial Clock frequency/(1 + (PSEG1 + 1) + (PSEG2 + 1) + (PROPSEG + 1)])&lt;/P&gt;&lt;P&gt;The PSEG1,PSEG2 and PROPSEG bits are defined in CANx_CTRL1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the code, FLEXCAN_Init(CAN0,&amp;amp;flexcanConfig,CLOCK_GetFreq(kCLOCK_BusClk));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLEXCAN_Init() function will figure out the PRESDIV, PSEG1,PSEG2 and PROPSEG bits based on your required baudrate(flexcanConfig.baudRate = 125000U;) and the FlexCAN clock.&lt;/P&gt;&lt;P&gt;In other words, if you use 16MHz external clock, you can call the functioin as :&lt;/P&gt;&lt;P&gt;FLEXCAN_Init(CAN0,&amp;amp;flexcanConfig,CLOCK_GetFreq(kCLOCK_Osc0ErClk));&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;FLEXCAN_Init(CAN0,&amp;amp;flexcanConfig,16000000); //CLOCK_GetFreq(kCLOCK_Osc0ErClk));&lt;/P&gt;&lt;P&gt;If you use bus clock as FlexCAN clock, pls call&lt;/P&gt;&lt;P&gt;FLEXCAN_Init(CAN0,&amp;amp;flexcanConfig,CLOCK_GetFreq(kCLOCK_BusClk));&lt;/P&gt;&lt;P&gt;It is important that the bardrate must match between two CAN node, for example all the can node should work in 500KHz, BTW, the internal IRC clock is not accurate, that is why we suggest you use external clock or PEE mode which also use external clock source as FlexCAN clock.&lt;/P&gt;&lt;P&gt;pls refer to section 46.4.8.4 Protocol timing in UM of K20.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18093i5D1C71051C4E0BB1/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 08:13:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670789#M7336</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-05-12T08:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670790#M7337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xiangjun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is a great deal of help; a very good explanation. Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will go through and recheck the clocks as you have described and let you know the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 20:45:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670790#M7337</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-12T20:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670791#M7338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xiangjun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I enabled the Flexbus clock to the CKLOUT pin and can measured 48Mhz on the pin (it is now set to the flash clock at 24Mhz, but I checked it when it was the Flexbus clock). I made a mistake in writing above, the XTAL is 8Mhz. So I changed&amp;nbsp;that through the Config tool and it is correct. The OSCERCLK output was not turned on, so I turned that on. However I now get traps to the default handler and cannot find out why. With the &lt;SPAN&gt;OSCERCLK not enabled, I still get the capture I showed above but no traps. I understand&amp;nbsp;from your description and the reference manual that we have to have the&amp;nbsp;OSCERCLK enabled, but as I said we get traps to the default handler and I don't know a way to determine what caused the trap. Do you have a suggestion?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also found that in on the board, the capacitor across the XTAL was&amp;nbsp;18pf. I changed the configuration from 12pf to 18pf to reflect this value. However it makes no difference we still trap in the following code as soon as the PLL is enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;status_t CLOCK_SetPbeMode(mcg_pll_clk_select_t pllcs, mcg_pll_config_t const *config)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;CLOCK_EnablePll0(config);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Change to PLL mode. */&lt;BR /&gt;MCG-&amp;gt;C6 |= MCG_C6_PLLS_MASK;&lt;/P&gt;&lt;P&gt;/* Wait for PLL mode changed. */&lt;BR /&gt;while (!(MCG-&amp;gt;S &amp;amp; MCG_S_PLLST_MASK))&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/////// trap occurs here /////////&lt;/P&gt;&lt;P&gt;return kStatus_Success;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I load the working MQX code with the functional CAN0 Tx, everything works correctly. So the problem is not the hardware. I have uploaded the MEX file in case you can see anything there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17948iB61263825C80F988/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 May 2017 06:02:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670791#M7338</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-14T06:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670792#M7339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Robert,&lt;/P&gt;&lt;P&gt;It seems that you configure the OSCERCLK incorrectly, which leads to the chip trap.&lt;/P&gt;&lt;P&gt;we have an example from FEI to PEE mode, pls refer to the section:&lt;/P&gt;&lt;P&gt;25.5.3.1 Example 1: Moving from FEI to PEE mode: External Crystal =&lt;BR /&gt;4 MHz, MCGOUTCLK frequency = 48 MHz&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 02:36:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670792#M7339</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-05-15T02:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670793#M7340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I went through this example many times, changed the code to align and I still get the trap. I can see 48Mhz on the CLKOUT pin and when I read &amp;nbsp; &amp;nbsp; u32_freq_bus = CLOCK_GetFreq(kCLOCK_BusClk); I get 48Mhz. If I enable the OSCERCLK the device traps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a MK20DX256ZVLL10, however I have accounted for MCG_C7 and it is selected to the External Oscillator, and as I said this part works on the MQX system perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the registers when it hits the FLEXCAN_Init, I have disabled the OSCERCLK or the system will not lock. As can be seen I have a lock on the PLL. Can you see anything in error? Someone suggested to use the low power mode for the MCG_C1 &amp;nbsp;HGO0 fields, High Gain, Low Power... is that a reason? What I don't understand is why the system will trap, if it has a valid status lock on the PLL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19543iA3E4E21D4CE2A649/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 07:31:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670793#M7340</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-15T07:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670794#M7341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It seems that you do not enable the flexcan gated clock, pls check it.&lt;/P&gt;&lt;P&gt;SIM_SCGC3|=0x10;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 09:10:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670794#M7341</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-05-15T09:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670795#M7342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;sorry, for flexcan0, you should set bit4 of&amp;nbsp; SIM_SCGC6. For flexcan1, you should set bit4 of SIM_SCGC3.&lt;/P&gt;&lt;P&gt;SIM_SCGC6|=0x10;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 09:24:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670795#M7342</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-05-15T09:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670796#M7343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Xiangjun&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set the breakpoint before the FLEXCAN_Init executed. I stepped over and the SIM_SCGC &amp;nbsp;CAN0 clock is enabled as below. The problem is OSCERCLK is not enabled, and when I test the&lt;/P&gt;&lt;P&gt;FLEXCAN_TransferSendNonBlocking(CAN0,&lt;BR /&gt; &amp;amp;flexcanHandle,&lt;BR /&gt; &amp;amp;txXfer);&lt;BR /&gt;The data rate is wrong as per the previous screen capture. When I enable OSCERCLK I get the trap to the default unhandled interrupt exception. I need to know how to set up the mcg so I don't get the trap. If I can get the OSCERCLK working maybe the CAN0 transfer will work. Is it because&amp;nbsp;&lt;SPAN&gt;OSCERCLK is enabled at the start of the setup, in clock_config.c? This setup calls&amp;nbsp;code from fsl_clock, not my code. It was auto generated by the config tool&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18105i1A1A834F0EDC1E50/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/18054iBEAF0CE9E4EE0E13/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 03:29:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670796#M7343</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-16T03:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Flexcan CAN0 Tx Fails - SDK v2.2, MK20DX256VLL10</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670797#M7344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;Xiangjun&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;I corrected the trap; I had a sequence of calls wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;But I still cannot Tx the data correctly. All the above was to verify the clock was correct. I am getting a lock on the mcg_s, and the CLKOUT is 48mhz, but the CAN0 timing is still wrong. I will contrast the CAN registers from the older MQX and new SDK and post if I can find out the problem,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;Robert&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 03:32:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Flexcan-CAN0-Tx-Fails-SDK-v2-2-MK20DX256VLL10/m-p/670797#M7344</guid>
      <dc:creator>Cdn_aye</dc:creator>
      <dc:date>2017-05-16T03:32:42Z</dc:date>
    </item>
  </channel>
</rss>

