<?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: kv58 HSADC Freeze in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1323108#M61212</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For the HSADC module, each hsadc has two adc converters: HSADCxA and HSADCxB, if the HSADCx_CTRL2[SIMULT]=0, the HSADCxA and HSADCxB work independently, each converter requires respective triggering source, per my support experience, only HSADCxB has issue, the HSADCxA does NOT has issue. Pls check if your phenomenon matches what I said.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
    <pubDate>Fri, 13 Aug 2021 08:21:26 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2021-08-13T08:21:26Z</dc:date>
    <item>
      <title>kv58 HSADC Freeze</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1319276#M61164</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there any known issue, related to noise for example, that might lead the KV58F1M0VLQ24 MCU HSADC to freeze?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a custom board designed for ACIM FOC. My development references were:&lt;/P&gt;&lt;P&gt;DRM150 - Sensorless ACIM Field-Oriented Control&lt;/P&gt;&lt;P&gt;Document Number: HVPMC3PHUG&lt;/P&gt;&lt;P&gt;Document Number: HVPKV58F220MUG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At certain conditions, that seems to be related to noise, the HSADC conversion returns the same number from the last valid conversion, and remains on that state until a power reset. The issue happens with both HSADC modules in a random manner, but not necessarily at the same time. Sometimes one module continues to operate and the other freezes. This is very critical for power converter applications since the freeze reading is a valid value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Commments/sugestions would be very welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Rafael&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HSADC configuration:&lt;/P&gt;&lt;P&gt;void init_hsadc(void)&lt;BR /&gt;{&lt;BR /&gt;hsadc_config_t hsadcConfigStruct;&lt;BR /&gt;hsadc_converter_config_t hsadc_converter_config;&lt;BR /&gt;hsadc_sample_config_t hsadcSampleConfigStruct;&lt;BR /&gt;uint16_t sampleMask;&lt;/P&gt;&lt;P&gt;hsadcConfigStruct.dualConverterScanMode = kHSADC_DualConverterWorkAsTriggeredSequential;&lt;BR /&gt;hsadcConfigStruct.enableSimultaneousMode = false;&lt;BR /&gt;hsadcConfigStruct.resolution = kHSADC_Resolution12Bit;&lt;BR /&gt;hsadcConfigStruct.DMATriggerSoruce = kHSADC_DMATriggerSourceAsEndOfScan;&lt;BR /&gt;hsadcConfigStruct.idleWorkMode = kHSADC_IdleKeepNormal;&lt;BR /&gt;hsadcConfigStruct.powerUpDelayCount = 18U;&lt;/P&gt;&lt;P&gt;// Initialize each converter&lt;BR /&gt;HSADC_Init(HSADC0, &amp;amp;hsadcConfigStruct);&lt;BR /&gt;HSADC_Init(HSADC1, &amp;amp;hsadcConfigStruct);&lt;/P&gt;&lt;P&gt;// Configure each converter&lt;BR /&gt;hsadc_converter_config.clockDivisor = 4;&lt;BR /&gt;hsadc_converter_config.samplingTimeCount = 50;&lt;BR /&gt;hsadc_converter_config.powerUpCalibrationModeMask = kHSADC_CalibrationModeSingleEnded;&lt;BR /&gt;HSADC_SetConverterConfig(HSADC0, kHSADC_ConverterA|kHSADC_ConverterB, &amp;amp;hsadc_converter_config);&lt;BR /&gt;HSADC_SetConverterConfig(HSADC1, kHSADC_ConverterA|kHSADC_ConverterB, &amp;amp;hsadc_converter_config);&lt;/P&gt;&lt;P&gt;// Enable the power for each converter.&lt;BR /&gt;HSADC_EnableConverterPower(HSADC0, kHSADC_ConverterA | kHSADC_ConverterB, true);&lt;BR /&gt;while ( (kHSADC_ConverterAPowerDownFlag | kHSADC_ConverterBPowerDownFlag)&lt;BR /&gt;== ((kHSADC_ConverterAPowerDownFlag | kHSADC_ConverterBPowerDownFlag) &amp;amp; HSADC_GetStatusFlags(HSADC0)) )&lt;BR /&gt;{}&lt;BR /&gt;HSADC_EnableConverterPower(HSADC1, kHSADC_ConverterA | kHSADC_ConverterB, true);&lt;BR /&gt;while ( (kHSADC_ConverterAPowerDownFlag | kHSADC_ConverterBPowerDownFlag)&lt;BR /&gt;== ((kHSADC_ConverterAPowerDownFlag | kHSADC_ConverterBPowerDownFlag) &amp;amp; HSADC_GetStatusFlags(HSADC1)) )&lt;BR /&gt;{}&lt;/P&gt;&lt;P&gt;// Conversion channel setting.&lt;BR /&gt;hsadcSampleConfigStruct.channel67MuxNumber = 0;&lt;BR /&gt;hsadcSampleConfigStruct.enableDifferentialPair = false;&lt;BR /&gt;hsadcSampleConfigStruct.zeroCrossingMode = kHSADC_ZeroCorssingDisabled;&lt;BR /&gt;hsadcSampleConfigStruct.highLimitValue = 0x7FF8U;&lt;BR /&gt;hsadcSampleConfigStruct.lowLimitValue = 0U;&lt;BR /&gt;hsadcSampleConfigStruct.offsetValue = 0U;&lt;BR /&gt;hsadcSampleConfigStruct.enableWaitSync = false;&lt;BR /&gt;// HSADC0&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 4U|HSACD_A_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 0U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 2U|HSACD_A_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 1U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 3U|HSACD_A_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 2U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;/*hsadcSampleConfigStruct.channelNumber = 6U|HSACD_A_MASK;&lt;BR /&gt;hsadcSampleConfigStruct.channel67MuxNumber = 0;// Use ch6&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 3U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 7U|HSACD_A_MASK;&lt;BR /&gt;hsadcSampleConfigStruct.channel67MuxNumber = 0;// Use ch7&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 4U, &amp;amp;hsadcSampleConfigStruct);*/&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 5U|HSACD_A_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 3U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 0U|HSACD_A_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC0, 4U, &amp;amp;hsadcSampleConfigStruct);&lt;/P&gt;&lt;P&gt;// HSADC1&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 3U|HSACD_B_MASK;&lt;BR /&gt;HSADC_SetSampleConfig(HSADC1, 0U, &amp;amp;hsadcSampleConfigStruct);&lt;BR /&gt;hsadcSampleConfigStruct.channelNumber = 7U|HSACD_B_MASK;&lt;BR /&gt;hsadcSampleConfigStruct.channel67MuxNumber = 2;// Use ch11&lt;BR /&gt;HSADC_SetSampleConfig(HSADC1, 1U, &amp;amp;hsadcSampleConfigStruct);&lt;/P&gt;&lt;P&gt;// Enable the sample slot.&lt;BR /&gt;sampleMask = HSADC_SAMPLE_MASK(0U)&lt;BR /&gt;| HSADC_SAMPLE_MASK(1U)&lt;BR /&gt;| HSADC_SAMPLE_MASK(2U)&lt;BR /&gt;| HSADC_SAMPLE_MASK(3U)&lt;BR /&gt;| HSADC_SAMPLE_MASK(4U);&lt;BR /&gt;&lt;BR /&gt;HSADC_EnableSample(HSADC0, sampleMask, true);&lt;BR /&gt;HSADC_EnableSample(HSADC0, (uint16_t)(~sampleMask), false);// Disable other sample slot.&lt;BR /&gt;// Enable the sample slot.&lt;BR /&gt;sampleMask = HSADC_SAMPLE_MASK(0U)&lt;BR /&gt;| HSADC_SAMPLE_MASK(1U);&lt;BR /&gt;HSADC_EnableSample(HSADC1, sampleMask, true);&lt;BR /&gt;HSADC_EnableSample(HSADC1, (uint16_t)(~sampleMask), false);// Disable other sample slot.&lt;/P&gt;&lt;P&gt;// Enable synch input to start the ADC conversion&lt;BR /&gt;HSADC_EnableConverterSyncInput(HSADC0, kHSADC_ConverterA | kHSADC_ConverterB, true);&lt;BR /&gt;HSADC_EnableConverterSyncInput(HSADC1, kHSADC_ConverterA | kHSADC_ConverterB, true);&lt;/P&gt;&lt;P&gt;//Select TIMER0_trig source&lt;BR /&gt;SIM-&amp;gt;SOPT7 = (SIM-&amp;gt;SOPT7 &amp;amp; ~SIM_SOPT7_HSADC0AALTTRGEN_MASK) | SIM_SOPT7_HSADC0AALTTRGEN(0x03) | SIM_SOPT7_HSADC0ATRGSEL(0x09);&lt;BR /&gt;SIM-&amp;gt;SOPT7 = (SIM-&amp;gt;SOPT7 &amp;amp; ~SIM_SOPT7_HSADC0BALTTRGEN_MASK) | SIM_SOPT7_HSADC0BALTTRGEN(0x03) | SIM_SOPT7_HSADC0BTRGSEL(0x09);&lt;BR /&gt;SIM-&amp;gt;SOPT7 = (SIM-&amp;gt;SOPT7 &amp;amp; ~SIM_SOPT7_HSADC1AALTTRGEN_MASK) | SIM_SOPT7_HSADC1AALTTRGEN(0x03) | SIM_SOPT7_HSADC1ATRGSEL(0x09);&lt;BR /&gt;SIM-&amp;gt;SOPT7 = (SIM-&amp;gt;SOPT7 &amp;amp; ~SIM_SOPT7_HSADC1BALTTRGEN_MASK) | SIM_SOPT7_HSADC1BALTTRGEN(0x03) | SIM_SOPT7_HSADC1BTRGSEL(0x09);&lt;BR /&gt;SIM-&amp;gt;ADCOPT |= (SIM_ADCOPT_ADC0ALTTRGEN_MASK | SIM_ADCOPT_ADC0TRGSEL(0x09));&lt;/P&gt;&lt;P&gt;// Configure HSADC calibration process&lt;BR /&gt;// Single-ended input calibration&lt;BR /&gt;// Run auto calibration&lt;BR /&gt;HSADC_DoAutoCalibration(HSADC0,kHSADC_ConverterA | kHSADC_ConverterB,kHSADC_CalibrationModeSingleEnded);&lt;BR /&gt;HSADC_DoAutoCalibration(HSADC1,kHSADC_ConverterA | kHSADC_ConverterB,kHSADC_CalibrationModeSingleEnded);&lt;/P&gt;&lt;P&gt;// Wait until calibration is completed&lt;BR /&gt;while (!(HSADC0-&amp;gt;STAT &amp;amp; HSADC_STAT_EOCALIA_MASK)){}&lt;BR /&gt;while (!(HSADC0-&amp;gt;STAT &amp;amp; HSADC_STAT_EOCALIB_MASK)){}&lt;BR /&gt;while (!(HSADC1-&amp;gt;STAT &amp;amp; HSADC_STAT_EOCALIA_MASK)){}&lt;BR /&gt;while (!(HSADC1-&amp;gt;STAT &amp;amp; HSADC_STAT_EOCALIB_MASK)){}&lt;/P&gt;&lt;P&gt;// Enable de converter&lt;BR /&gt;HSADC_EnableConverter(HSADC0, kHSADC_ConverterA | kHSADC_ConverterB,true);&lt;BR /&gt;HSADC_EnableConverter(HSADC1, kHSADC_ConverterA | kHSADC_ConverterB,true);&lt;/P&gt;&lt;P&gt;// Enable &amp;amp; setup interrupt from ADC&lt;BR /&gt;HSADC_EnableInterrupts(HSADC0, kHSADC_ConverterAEndOfScanInterruptEnable);&lt;BR /&gt;HSADC_EnableInterrupts(HSADC1, kHSADC_ConverterAEndOfScanInterruptEnable);&lt;/P&gt;&lt;P&gt;EnableIRQ(HSADC0_CCA_IRQn); // Enable interrupt&lt;BR /&gt;//EnableIRQ(HSADC0_CCB_IRQn); // Enable interrupt&lt;BR /&gt;EnableIRQ(HSADC1_CCA_IRQn); // Enable interrupt&lt;BR /&gt;//EnableIRQ(HSADC1_CCB_IRQn); // Enable interrupt&lt;BR /&gt;NVIC_SetPriority(HSADC0_CCA_IRQn, 1); // Set priority to interrupt&lt;BR /&gt;//NVIC_SetPriority(HSADC0_CCB_IRQn, 1); // Set priority to interrupt&lt;BR /&gt;NVIC_SetPriority(HSADC1_CCA_IRQn, 1); // Set priority to interrupt&lt;BR /&gt;//NVIC_SetPriority(HSADC1_CCB_IRQn, 1); // Set priority to interrupt&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 20:16:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1319276#M61164</guid>
      <dc:creator>rcarvalho</dc:creator>
      <dc:date>2021-08-05T20:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: kv58 HSADC Freeze</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1321697#M61194</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have check the errata of KV58, I have not seen any item which mentions the ADC hardware bugs.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com.cn/docs/en/errata/KINETIS_V_1N86P.pdf" target="_blank"&gt;https://www.nxp.com.cn/docs/en/errata/KINETIS_V_1N86P.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Based on my experience, maybe there is issue if you clear the SIMULT bit in the HSADCx_CTRL2 register.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiangjun_rong_0-1628666024067.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/152582i2E563D1DBB5AF97F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xiangjun_rong_0-1628666024067.png" alt="xiangjun_rong_0-1628666024067.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Pls use the following configuration and have a try.&lt;/P&gt;
