<?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>S32K中的主题 Union of FLEXCAN_receive and ADC</title>
    <link>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1159144#M8281</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;I have a question. For my project, I need to acquire the voltage values of CAN-High and CAN-Low and at the same time I want to store the Identifier of CAN-message that is received.&lt;BR /&gt;The clock of ADC is FIRCDIV2_CLK, while the clock source of CAN is SOSCDIV2.&lt;BR /&gt;For the reason that I need to have a synchronization between the start of transmission of CAN message and start of sampling of ADC, I wrote a code where if the value of ADC0, that acquires CAN-Low, is lower than a threshold_low and if the value of ADC1, that acquires CAN-High, is higher than threshold_high, so I stored in two Buffers (CAN-High, CAN-Low) the voltage values of two signals. This is due to the fact that, the first bit transmitted is the &lt;STRONG&gt;start of frame&lt;/STRONG&gt;, that in binary term is equal to 0. From theorical point of view, when there is a 0 on the bus, the bit is dominant. One bit dominant, in terms of voltage, is equal to 3.5V on CAN-High and 1.5V on CAN-Low.&lt;BR /&gt;If I want to add the function FlexCAN_receive in order to obtain for each buffers of voltage measurements, the ID of that CAN message, how could I do this? I need to obtain the relationship between ID received and the voltage measurements of two cable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I attach my code so that if someone could help me, I'm very grate.&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Paola&lt;/P&gt;</description>
    <pubDate>Fri, 25 Sep 2020 07:15:29 GMT</pubDate>
    <dc:creator>p_decesare</dc:creator>
    <dc:date>2020-09-25T07:15:29Z</dc:date>
    <item>
      <title>Union of FLEXCAN_receive and ADC</title>
      <link>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1159144#M8281</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I have a question. For my project, I need to acquire the voltage values of CAN-High and CAN-Low and at the same time I want to store the Identifier of CAN-message that is received.&lt;BR /&gt;The clock of ADC is FIRCDIV2_CLK, while the clock source of CAN is SOSCDIV2.&lt;BR /&gt;For the reason that I need to have a synchronization between the start of transmission of CAN message and start of sampling of ADC, I wrote a code where if the value of ADC0, that acquires CAN-Low, is lower than a threshold_low and if the value of ADC1, that acquires CAN-High, is higher than threshold_high, so I stored in two Buffers (CAN-High, CAN-Low) the voltage values of two signals. This is due to the fact that, the first bit transmitted is the &lt;STRONG&gt;start of frame&lt;/STRONG&gt;, that in binary term is equal to 0. From theorical point of view, when there is a 0 on the bus, the bit is dominant. One bit dominant, in terms of voltage, is equal to 3.5V on CAN-High and 1.5V on CAN-Low.&lt;BR /&gt;If I want to add the function FlexCAN_receive in order to obtain for each buffers of voltage measurements, the ID of that CAN message, how could I do this? I need to obtain the relationship between ID received and the voltage measurements of two cable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I attach my code so that if someone could help me, I'm very grate.&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Paola&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 07:15:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1159144#M8281</guid>
      <dc:creator>p_decesare</dc:creator>
      <dc:date>2020-09-25T07:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Union of FLEXCAN_receive and ADC</title>
      <link>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1160671#M8332</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as per your code you do in while loop following&lt;/P&gt;
&lt;P&gt;1. SW start ADC conversion on both ADCs&lt;/P&gt;
&lt;P&gt;2. waits for conversion complete&lt;/P&gt;
&lt;P&gt;3. once first "dominant sample" is detected ADC results are starting to be saved into a buffers and steps 1-3 are repeated until buffers are full&lt;/P&gt;
&lt;P&gt;4. then buffers content is compared with the ID of received frame&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the result you got?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have ADC conversion time about 1us+some SW overhead and CAN bitrate at 50kbps (bit time 20us) you have quite big oversample ratio. It can be OK, but you have to properly interpret the result.&lt;/P&gt;
&lt;P&gt;Also instead of SW start of ADC it should be better to use HW trigger, eg. using PBD and trigger ADC at given rate according to CAN bit time.&lt;/P&gt;
&lt;P&gt;Another note; even if you will sample bus signals properly you will need to remove possible stuff bits which exists on CAN bus and which are added/removed by FlexCAN module.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Petr&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:22:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1160671#M8332</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2020-09-29T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Union of FLEXCAN_receive and ADC</title>
      <link>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1161317#M8354</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;thanks for your help. I use a software trigger for ADC0 and ADC1. They have as clock FIRCDIV2_CLK so that fADC is equal to 48MHz. The CAN bus is configured to receive the CAN message with bit rate equal to 50Ksamples/second. I have a good results because I'm able to store the voltage values and at the end of transmission of message, I read the ID of that message. But I have some doubts about the clock. I don't understand how to comprehend the sampling of ADC. In fact, it's ok that I read the voltage values, but how this voltage measurements are correct?&lt;BR /&gt;So that, for the Manual I know that there is a time conversion formula of ADC. In addition I use the library &amp;lt;elapsed_time.h&amp;gt; for measuring the clock cycle before and after the conversion of ADC. The difference of clock cycle is equal to 963. But this quantity I should divided by the core clock. For the fact that the ADC has as clock FIRCDIV2 and the CAN bus SOSCDIV2, what is the core clock of the board?&lt;BR /&gt;Finally, in your opinion if I use a hardware trigger I don't have this problem?&lt;BR /&gt;&lt;BR /&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Paola&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 12:20:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1161317#M8354</guid>
      <dc:creator>p_decesare</dc:creator>
      <dc:date>2020-09-30T12:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Union of FLEXCAN_receive and ADC</title>
      <link>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1162251#M8376</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as per feedback in your other post...&lt;SPAN&gt;If you use DWT to measure the execution time and the count difference is 963, then the elapsed time is 963 / CORE_CLK (SYS_CLK).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In your code you call&amp;nbsp;NormalRUNmode_80MHz, thus&amp;nbsp;&lt;SPAN&gt;CORE_CLK should be 80MHz.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Elapsed time is then 963/80MHz = 12.04us.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using hardware trigger you can precisely control a time when ADC conversion is started with respect of trigger signal (e.g. external signal edge).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BR, Petr&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 12:37:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Union-of-FLEXCAN-receive-and-ADC/m-p/1162251#M8376</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2020-10-02T12:37:38Z</dc:date>
    </item>
  </channel>
</rss>

