<?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のトピックRe: KL27Z switching between ADC channels in polled mode - timing problem?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659808#M40469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, all&lt;/P&gt;&lt;P&gt;As I said I think the code is okay. The issue cames from the external hardware signal impedance, I see that you test the signal from PTB0/PTB1 pins, if you use ADC to sample analog signal,&amp;nbsp; the analog signal should have low impedance, if the analog signal have high impedance, the drifting, inaccurate sample... will happens.&lt;/P&gt;&lt;P&gt;Pls have the following tests:&lt;/P&gt;&lt;P&gt;1)connect the GND or VDD to the PTB0 or PTB1, what is the result? I think the drifting will disappear.&lt;/P&gt;&lt;P&gt;2)the analog signal is from sensor, pls tell us the ananlog signal output impedance. If it has high impedance, i suggest you connect an analog buffer, and connect the PTB0 or PTB1 to the analog buffer output. The analog buffer consists of an OP AMP, for example OP07/27/37, connect the inverting pin of AMP to the output pin of AMP, connect the sensor output to non-inverting pin, it is okay.&lt;/P&gt;&lt;P&gt;Pls have a try&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2017 06:12:25 GMT</pubDate>
    <dc:creator>xiangjun_rong</dc:creator>
    <dc:date>2017-02-09T06:12:25Z</dc:date>
    <item>
      <title>KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659804#M40465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I extended the sample application from&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;SDK_2.1_FRDM-KL27Z/boards/frdmkl27z/driver_examples/adc16/polling&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;to read multiple ADC channels. &amp;nbsp;What I observe is that the first channel to be polled gets a reasonable value, the other channels polled after that get a full-scale reading (0xffff). &amp;nbsp;After inserting a delay between readings, I get reasonable values on all the channels.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question: is there some flag that I must honor, or some known delay I must insert, when switching between input channels on the ADC?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code in question:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;#include "fsl_debug_console.h"
#include "board.h"
#include "fsl_adc16.h"

#include "pin_mux.h"
#include "clock_config.h"

#define DEMO_ADC16_BASE ADC0
#define DEMO_ADC16_CHANNEL_GROUP 0U
#define CH08_ADC16_USER_CHANNEL 8U&amp;nbsp; /* PTB0, A0-ADC0_SE8 */
#define CH09_ADC16_USER_CHANNEL 9U&amp;nbsp; /* PTB1, A0-ADC0_SE9 */
#define CH11_ADC16_USER_CHANNEL 11U /* PTC2, A0-ADC0_SE11 */

void delay(void) {
 for (uint32_t i = 0; i &amp;lt; 400000; i++) {
 __NOP();
 }
}

/**
 * Initialize a channel_config struct: no interrupts, no differential conversion.
 */
void initChannelConfig(adc16_channel_config_t *config, int channelNumber) {
&amp;nbsp; config-&amp;gt;channelNumber = channelNumber;
&amp;nbsp; config-&amp;gt;enableInterruptOnConversionCompleted = false;
#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) &amp;amp;&amp;amp; FSL_FEATURE_ADC16_HAS_DIFF_MODE
&amp;nbsp; config-&amp;gt;enableDifferentialConversion = false;
#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */
}

&amp;nbsp;/*
 When in software trigger mode, each conversion would be launched once calling the 
 "ADC16_ChannelConfigure()" function, which works like writing a conversion command 
 and executing it. For another channel's conversion, just to change the "channelNumber" 
 field in channel's configuration structure, and call "ADC16_ChannelConfigure() again.
 */

/**
 * Read a sample from the ADC on the provided channel using polling.
 */
uint32_t pollChannel(adc16_channel_config_t *config) {
&amp;nbsp; ADC16_SetChannelConfig(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP, config);
&amp;nbsp; while (0U == (kADC16_ChannelConversionDoneFlag &amp;amp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC16_GetChannelStatusFlags(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP))) {
 }
 return ADC16_GetChannelConversionValue(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP);
}

