Triggered ADC on MOD54415
Posted: Mon Jun 24, 2013 9:59 am
I have some mcPWMs generating read and clock pulses on mcPWM[A2] and mcPWM[A3] respectively for a linescan camera. The camera has an analog signal (verified working by scope) going to ADC0. New pixel data is generated by the clock rising edge. I'm trying to trigger the ADC using mcPWM3VAL[4] whem analog is certain to be stable. I can see the pulse on [B3] so I know it's working. No matter what I do, I can't seem to get anyting out of the ADC.
I'm setting the ADC to parallel triggered (I've tried sequential, too)
sim2.adc.cr1 = 0x1005; // SMODE Triggered Parallel
Section 29.51, says that a conversion is started "Upon an intial start or enabled sync pulse" but I can't seem to find what "enables" a sync pulse, and what exactly constitutes a sync pulse. Triggers? Physical?
The mcPWM is loaded
sim1.mcpwm.sm[3].cr1 = 0x0424; // FULL, fClk/4, LDMOD
sim1.mcpwm.sm[3].cr2 = 0x2000; // A0 & B0 independent
sim1.mcpwm.sm[3].init = 0; // start counter value (reload)
sim1.mcpwm.sm[3].val[1] = 239; // end counter value
sim1.mcpwm.sm[3].val[2] = 60; // PWM A ON counter value
sim1.mcpwm.sm[3].val[3] = 180; // PWM A OFF counter value
sim1.mcpwm.sm[3].val[4] = 120; // PWM B ON counter value
sim1.mcpwm.sm[3].val[5] = 180; // PWM B OFF counter value
sim1.mcpwm.sm[3].ocr = 0;
sim1.mcpwm.sm[3].otcr = 0x0010; // Generate Trigger OUT_TRIG0 on VAL[4]
sim1.mcpwm.sm[3].dismap=0xFFF0;
I'm selecting a trigger for the ADC (ref 10.13.11)
sim1.ccm.adctsr = 0x001C; // TRIG0 Channel 3
I must admit I'm a bit confused by the manaual, as it implies the default (Reset) values will use PWM_A Channel 0 for both ADCs.
I've tried both TRIG0 and 1. Same (non) results. Ditto with PWM_A, PWM_X.
What am I missing here?
I'm setting the ADC to parallel triggered (I've tried sequential, too)
sim2.adc.cr1 = 0x1005; // SMODE Triggered Parallel
Section 29.51, says that a conversion is started "Upon an intial start or enabled sync pulse" but I can't seem to find what "enables" a sync pulse, and what exactly constitutes a sync pulse. Triggers? Physical?
The mcPWM is loaded
sim1.mcpwm.sm[3].cr1 = 0x0424; // FULL, fClk/4, LDMOD
sim1.mcpwm.sm[3].cr2 = 0x2000; // A0 & B0 independent
sim1.mcpwm.sm[3].init = 0; // start counter value (reload)
sim1.mcpwm.sm[3].val[1] = 239; // end counter value
sim1.mcpwm.sm[3].val[2] = 60; // PWM A ON counter value
sim1.mcpwm.sm[3].val[3] = 180; // PWM A OFF counter value
sim1.mcpwm.sm[3].val[4] = 120; // PWM B ON counter value
sim1.mcpwm.sm[3].val[5] = 180; // PWM B OFF counter value
sim1.mcpwm.sm[3].ocr = 0;
sim1.mcpwm.sm[3].otcr = 0x0010; // Generate Trigger OUT_TRIG0 on VAL[4]
sim1.mcpwm.sm[3].dismap=0xFFF0;
I'm selecting a trigger for the ADC (ref 10.13.11)
sim1.ccm.adctsr = 0x001C; // TRIG0 Channel 3
I must admit I'm a bit confused by the manaual, as it implies the default (Reset) values will use PWM_A Channel 0 for both ADCs.
I've tried both TRIG0 and 1. Same (non) results. Ditto with PWM_A, PWM_X.
What am I missing here?