<?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 800K Baud issue in KinetisK series in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886704#M52465</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Simple old-fashioned code (no point-and-shoot GUI that may or may not work):&lt;BR /&gt;&lt;A href="https://github.com/uTasker/uTasker-Kinetis/blob/master/Hardware/Kinetis/kinetis_CAN.h" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis/blob/master/Hardware/Kinetis/kinetis_CAN.h&lt;/A&gt;&lt;BR /&gt;Line 298: static unsigned long fnOptimalCAN_clock(unsigned short usMode, unsigned long ulSpeed)&lt;BR /&gt;BUS_CLOCK is 40000000&lt;BR /&gt;usMode passed is CAN_PLL_CLOCK&lt;BR /&gt;ulSpeed passed is 800000&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;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Feb 2019 18:45:41 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2019-02-07T18:45:41Z</dc:date>
    <item>
      <title>FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886699#M52460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi - I have a MK22FX512AVLL12 with an 8M Osc and 40M Bus Clock. I have successfully setup the FlexCAN to run at 125K, 250K, 500K and 1M baud rate.&lt;STRONG&gt; I cannot get the 800K baud rate to work.&lt;/STRONG&gt;&amp;nbsp; Can you point me in a direction of a tool to setup the PhaseSeg1,PhaseSeg2 and PropSeg to get that to work?&amp;nbsp; For the other baud rates I use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Default protocol timing configuration, time quantum is 10. */&lt;BR /&gt; config-&amp;gt;timingConfig.phaseSeg1 = 3;//PRESDIV == 11&lt;BR /&gt; config-&amp;gt;timingConfig.phaseSeg2 = 2;//&lt;BR /&gt; config-&amp;gt;timingConfig.propSeg = 1;&lt;BR /&gt; config-&amp;gt;timingConfig.rJumpwidth = 1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 15:10:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886699#M52460</guid>
      <dc:creator>maryellenmclaug</dc:creator>
      <dc:date>2019-02-06T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886700#M52461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you try with the value&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;0x008b0002&lt;/STRONG&gt; in CAN_CTRL ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the uTasker project for your chip and oscillator at 800kHz CAN bus it gives me a pre-scaler of 1, phase buffer segment 2 length of 4, time quanta of 6, which result in this register value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it works you can get the calculation routine from the open source uTasker project (in kinetis_CAN.h), where the following explanation is also given for the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// The best choice of clock input is from the external crystal (lowest jitter), however this may not always enable the best settings to achieve the required speed.&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// The choice of clock source is user-defined but this routine tries to achieve best settings using highest time quanta resolution. &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// There are up to 25 time quanta in a CAN bit time and the bit frequency is equal to the clock frequency divided by the quanta number (8..25 time quanta range)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// There is always a single time quanta at the start of a bit period called the SYNC_SEG which cannot be changed (transitions are expected to occur on the bus during this period)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// The sampling occurs after time segment 1, which is made up of a propagation segment (1..8 time quanta) plus a phase buffer segment 1 (1..8 time quanta),&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// followed by time segment 2, made up of phase buffer segment 2 (2..8 time quanta)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// CAN standard compliant bit segment settings give the following ranges (re-synchronisation jump width of 2 is used since it is compliant with all)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 5..10 when time segment 2 is 2 (min/max time quanta per bit is 8/13)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 4..11 when time segment 2 is 3 (min/max time quanta per bit is 8/15)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 5..12 when time segment 2 is 4 (min/max time quanta per bit is 10/17)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 6..13 when time segment 2 is 5 (min/max time quanta per bit is 12/19)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 7..14 when time segment 2 is 6 (min/max time quanta per bit is 14/21)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 8..15 when time segment 2 is 7 (min/max time quanta per bit is 16/23)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Time segment 1 should be 9..16 when time segment 2 is 8 (min/max time quanta per bit is 18/25)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;//&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;static&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;unsigned&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;long&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;fnOptimalCAN_clock&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;unsigned&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;short&lt;/SPAN&gt; usMode&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;unsigned&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;long&lt;/SPAN&gt; ulSpeed&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Complete Kinetis solutions, training and support:&lt;A href="http://www.utasker.com/kinetis.html" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Kinetis K22:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/FRDM-K22F.html" rel="nofollow noopener noreferrer" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-K22F.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-K22F120M.html" rel="nofollow noopener noreferrer" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-K22F120M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/BLAZE_K22.html" rel="nofollow noopener noreferrer" target="test_blank"&gt;http://www.utasker.com/kinetis/BLAZE_K22.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/tinyK22.html" rel="nofollow noopener noreferrer" target="test_blank"&gt;http://www.utasker.com/kinetis/tinyK22.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 20:30:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886700#M52461</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-02-06T20:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886701#M52462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark - Thank you for your help and your quick reply.&amp;nbsp; I am using the CAN engine clock source as the peripheral clock, which is setup to be 40 MHz.&amp;nbsp; So that would make CAN_CTRL1 = 0x008b2002 and that doesn't give me 800K. I don't know how to use the uTasker project.&amp;nbsp; Can you retry with my peripheral clock? Thanks for the help.&amp;nbsp; What is the uTasker project?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 13:30:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886701#M52462</guid>
      <dc:creator>maryellenmclaug</dc:creator>
      <dc:date>2019-02-07T13:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886702#M52463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are clocking from the 40MHz bus clock (note that generally the oscillator is recommended for less jitter) the values for 800kHz CAN bus operation are&lt;BR /&gt;- pre-scaler of 2&lt;BR /&gt;- phase buffer segment 2 length of 8&lt;BR /&gt;- time quanta of 25&lt;BR /&gt;which results in the register value of &lt;STRONG&gt;0x01bf2007&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uTasker CAN can be seen here:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=Ha8cv_XEvco&amp;amp;t=4s" target="test_blank"&gt;https://www.youtube.com/watch?v=Ha8cv_XEvco&amp;amp;t=4s&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The project allows applications to run on almost all Kinetis parts without needing to port between them (as well as various other processor families), with chip simulation to simplify and accelerate all aspects of development, test and debugging. It is available in free open source form [with all the basics like serial loaders, HW libraries, USB classes, TCP/IP stack and utFAT] and also in professionally supported form with addition integrated options such as security, FreeRTOS integration, Modbus and CANopen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Training and development support is available for new Kinetis users and for problem solving in existing projects.&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;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 16:55:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886702#M52463</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-02-07T16:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886703#M52464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark - This works great. Thank you so much. Can you tell me how to calculate these values? I don't see that anywhere in the video you pointed me to.&amp;nbsp; Can you provide me with the calculations done to get the PropSeg, PhaseSeg1, PhaseSeg2 and the JumpWidth. I was using this&amp;nbsp;document from Freescale that doesn't give results like yours.&amp;nbsp;&lt;A href="/legacyfs/online/264380_FlexCAN bit timing.pdf"&gt;FlexCAN Bit Timing Calculation&lt;/A&gt;.&amp;nbsp; Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 17:35:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886703#M52464</guid>
      <dc:creator>maryellenmclaug</dc:creator>
      <dc:date>2019-02-07T17:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886704#M52465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Simple old-fashioned code (no point-and-shoot GUI that may or may not work):&lt;BR /&gt;&lt;A href="https://github.com/uTasker/uTasker-Kinetis/blob/master/Hardware/Kinetis/kinetis_CAN.h" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis/blob/master/Hardware/Kinetis/kinetis_CAN.h&lt;/A&gt;&lt;BR /&gt;Line 298: static unsigned long fnOptimalCAN_clock(unsigned short usMode, unsigned long ulSpeed)&lt;BR /&gt;BUS_CLOCK is 40000000&lt;BR /&gt;usMode passed is CAN_PLL_CLOCK&lt;BR /&gt;ulSpeed passed is 800000&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;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 18:45:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886704#M52465</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-02-07T18:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCAN 800K Baud issue in KinetisK series</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886705#M52466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try to use the &lt;A href="http://www.bittiming.can-wiki.info/"&gt;CAN Bit Time Calculation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="CAN Bit Time Calculation bus40MHz baudrate800kbit.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/72032i84225BD0868FC6B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="CAN Bit Time Calculation bus40MHz baudrate800kbit.png" alt="CAN Bit Time Calculation bus40MHz baudrate800kbit.png" /&gt;&lt;/span&gt;&lt;BR /&gt;For example 800K baud rate:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Init FlexCAN module. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flexcanConfig.baudRate = 800000U;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flexcanConfig.timingConfig.phaseSeg1 = 7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flexcanConfig.timingConfig.phaseSeg2 = 7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flexcanConfig.timingConfig.propSeg = 7;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flexcanConfig.timingConfig.rJumpwidth = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2019 07:37:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FlexCAN-800K-Baud-issue-in-KinetisK-series/m-p/886705#M52466</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2019-02-13T07:37:59Z</dc:date>
    </item>
  </channel>
</rss>

