AnsweredAssumed Answered


Question asked by Pau Vilanova on Oct 26, 2018
Latest reply on Nov 4, 2018 by LPCX presso support


I'm having trouble programming peripherals in the MKE04Z8VTG4 on MCUxpresso IDE. For instance there aren't any type of driver example on the freedom FRDM-KE04Z sdk builder, and moreover I cannot build a debug code because MKE04Z just has 8kb of flash and  building a out of the box hello world code in MCUxpresso already needs 10kb.

It's difficult to find any information related to sdk drivers/kinetis with MCUxpresso, is it because xpresso is relatively new? or is it that no one is working with it¿


I'm trying to code a simple adc in channel 1 of my MCU but it does not work. Enabling analog input at the begining just crashes my code. First with the sdk drivers I was testing with different configurations but the results were the same:

    ADC_EnableAnalogInput(ADC, kFTM_Chnl1Flag, true);

    adc_config_t adcConfigStruct;
    // Config ADC
    //adcConfigStruct.clockSource = kADC_ClockSourceAlt3;
    //adcConfigStruct.ResolutionMode = kADC_Resolution10BitMode;
    //adcConfigStruct.clockDivider = kADC_ClockDivider2;


    // Init ADC
    ADC_Init(base, &adcConfigStruct);


    // Conversion trigger selection.
    ADC_EnableHardwareTrigger(base, false);



And then I tried with bits and the result is the same.


    ADC->SC3 = ADC_SC3_MODE(0);
    ADC->SC2 = 0x00;

If I don't enable the analog I/O the code runs and the interrupt works but the adc conversion does not give . So if anyone can give me a hint of what I'm supposed to do that would be great.


PD: I know to make an interrupt I have to do the following:

ADC_SetChannelConfig(ADC, &adcChannelConfigStruct);
where adcChannelConfigStruct contains: the channel I want to convert and the enable interrupt on conversion bit. The main problem is that my code gets stuck in the initialitzation of the ADC itself.