10MHz and PPS sync

enrique

Member
Hi, I'm working on a project that need to generate a 10MHZ and PPS signals,buts with phase sync. I accomplish to generate both signals, but cant make it sync.
This sis my code:


#include <Arduino.h>
#include <eFlexPwm.h>
using namespace eFlex;

const uint8_t PIN_10MHZ = 8;
const uint8_t PIN_PPS = 6;

SubModule pwm10MHz(PIN_10MHZ);
SubModule pwmPPS(PIN_PPS);
void setup() {
Config cfg;
cfg.setClockSource(kPWM_BusClock);
cfg.setPrescale(kPWM_Prescale_Divide_1);
cfg.setMode(kPWM_EdgeAligned);
cfg.setReloadLogic(kPWM_ReloadPwmFullCycle);

Config cfg10MHz = cfg;
cfg10MHz.setPwmFreqHz(10000000);
pwm10MHz.configure(cfg10MHz);
pwm10MHz.updateDutyCyclePercent(50, ChanA);
pwm10MHz.setupDeadtime(0);

Config cfgPPS = cfg;
cfgPPS.setPwmFreqHz(1);
pwmPPS.configure(cfgPPS);
pwmPPS.updateDutyCyclePercent(1, ChanA); /
pwmPPS.setupDeadtime(0);

pwm10MHz.timer().begin();
pwmPPS.timer().begin();
}
void loop() {
}

Any suggestions?
 
Any suggestions?

Assuming the rest of your code is okay, try using two pins that are both on the same FlexPWM module and sub-module. I think that would give you best possibility of synchronization. For example, pins 6 and 9 or pins 7 and 8, as shown below. Please let us know if you get it to work.

Code:
// FlexPWM2_2_A   6  // B0_10
// FlexPWM1_3_B   7  // B1_01
// FlexPWM1_3_A   8  // B1_00
// FlexPWM2_2_B   9  // B0_11
 
Back
Top