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);
// Config ADC
//adcConfigStruct.clockSource = kADC_ClockSourceAlt3;
//adcConfigStruct.ResolutionMode = kADC_Resolution10BitMode;
//adcConfigStruct.clockDivider = kADC_ClockDivider2;
// Init ADC
// Conversion trigger selection.
And then I tried with bits and the result is the same.
ADC->APCTL1 = ADC_APCTL1_ADPC(1);
ADC->SC3 = ADC_SC3_MODE(0);
ADC->SC2 = 0x00;
ADC->SC1 = ADC_SC1_AIEN_MASK | ADC_SC1_ADCH(1);
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:
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.