<?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>LPC MicrocontrollersのトピックEach time a bit operation of some global variable is done before DMA is started, the DMA forward int</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Each-time-a-bit-operation-of-some-global-variable-is-done-before/m-p/2064687#M57935</link>
    <description>&lt;P&gt;I am in the use of LPC4370 microcontroller HSADC+DMA, if each time in the DMA before do some global variable bit operations, each DMA into the interrupt time will be longer, do not know what is the reason, do not have brothers know?&lt;/P&gt;&lt;P&gt;My code：&lt;/P&gt;&lt;P&gt;void DMA_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt;if(LPC_GPDMA-&amp;gt;INTSTAT &amp;amp; (1UL &amp;lt;&amp;lt; 7))&lt;BR /&gt;{&lt;BR /&gt;LPC_GPDMA-&amp;gt;INTTCCLEAR |= (1UL &amp;lt;&amp;lt;7);&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = false;&lt;BR /&gt;ucColletStop = 1;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;BR /&gt;&lt;BR /&gt;Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 13);&lt;BR /&gt;Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 13, false);&lt;BR /&gt;&lt;BR /&gt;HsadcInit();&lt;BR /&gt;DmaInit();&lt;/P&gt;&lt;P&gt;for(uint32_t i = 50000000; i &amp;gt; 0; i--){__asm("nop");}//1s&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = true;&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;if(ucColletStop == 1)&lt;BR /&gt;{&lt;BR /&gt;ucColletStop = 0;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;Chip_HSADC_SetActiveDescriptor(LPC_ADCHS, 1, 0);//Stop HSADC&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;for(uint16_t i = 0; i &amp;lt; 1024; i++)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;ulConvertedData[2*i] = dma_buffer[i]&amp;amp;0xFFF;&lt;BR /&gt;ulConvertedData[2*i+1] = (dma_buffer[i]&amp;gt;&amp;gt;16)&amp;amp;0xFFF;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;Chip_HSADC_SetActiveDescriptor(LPC_ADCHS, 0, 1);//Start HSADC&lt;BR /&gt;CollectStart();//Start DMA&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;BR /&gt;&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = true;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2025 11:54:01 GMT</pubDate>
    <dc:creator>ALOONG</dc:creator>
    <dc:date>2025-03-19T11:54:01Z</dc:date>
    <item>
      <title>Each time a bit operation of some global variable is done before DMA is started, the DMA forward int</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Each-time-a-bit-operation-of-some-global-variable-is-done-before/m-p/2064687#M57935</link>
      <description>&lt;P&gt;I am in the use of LPC4370 microcontroller HSADC+DMA, if each time in the DMA before do some global variable bit operations, each DMA into the interrupt time will be longer, do not know what is the reason, do not have brothers know?&lt;/P&gt;&lt;P&gt;My code：&lt;/P&gt;&lt;P&gt;void DMA_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt;if(LPC_GPDMA-&amp;gt;INTSTAT &amp;amp; (1UL &amp;lt;&amp;lt; 7))&lt;BR /&gt;{&lt;BR /&gt;LPC_GPDMA-&amp;gt;INTTCCLEAR |= (1UL &amp;lt;&amp;lt;7);&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = false;&lt;BR /&gt;ucColletStop = 1;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int main(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;SystemCoreClockUpdate();&lt;BR /&gt;&lt;BR /&gt;Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 13);&lt;BR /&gt;Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, 13, false);&lt;BR /&gt;&lt;BR /&gt;HsadcInit();&lt;BR /&gt;DmaInit();&lt;/P&gt;&lt;P&gt;for(uint32_t i = 50000000; i &amp;gt; 0; i--){__asm("nop");}//1s&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = true;&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;if(ucColletStop == 1)&lt;BR /&gt;{&lt;BR /&gt;ucColletStop = 0;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;Chip_HSADC_SetActiveDescriptor(LPC_ADCHS, 1, 0);//Stop HSADC&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;for(uint16_t i = 0; i &amp;lt; 1024; i++)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;ulConvertedData[2*i] = dma_buffer[i]&amp;amp;0xFFF;&lt;BR /&gt;ulConvertedData[2*i+1] = (dma_buffer[i]&amp;gt;&amp;gt;16)&amp;amp;0xFFF;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for(uint32_t i = 1000000; i &amp;gt; 0; i--){__asm("nop");}//20ms&lt;BR /&gt;&lt;BR /&gt;Chip_HSADC_SetActiveDescriptor(LPC_ADCHS, 0, 1);//Start HSADC&lt;BR /&gt;CollectStart();//Start DMA&lt;BR /&gt;Chip_HSADC_SWTrigger(LPC_ADCHS);&lt;BR /&gt;&lt;BR /&gt;LPC_GPIO_PORT-&amp;gt;B[0][13] = true;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 11:54:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Each-time-a-bit-operation-of-some-global-variable-is-done-before/m-p/2064687#M57935</guid>
      <dc:creator>ALOONG</dc:creator>
      <dc:date>2025-03-19T11:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Each time a bit operation of some global variable is done before DMA is started, the DMA forward</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Each-time-a-bit-operation-of-some-global-variable-is-done-before/m-p/2067189#M57959</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/247144"&gt;@ALOONG&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;a bit operation of some global variable (e.&lt;FONT color="#000000"&gt;g.,&amp;nbsp;&lt;CODE&gt;&lt;FONT color="#000000"&gt;var |= 0x01&lt;/FONT&gt;&lt;/CODE&gt;) m&lt;/FONT&gt;ay trigger multiple ​Read-Modify-Write &amp;nbsp;operations. If the DMA is accessing the same memory region (e.g., the ADC buffer) during this time, the CPU and DMA will contend for the bus, resulting in ​bus arbitration delays.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Check the DMA interrupt priority to ensure it is higher than other non-real-time tasks。&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 10:24:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Each-time-a-bit-operation-of-some-global-variable-is-done-before/m-p/2067189#M57959</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2025-03-24T10:24:09Z</dc:date>
    </item>
  </channel>
</rss>

