<?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>Wireless MCU中的主题 How many CPU cycles does it takes to fully execute u32AHI_DioReadInput();</title>
    <link>https://community.nxp.com/t5/Wireless-MCU/How-many-CPU-cycles-does-it-takes-to-fully-execute-u32AHI/m-p/918982#M6922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;Hello,&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We are developing an Ultrasonic sensor in which we need to read data from a parallel ADC. We are currently using the following code to read data from DIO:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We managed to measure how long it is taking for this instruction to execute using the following code:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;BR /&gt;vAHI_DioSetOutput((1 &amp;lt;&amp;lt; DIO17), 0x0);&lt;BR /&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;BR /&gt;vAHI_DioSetOutput(0x0, (1 &amp;lt;&amp;lt; DIO17));&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We are setting a pin high before the instruction and then resetting the pin back to low.&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;The signal measured on scope for this step is 880nano seconds&lt;BR /&gt;We already measure how long does it takes for the controller to set and reset the pins and it was measured the same way using the same code but without the "PinsReadOut[i] = u32AHI_DioReadInput();" line. The result was that setting the pin high and then resetting it took 660nano seconds. Which leaves us with a total duration of 220nano secons for the port readout&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We already set the clock frequency divider to be 1 so we are running at full speed using "bAHI_SetClockRate(0x3);" in our code.&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;How many cycles does u32AHI_DIOReadInput() would take to fully execute? Is 220nano seconds normal for this type of instruction?&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;Our main goal is to achieve ADC reads at 3MSPS or something around that number for our projects needs, and since the ADC has a throughput capability of up to 10MSPS the only thing that is slowing down the process would be the total time to execute readouts from pins. How could we improve the process of reading data from pins on the module?&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We took some other measurements in which we put the code on a for loop to measure how long does it takes to read 200 times from pins and the result was 88.40micro seconds. 88.4 microseconds / 200 times gives us that each readout in the for loop is taking 442 nano second which is longer than before (we know that there's some logic executing the for loop but it seems to be too much for a module running at 32Mhz. The code for this test is the following:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;vAHI_DioSetOutput((1 &amp;lt;&amp;lt; DIO17), 0x0);&lt;BR /&gt;for (i = 0; i &amp;lt;= 200; i++) {&lt;BR /&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;BR /&gt;}&lt;BR /&gt;vAHI_DioSetOutput(0x0, (1 &amp;lt;&amp;lt; DIO17));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 May 2019 14:20:47 GMT</pubDate>
    <dc:creator>hernanolave</dc:creator>
    <dc:date>2019-05-28T14:20:47Z</dc:date>
    <item>
      <title>How many CPU cycles does it takes to fully execute u32AHI_DioReadInput();</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/How-many-CPU-cycles-does-it-takes-to-fully-execute-u32AHI/m-p/918982#M6922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;Hello,&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We are developing an Ultrasonic sensor in which we need to read data from a parallel ADC. We are currently using the following code to read data from DIO:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We managed to measure how long it is taking for this instruction to execute using the following code:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;BR /&gt;vAHI_DioSetOutput((1 &amp;lt;&amp;lt; DIO17), 0x0);&lt;BR /&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;BR /&gt;vAHI_DioSetOutput(0x0, (1 &amp;lt;&amp;lt; DIO17));&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We are setting a pin high before the instruction and then resetting the pin back to low.&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;The signal measured on scope for this step is 880nano seconds&lt;BR /&gt;We already measure how long does it takes for the controller to set and reset the pins and it was measured the same way using the same code but without the "PinsReadOut[i] = u32AHI_DioReadInput();" line. The result was that setting the pin high and then resetting it took 660nano seconds. Which leaves us with a total duration of 220nano secons for the port readout&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We already set the clock frequency divider to be 1 so we are running at full speed using "bAHI_SetClockRate(0x3);" in our code.&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;How many cycles does u32AHI_DIOReadInput() would take to fully execute? Is 220nano seconds normal for this type of instruction?&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;Our main goal is to achieve ADC reads at 3MSPS or something around that number for our projects needs, and since the ADC has a throughput capability of up to 10MSPS the only thing that is slowing down the process would be the total time to execute readouts from pins. How could we improve the process of reading data from pins on the module?&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;We took some other measurements in which we put the code on a for loop to measure how long does it takes to read 200 times from pins and the result was 88.40micro seconds. 88.4 microseconds / 200 times gives us that each readout in the for loop is taking 442 nano second which is longer than before (we know that there's some logic executing the for loop but it seems to be too much for a module running at 32Mhz. The code for this test is the following:&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; overflow-wrap: break-word; color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;vAHI_DioSetOutput((1 &amp;lt;&amp;lt; DIO17), 0x0);&lt;BR /&gt;for (i = 0; i &amp;lt;= 200; i++) {&lt;BR /&gt;PinsReadOut[i] = u32AHI_DioReadInput();&lt;BR /&gt;}&lt;BR /&gt;vAHI_DioSetOutput(0x0, (1 &amp;lt;&amp;lt; DIO17));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2019 14:20:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/How-many-CPU-cycles-does-it-takes-to-fully-execute-u32AHI/m-p/918982#M6922</guid>
      <dc:creator>hernanolave</dc:creator>
      <dc:date>2019-05-28T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: How many CPU cycles does it takes to fully execute u32AHI_DioReadInput();</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/How-many-CPU-cycles-does-it-takes-to-fully-execute-u32AHI/m-p/918983#M6923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hernan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, the requirement Time cannot be reached by the JN.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 'for' implementation adds more clock cycles.&lt;/P&gt;&lt;P&gt;All peripherals have their registers mapped into the memory space. Access to these registers requires three peripheral clock cycles. Applications have access to the peripherals through the software libraries that present a high-level view of the peripheral's functions through a series of dedicated software routines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 21:25:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/How-many-CPU-cycles-does-it-takes-to-fully-execute-u32AHI/m-p/918983#M6923</guid>
      <dc:creator>mario_castaneda</dc:creator>
      <dc:date>2019-06-11T21:25:26Z</dc:date>
    </item>
  </channel>
</rss>