&lt;P&gt;hsadcConfigStruct.dualConverterScanMode = kHSADC_DualConverterWorkAsTriggeredSequential;&lt;BR /&gt;hsadcConfigStruct.enableSimultaneousMode = true;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Rong write, set SIMULT bit&lt;BR /&gt;hsadcConfigStruct.resolution = kHSADC_Resolution12Bit;&lt;BR /&gt;hsadcConfigStruct.DMATriggerSoruce = kHSADC_DMATriggerSourceAsEndOfScan;&lt;BR /&gt;hsadcConfigStruct.idleWorkMode = kHSADC_IdleKeepNormal;&lt;BR /&gt;hsadcConfigStruct.powerUpDelayCount = 18U;&lt;/P&gt;
&lt;P&gt;// Initialize each converter&lt;BR /&gt;HSADC_Init(HSADC0, &amp;amp;hsadcConfigStruct);&lt;BR /&gt;HSADC_Init(HSADC1, &amp;amp;hsadcConfigStruct);&lt;/P&gt;
&lt;P&gt;If you change the code and the ADC will sample in parallel mode, so the ADC triggering signal has to change, pls check the code yourself.&lt;/P&gt;
&lt;P&gt;I suggest you separate the motor for safety, and only test the ADC, you can sample the ADC to a big array and check if the phenomenon happens or not.&lt;/P&gt;
&lt;P&gt;I do not guarantee it solve your problem, anyway, pls have a try.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 07:30:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1321697#M61194</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-08-11T07:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: kv58 HSADC Freeze</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1323108#M61212</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For the HSADC module, each hsadc has two adc converters: HSADCxA and HSADCxB, if the HSADCx_CTRL2[SIMULT]=0, the HSADCxA and HSADCxB work independently, each converter requires respective triggering source, per my support experience, only HSADCxB has issue, the HSADCxA does NOT has issue. Pls check if your phenomenon matches what I said.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;XiangJun Rong&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 08:21:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/kv58-HSADC-Freeze/m-p/1323108#M61212</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2021-08-13T08:21:26Z</dc:date>
    </item>
  </channel>
</rss>

