Question
F301 ADC injected conversion std peripheral lib commands
Posted on February 16, 2016 at 23:14
I'd like get analog readings from pin PB0 triggered from timer 1 CC4, on my F301K6. I have configured the GPIO settings to set PB0 for analog input. There aren't any examples of injected conversion in the peripheral library examples directory, so I'm trying to figure out the API commands to do this.
ADC_InjectedDiscModeCmd(ADC1, ENABLE); ADC_InjectedInitTypeDef initStruct; ADC_InjectedStructInit(&initStruct); initStruct.ADC_ExternalTrigInjecConvEvent = ADC_ExternalTrigInjecConvEvent_1; initStruct.ADC_ExternalTrigInjecEventEdge = ADC_ExternalTrigInjecEventEdge_FallingEdge; initStruct.ADC_NbrOfInjecChannel = 1; initStruct.ADC_InjecSequence1 = ADC_InjectedChannel_11; ADC_InjectedInit(ADC1, &initStruct);Even before setting up the timer trigger, am I correctly setting ''ADC_InjecSequence1 = ADC_InjectedChannel_11'' correctly? PB0 is listed as ADC1_IN11 in the datasheet. I have other problems with timer triggering, but even when I software start the conversion using ''ADC_StartInjectedConversion(ADC1);'' the values I get seem wrong so I'm worried that I'm not connecting to PB0 properly.