I'm reusing a unity test from an NXP microcontroller after we ported our framework to work with Tiva C.
My problem is that after I set up the pwm to be the trigger I can't seem to be able to controll the trigger via duty cycle. I can only reduce the amount of triggers by changing the pwm frequency.
Is the trigger tied to the PWM signal's clock or is it a configuration problem?
I have a fucntion that is called at every trigger:
void UT_ANALOG_SEQUENCE_Hook(ANALOG_SEQUENCE_t* sequence, ANALOG_t* analog, void* data) { // gUT_ANALOG_SEQUENCE_acc += ANALOG_Read( analog ); int32_t temp; ADCSequenceDataGet(ANALOG_SEQUENCE_GetAdcBase(sequence), ANALOG_SEQUENCE_GetSequencerNumber(sequence), &temp); gUT_ANALOG_SEQUENCE_acc += temp; gUT_ANALOG_SEQUENCE_counter++; }
My code automatically defines a sequencer based on sequencers already in use and the max amount of channels we want the sequencer to run. As this unity test only needs 1 channel, it defines sequencer 3 as the chosen one.
Enabling the sequencer follows these steps:
ADCSequenceDisable(); ADCSequenceConfigure(); // here I just use the sequencer number as a priority // because we don't actually need proper priorities set up ADCSequenceStepConfigure(); // as many as we need for the channels we want // being the last added channel the one that will // carry ADC_CTL_IE | ADC_CTL_END | channel ADCIntRegister(); // this one registers the proper irq handler based // on adc [0..1] and sequencer [0..3] PWMGenIntTrigEnable() // here I set up the trigger for pwm based on // a previous pwm created, using PWM_TR_CNT_ZERO // (I'm a begginer in embedded engineering, I don't // know how to use all the other flags that are // possible here, nor what do they mean... // I'd love a quick reference to something // as I can't find a detailed description on these hahaha) ADCIntEnable(); IntEnable(); ADCSequenceEnable();
Is there a missing step I skipped? Or is it just triggering based on the pwm's clock?