int main(void) {
&amp;nbsp; adc16_config_t adc16ConfigStruct;
&amp;nbsp; adc16_channel_config_t ch08ChannelConfig;
&amp;nbsp; adc16_channel_config_t ch09ChannelConfig;
&amp;nbsp; adc16_channel_config_t ch11ChannelConfig;

&amp;nbsp; BOARD_InitPins();
&amp;nbsp; BOARD_BootClockRUN();
&amp;nbsp; BOARD_InitDebugConsole();

&amp;nbsp; PRINTF("\r\nADC16 polling example.\r\n");
&amp;nbsp; ADC16_GetDefaultConfig(&amp;amp;adc16ConfigStruct);
&amp;nbsp; adc16ConfigStruct.resolution=kADC16_ResolutionSE16Bit;
&amp;nbsp; adc16ConfigStruct.enableLowPower = true;
&amp;nbsp; adc16ConfigStruct.longSampleMode = kADC16_LongSampleCycle24;
&amp;nbsp; ADC16_Init(DEMO_ADC16_BASE, &amp;amp;adc16ConfigStruct);
&amp;nbsp; ADC16_EnableHardwareTrigger(DEMO_ADC16_BASE, false); /* Make sure the software trigger is used. */
#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) &amp;amp;&amp;amp; FSL_FEATURE_ADC16_HAS_CALIBRATION
&amp;nbsp; if (kStatus_Success == ADC16_DoAutoCalibration(DEMO_ADC16_BASE)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINTF("ADC16_DoAutoCalibration() Done.\r\n");
&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINTF("ADC16_DoAutoCalibration() Failed.\r\n");
&amp;nbsp; }
#endif /* FSL_FEATURE_ADC16_HAS_CALIBRATION */
&amp;nbsp; PRINTF("Press any key to get user channel's ADC value ...\r\n");

&amp;nbsp; initChannelConfig, &amp;amp;ch08ChannelConfig, CH08_ADC16_USER_CHANNEL);
&amp;nbsp; initChannelConfig, &amp;amp;ch09ChannelConfig, CH09_ADC16_USER_CHANNEL);
&amp;nbsp; initChannelConfig, &amp;amp;ch11ChannelConfig, CH11_ADC16_USER_CHANNEL);

