I'm getting really frustrated by the lack of documentation with processor expert:
I want to get the values of two pins from an ADC on a FRDM-K26Z. They're ADC0_SE8 and ADC0_SE9 if that matters.
I'm using the component fsl_adc16, which lets me set up multiple channel configurations, both single ended. One ADC configuration:
adConv1_InitConfig0 = {
.lowPowerEnable = false,
.clkDividerMode = kAdc16ClkDividerOf1,
.longSampleTimeEnable = false,
.resolution = kAdc16ResolutionBitOfSingleEndAs12,
.clkSrc = kAdc16ClkSrcOfBusClk,
.asyncClkEnable = false,
.highSpeedEnable = true,
.longSampleCycleMode = kAdc16LongSampleCycleOf24,
.hwTriggerEnable = false,
.refVoltSrc = kAdc16RefVoltSrcOfVref,
.continuousConvEnable = true,
.dmaEnable = false,
};
This works for the first channel configuration, software triggered (or really, "continuous") via ADC16_DRV_GetConvValueRAW(0,0).
When trying to get the second channel configuration, via ADC16_DRV_GetConvValueRAW(0,1), I get nothing but zeros. Even when attempting to manually initialize/trigger the 2nd channel with ADC16_DRV_ConfigConvChn(adConv1_IDX, 1, &adConv1_ChnConfig1); I get nothing but zeros. When I try adding DC16_DRV_WaitConvDone(adConv1_IDX,1);, the device effectively halts at that line (the conversion is never done).
Diving deeper into the fsl_adc16 component, I notice that I can't initialize multiple channels unless I turn on hardware triggering (Maybe add why that is a requirement to the docs?). So I tried that. I enabled hardware triggering in adConv1_InitConfig0, pointed Trigger A to PIT_Trigger_0 (I also tried combinations of Trigger B and PIT_Trigger_1), and set up an fsl_pit component. There's no pin configuration in the fsl_pit component so I'm just assuming it'll be on one of the PIT_Trigger pins...
The behavior is even worse now, with *neither* channel getting any values.
I'm losing my mind here because I feel like this ought to be a ridiculously simple thing to do.