<?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>Kinetis MicrocontrollersのトピックADC cann't enter interrupt</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-cann-t-enter-interrupt/m-p/1093032#M57738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;why i cann't enter interrupt.&amp;nbsp; @&amp;nbsp; SC1A's&amp;nbsp; AIEN=1&amp;amp;coco=1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void ADC0_IRQHandler(void)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; int i=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; i++;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; print(welcomeStr);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;void ADC1_IRQHandler(void)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; int i=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; i++;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; print(welcomeStr);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;/*! &lt;BR /&gt; \brief The main function for the project.&lt;BR /&gt; \details The startup initialization sequence is the following:&lt;BR /&gt; * - startup asm routine&lt;BR /&gt; * - main()&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; /* Enable the floating point unit */&lt;BR /&gt; enableFPU();&lt;/P&gt;&lt;P&gt;/* Write your local variable definition here */&lt;BR /&gt; /* Variables in which we store data from ADC */&lt;BR /&gt; uint16_t adcRawValue;&lt;BR /&gt; uint16_t adcMax;&lt;BR /&gt; float adcValue;&lt;/P&gt;&lt;P&gt;/* Buffer used to store processed data for serial communication */&lt;BR /&gt; char msg[255] =&lt;BR /&gt; { 0, };&lt;/P&gt;&lt;P&gt;/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;BR /&gt;#ifdef PEX_RTOS_INIT&lt;BR /&gt; PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt;#endif&lt;BR /&gt; /*** End of Processor Expert internal initialization. ***/&lt;/P&gt;&lt;P&gt;/* Write your code here */&lt;BR /&gt; /* For example: for(;;) { } */&lt;/P&gt;&lt;P&gt;/* Initialize and configure clocks&lt;BR /&gt; * - see clock manager component for details&lt;BR /&gt; */&lt;BR /&gt; CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,&lt;BR /&gt; g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);&lt;BR /&gt; CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);&lt;/P&gt;&lt;P&gt;/* Initialize pins&lt;BR /&gt; * - See PinSettings component for more info&lt;BR /&gt; */&lt;BR /&gt; PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);&lt;/P&gt;&lt;P&gt;/* Get ADC max value from the resolution */&lt;BR /&gt; if (adConv1_ConvConfig0.resolution == ADC_RESOLUTION_8BIT)&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 8);&lt;BR /&gt; else if (adConv1_ConvConfig0.resolution == ADC_RESOLUTION_10BIT)&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 10);&lt;BR /&gt; else&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 12);&lt;/P&gt;&lt;P&gt;/* Initialize LPUART instance&lt;BR /&gt; * - See LPUART component for configuration details&lt;BR /&gt; * If the initialization failed, break the program&lt;BR /&gt; */&lt;BR /&gt; if (LPUART_DRV_Init(INST_LPUART1, &amp;amp;lpuart1_State, &amp;amp;lpuart1_InitConfig0)&lt;BR /&gt; != STATUS_SUCCESS)&lt;BR /&gt; __asm("bkpt #255");&lt;/P&gt;&lt;P&gt;/* Configure and calibrate the ADC converter&lt;BR /&gt; * - See ADC component for the configuration details&lt;BR /&gt; */&lt;BR /&gt; ADC_DRV_ConfigConverter(INST_ADCONV1, &amp;amp;adConv1_ConvConfig0);&lt;BR /&gt; ADC_DRV_AutoCalibration(INST_ADCONV1);&lt;/P&gt;&lt;P&gt;ADC_DRV_ConfigHwCompare(INST_ADCONV1,&amp;amp;adConv1_HwCompConfig0);//coco自动清0&lt;/P&gt;&lt;P&gt;/* Send a welcome message via LPUART */&lt;BR /&gt; print(welcomeStr);&lt;/P&gt;&lt;P&gt;/* Infinite loop:&lt;BR /&gt; * - Trigger a new conversion&lt;BR /&gt; * - Wait and get the result&lt;BR /&gt; * - Make the value more user friendly&lt;BR /&gt; * - Send the data to LPUART&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt; {&lt;BR /&gt; /* Configure ADC channel and software trigger a conversion */&lt;BR /&gt; ADC_DRV_ConfigChan(INST_ADCONV1, 0U, &amp;amp;adConv1_ChnConfig0);//AIEN set 同时coco set&lt;BR /&gt; /* Wait for the conversion to be done */&lt;BR /&gt; // ADC_DRV_WaitConvDone(INST_ADCONV1);&lt;BR /&gt; /* Store the channel result into a local variable */&lt;BR /&gt; ADC_DRV_GetChanResult(INST_ADCONV1, 0U, &amp;amp;adcRawValue);&lt;/P&gt;&lt;P&gt;/* Process the result to get the value in volts */&lt;BR /&gt; adcValue = ((float) adcRawValue / adcMax) * (ADC_VREFH - ADC_VREFL);&lt;BR /&gt; /* And convert it to string */&lt;BR /&gt; floatToStr(&amp;amp;adcValue, msg, 5);&lt;/P&gt;&lt;P&gt;/* Send the result to the user via LPUART */&lt;BR /&gt; print(headerStr);&lt;BR /&gt; print(msg);&lt;BR /&gt; print(" V\r\n");&lt;/P&gt;&lt;P&gt;/* Do nothing for a number of cycles */&lt;BR /&gt; delayCycles(0x7FFFFF);&lt;BR /&gt; }&lt;BR /&gt; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;BR /&gt; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; #ifdef PEX_RTOS_START&lt;BR /&gt; PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt; #endif&lt;BR /&gt; /*** End of RTOS startup code. ***/&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; for(;;) {&lt;BR /&gt; if(exit_code != 0) {&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return exit_code;&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;BR /&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;P&gt;/* END main */&lt;BR /&gt;/*!&lt;BR /&gt; ** @}&lt;BR /&gt; */&lt;BR /&gt;/*&lt;BR /&gt; ** ###################################################################&lt;BR /&gt; **&lt;BR /&gt; ** This file was created by Processor Expert 10.1 [05.21]&lt;BR /&gt; ** for the Freescale S32K series of microcontrollers.&lt;BR /&gt; **&lt;BR /&gt; ** ###################################################################&lt;BR /&gt; */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 May 2020 16:29:05 GMT</pubDate>
    <dc:creator>wqiang19</dc:creator>
    <dc:date>2020-05-15T16:29:05Z</dc:date>
    <item>
      <title>ADC cann't enter interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-cann-t-enter-interrupt/m-p/1093032#M57738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;why i cann't enter interrupt.&amp;nbsp; @&amp;nbsp; SC1A's&amp;nbsp; AIEN=1&amp;amp;coco=1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;void ADC0_IRQHandler(void)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; int i=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; i++;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; print(welcomeStr);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;void ADC1_IRQHandler(void)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; int i=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; i++;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; print(welcomeStr);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;/*! &lt;BR /&gt; \brief The main function for the project.&lt;BR /&gt; \details The startup initialization sequence is the following:&lt;BR /&gt; * - startup asm routine&lt;BR /&gt; * - main()&lt;BR /&gt; */&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt; /* Enable the floating point unit */&lt;BR /&gt; enableFPU();&lt;/P&gt;&lt;P&gt;/* Write your local variable definition here */&lt;BR /&gt; /* Variables in which we store data from ADC */&lt;BR /&gt; uint16_t adcRawValue;&lt;BR /&gt; uint16_t adcMax;&lt;BR /&gt; float adcValue;&lt;/P&gt;&lt;P&gt;/* Buffer used to store processed data for serial communication */&lt;BR /&gt; char msg[255] =&lt;BR /&gt; { 0, };&lt;/P&gt;&lt;P&gt;/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&lt;BR /&gt;#ifdef PEX_RTOS_INIT&lt;BR /&gt; PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt;#endif&lt;BR /&gt; /*** End of Processor Expert internal initialization. ***/&lt;/P&gt;&lt;P&gt;/* Write your code here */&lt;BR /&gt; /* For example: for(;;) { } */&lt;/P&gt;&lt;P&gt;/* Initialize and configure clocks&lt;BR /&gt; * - see clock manager component for details&lt;BR /&gt; */&lt;BR /&gt; CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,&lt;BR /&gt; g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);&lt;BR /&gt; CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);&lt;/P&gt;&lt;P&gt;/* Initialize pins&lt;BR /&gt; * - See PinSettings component for more info&lt;BR /&gt; */&lt;BR /&gt; PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);&lt;/P&gt;&lt;P&gt;/* Get ADC max value from the resolution */&lt;BR /&gt; if (adConv1_ConvConfig0.resolution == ADC_RESOLUTION_8BIT)&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 8);&lt;BR /&gt; else if (adConv1_ConvConfig0.resolution == ADC_RESOLUTION_10BIT)&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 10);&lt;BR /&gt; else&lt;BR /&gt; adcMax = (uint16_t) (1 &amp;lt;&amp;lt; 12);&lt;/P&gt;&lt;P&gt;/* Initialize LPUART instance&lt;BR /&gt; * - See LPUART component for configuration details&lt;BR /&gt; * If the initialization failed, break the program&lt;BR /&gt; */&lt;BR /&gt; if (LPUART_DRV_Init(INST_LPUART1, &amp;amp;lpuart1_State, &amp;amp;lpuart1_InitConfig0)&lt;BR /&gt; != STATUS_SUCCESS)&lt;BR /&gt; __asm("bkpt #255");&lt;/P&gt;&lt;P&gt;/* Configure and calibrate the ADC converter&lt;BR /&gt; * - See ADC component for the configuration details&lt;BR /&gt; */&lt;BR /&gt; ADC_DRV_ConfigConverter(INST_ADCONV1, &amp;amp;adConv1_ConvConfig0);&lt;BR /&gt; ADC_DRV_AutoCalibration(INST_ADCONV1);&lt;/P&gt;&lt;P&gt;ADC_DRV_ConfigHwCompare(INST_ADCONV1,&amp;amp;adConv1_HwCompConfig0);//coco自动清0&lt;/P&gt;&lt;P&gt;/* Send a welcome message via LPUART */&lt;BR /&gt; print(welcomeStr);&lt;/P&gt;&lt;P&gt;/* Infinite loop:&lt;BR /&gt; * - Trigger a new conversion&lt;BR /&gt; * - Wait and get the result&lt;BR /&gt; * - Make the value more user friendly&lt;BR /&gt; * - Send the data to LPUART&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;while (1)&lt;BR /&gt; {&lt;BR /&gt; /* Configure ADC channel and software trigger a conversion */&lt;BR /&gt; ADC_DRV_ConfigChan(INST_ADCONV1, 0U, &amp;amp;adConv1_ChnConfig0);//AIEN set 同时coco set&lt;BR /&gt; /* Wait for the conversion to be done */&lt;BR /&gt; // ADC_DRV_WaitConvDone(INST_ADCONV1);&lt;BR /&gt; /* Store the channel result into a local variable */&lt;BR /&gt; ADC_DRV_GetChanResult(INST_ADCONV1, 0U, &amp;amp;adcRawValue);&lt;/P&gt;&lt;P&gt;/* Process the result to get the value in volts */&lt;BR /&gt; adcValue = ((float) adcRawValue / adcMax) * (ADC_VREFH - ADC_VREFL);&lt;BR /&gt; /* And convert it to string */&lt;BR /&gt; floatToStr(&amp;amp;adcValue, msg, 5);&lt;/P&gt;&lt;P&gt;/* Send the result to the user via LPUART */&lt;BR /&gt; print(headerStr);&lt;BR /&gt; print(msg);&lt;BR /&gt; print(" V\r\n");&lt;/P&gt;&lt;P&gt;/* Do nothing for a number of cycles */&lt;BR /&gt; delayCycles(0x7FFFFF);&lt;BR /&gt; }&lt;BR /&gt; /*** Don't write any code pass this line, or it will be deleted during code generation. ***/&lt;BR /&gt; /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; #ifdef PEX_RTOS_START&lt;BR /&gt; PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */&lt;BR /&gt; #endif&lt;BR /&gt; /*** End of RTOS startup code. ***/&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/&lt;BR /&gt; for(;;) {&lt;BR /&gt; if(exit_code != 0) {&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return exit_code;&lt;BR /&gt; /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/&lt;BR /&gt;} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/&lt;/P&gt;&lt;P&gt;/* END main */&lt;BR /&gt;/*!&lt;BR /&gt; ** @}&lt;BR /&gt; */&lt;BR /&gt;/*&lt;BR /&gt; ** ###################################################################&lt;BR /&gt; **&lt;BR /&gt; ** This file was created by Processor Expert 10.1 [05.21]&lt;BR /&gt; ** for the Freescale S32K series of microcontrollers.&lt;BR /&gt; **&lt;BR /&gt; ** ###################################################################&lt;BR /&gt; */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2020 16:29:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-cann-t-enter-interrupt/m-p/1093032#M57738</guid>
      <dc:creator>wqiang19</dc:creator>
      <dc:date>2020-05-15T16:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: ADC cann't enter interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-cann-t-enter-interrupt/m-p/1093033#M57739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="359173" data-username="wqiang19@126.com" href="https://community.nxp.com/people/wqiang19@126.com" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 600; text-decoration: none; font-size: 11.9994px;"&gt;wang qiang&lt;/A&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp; Which detail kinetis chip are you are using now?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp; Please tell me your kinetis chip part number, then I can help you to check the details.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp; When you want to enable the ADC interrupt, you need to configure the ADC IRQ, enable it, and enable the global interrupt.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;Wish it helps you!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Kerry&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2020 06:33:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-cann-t-enter-interrupt/m-p/1093033#M57739</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-05-16T06:33:30Z</dc:date>
    </item>
  </channel>
</rss>