&amp;nbsp; while (1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; GETCHAR();

&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t ch08_val = pollChannel(&amp;amp;ch08ChannelConfig);
&amp;nbsp;&amp;nbsp;&amp;nbsp; delay();&amp;nbsp; // without this delay, ch09_val reads as 0xffff
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t ch09_val = pollChannel(&amp;amp;ch09ChannelConfig);
&amp;nbsp;&amp;nbsp;&amp;nbsp; delay();&amp;nbsp; // without this delay, ch11_val reads as 0xffff
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t ch11_val = pollChannel(&amp;amp;ch11ChannelConfig);

&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINTF("CH08: %d \tCH09: %d \tCH11: %d\r\n", ch08_val, ch09_val, ch11_val);
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example output WITHOUT the calls to delay():&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;CH08: 47808&amp;nbsp;&amp;nbsp; CH09: 65535&amp;nbsp;&amp;nbsp; CH11: 65535&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Example output WITH the calls to delay():&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;CH08: 47808&amp;nbsp;&amp;nbsp; CH09: 46678&amp;nbsp;&amp;nbsp; CH11: 48726&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 23:05:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659804#M40465</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-01-31T23:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659805#M40466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;i&amp;nbsp; have reviewed your code, especially,&lt;/P&gt;&lt;PRE&gt;uint32_t pollChannel(adc16_channel_config_t *config){}
I think the code is okay.
Maybe you use C++ to develop code and declare the variable as&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t ch09_val = pollChannel(&amp;amp;ch09ChannelConfig);
can you declare the variable&lt;PRE&gt;&lt;PRE&gt;uint32_t ch09_val&amp;nbsp; as
void main(void)
{
&lt;PRE&gt;&lt;PRE&gt;&lt;PRE&gt;&lt;PRE&gt;uint32_t ch09_val;
&lt;PRE&gt;uint32_t ch08_val;
&lt;PRE&gt;uint32_t ch11_val;
..............

while(1)
{
&lt;PRE&gt;ch08_val = pollChannel(&amp;amp;ch08ChannelConfig);
........
}
If you still have issue, can you have a debug by step by step and check the ADC register
and variable to get the cause?
BR
Xiangjun Rong

&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 06:04:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659805#M40466</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-02-06T06:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659806#M40467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe I tracked down the source of the problem: in the original run, the inputs were floating and not driven from a voltage source. &amp;nbsp;In that mode, they become sensitive to the charge time (somehow). &amp;nbsp;When I tied all three ADC inputs&amp;nbsp;to a 1V source, they all read the same values with or without the delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 17:32:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659806#M40467</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-02-06T17:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659807#M40468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xiangjun,&lt;/P&gt;&lt;P&gt;I sent you an email describing the offset/drifting problem with the ADC16_polling demo code from KSDK2.0.&lt;/P&gt;&lt;P&gt;Please let me know if you have received it.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;hy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:03:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659807#M40468</guid>
      <dc:creator>HeMyFAE</dc:creator>
      <dc:date>2017-02-08T10:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659808#M40469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, all&lt;/P&gt;&lt;P&gt;As I said I think the code is okay. The issue cames from the external hardware signal impedance, I see that you test the signal from PTB0/PTB1 pins, if you use ADC to sample analog signal,&amp;nbsp; the analog signal should have low impedance, if the analog signal have high impedance, the drifting, inaccurate sample... will happens.&lt;/P&gt;&lt;P&gt;Pls have the following tests:&lt;/P&gt;&lt;P&gt;1)connect the GND or VDD to the PTB0 or PTB1, what is the result? I think the drifting will disappear.&lt;/P&gt;&lt;P&gt;2)the analog signal is from sensor, pls tell us the ananlog signal output impedance. If it has high impedance, i suggest you connect an analog buffer, and connect the PTB0 or PTB1 to the analog buffer output. The analog buffer consists of an OP AMP, for example OP07/27/37, connect the inverting pin of AMP to the output pin of AMP, connect the sensor output to non-inverting pin, it is okay.&lt;/P&gt;&lt;P&gt;Pls have a try&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 06:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659808#M40469</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-02-09T06:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659809#M40470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Xiangjun Rong:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;It's interesting that you say the analog input should be driven by a low impedance such as an op amp.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;The data sheet (KL27P64M48SF2) specifies that you should use an RC low-pass filter (section 6.3.1) with a maximum impedance of 5 k Ohms (section&amp;nbsp;5.3.6.1.1). &amp;nbsp;But I also note that the data sheet advises "the analog source resistance must be kept as low as possible." &amp;nbsp;Still, it seems like an impedance as high as 5 k should be permissible. &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Hy: Are you in a position to drive the input from a low-impedance voltage source (e.g. a power supply or an op amp voltage follower)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 10:03:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659809#M40470</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-02-09T10:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659810#M40471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A A/D input should always be driven with the lowest possible impedance.&lt;BR /&gt;&lt;BR /&gt;Analog Devices goes into details as to why here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://www.analog.com/media/en/training-seminars/design-handbooks/Data-Conversion-Handbook/Chapter6.pdf" title="http://www.analog.com/media/en/training-seminars/design-handbooks/Data-Conversion-Handbook/Chapter6.pdf"&gt;http://www.analog.com/media/en/training-seminars/design-handbooks/Data-Conversion-Handbook/Chapter6.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Simple R/C filter at the input serves several different functions.&lt;/P&gt;&lt;P&gt;Anti-Aliasing for sampled systems.&lt;/P&gt;&lt;P&gt;A stable fixed capacitance to the driver compared to the switching going on in the A/D.&lt;/P&gt;&lt;P&gt;Most often over looked it keeps switching noise from the A/D inside the chip from escaping to a large degree.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 13:38:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659810#M40471</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2017-02-09T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659811#M40472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should know that our production application drives the A/D inputs directly from Op Amp voltage followers with RC filters on their inputs, so in the final version, yes, the A/D inputs will be driven from low impedance sources.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, as I mentioned, the original problem I observed went away when I drove all three inputs from a 1V source, the observed problems went away. &amp;nbsp;So I believe this issue is closed, but the engineers at NXP apparently want to investigate some other aspects of it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 20:28:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659811#M40472</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-02-09T20:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659812#M40473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To ALL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to our schematics that were provided. &amp;nbsp;We direct drive the A/D converter with LMV341 op amps for all three signals fed to the a/d converter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 20:44:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659812#M40473</guid>
      <dc:creator>dmcdaniel</dc:creator>
      <dc:date>2017-02-09T20:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659813#M40474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, all&lt;/P&gt;&lt;P&gt;After communicating with Hy Mai, i see that customer uses MKL27Z64VFM4 with 32 pin LQFP package,and the ADC sample will saturate to 0xFFFF in 16 bits mode when the analog voltage exceeds 2.5V. In other words, the question now is what is the ADC voltage reference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, we should download the KL27P64M48SF2RM from the link for MKL27Z64VFM4 with 32 pin LQFP package:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x?tab=Documentation_Tab" title="http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x?tab=Documentation_Tab"&gt;ARM Cortex-M0+|Ultra-Low Power Kinetis KL2x USB MCU|NXP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/14189i4952385997D36215/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Based on the RM, this is the section to discuss the reference voltage of ADC:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/14229i84F2604F27396340/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Because I have not the board with MKL27Z64VFM4, pls have try for the follwoing setting:&lt;/P&gt;&lt;P&gt;1)connect a 0.1uF capacitor on the PTE30 pin, have a test without modifying any code.&lt;/P&gt;&lt;P&gt;2)change the VREFH setting with ADCx_SC2[REFSEL]=2b'01 and have the ADC sample.&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2017 06:51:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659813#M40474</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2017-02-10T06:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659814#M40475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xiangjun:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are right to suspect a problem with VREF! &amp;nbsp;However, the problems discussed in this thread are specific to the FRDM-KL27Z board, NOT the 32 pin MKL27Z64VFM4 part. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have solved the problem for the FRDM board -- please see&amp;nbsp;&lt;A href="https://community.nxp.com/thread/444521"&gt;Bug in adc16/polling driver example&lt;/A&gt;&amp;nbsp;for an explanation. &amp;nbsp;In short, the VREFH input on the FRDM board is left floating, and the adc16 code example uses VREFH for VREF, leading to unpredictable results. &amp;nbsp;The solution is to configure the ADC to use the "alternate" reference source, in other word, VDD. &amp;nbsp;I've tested it, and it works reliably.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problems that Hy has discussed with you regarding the 32 pin part are (probably) unrelated to this, and would best be split off into another thread. &amp;nbsp;To avoid any confusion, I will mark this thread as solved and start a separate thread for that purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:49:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659814#M40475</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-02-10T10:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: KL27Z switching between ADC channels in polled mode - timing problem?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659815#M40476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Internal Vref Closed sample code .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code add your code . Problem fixed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vref_config_t vrefUserConfig;&lt;BR /&gt; VREF_GetDefaultConfig(&amp;amp;vrefUserConfig); /* Gets a default configuration. */&lt;BR /&gt; VREF_Init(VREF, &amp;amp;vrefUserConfig);&lt;BR /&gt; VREF_SetTrimVal(VREF,0);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 23:58:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KL27Z-switching-between-ADC-channels-in-polled-mode-timing/m-p/659815#M40476</guid>
      <dc:creator>baerun</dc:creator>
      <dc:date>2017-04-18T23:58:43Z</dc:date>
    </item>
  </channel>
</rss>

