Hi, I'm new to the synergy platform and I'm using a DK-S128 demo board. I want to set up a high resolution pwm waveform with a different duty cycle on GTIOCA and GTIOCB. I've used the HAL module to set up the basic pwm. I am able to set a different duty cycle for each pin; but for now I left the duty cycle on both pins set the same.
The problem is when trying to apply the delay. I can see the delay being applied to GTIOCA but it is not being applied to GTIOCB. I have set bit 13 of register GTDLYCR2 to 0 as stated in the manual. If I set the bit to 1, I get no output on at all on GTIOCB. Am I wrong in thinking that the delay would be applied to both GTIOCA and GTIOCB?
Here is my code:
void hal_entry(void)
{
int i,j;
g_timer1.p_api->open(g_timer1.p_ctrl, g_timer1.p_cfg);
g_timer1.p_api->dutyCycleSet(g_timer1.p_ctrl, 15, TIMER_PWM_UNIT_RAW_COUNTS, 1); //for GTIOCB
g_timer1.p_api->start( g_timer1.p_ctrl);
R_GPTB1->GTWP=0x0000A500;// turn off write protection
R_GPT_ODC->GTDLYCR1=1; // Enable the Delay
for(j=0;j<100000;j++);
R_GPT_ODC->GTDLYCR1=3;//reset delay circuit
for(j=0;j<100000;j++);
R_GPT_ODC->GTDLYCR1=1;//release reset
R_GPT_ODC->GTDLYCR2=2;//Do not bypass ch1 dly, enable dly ch1-3, enable GTIOC1B/GTIOC2B/GTIOC3B based on b9-b12
while(1)
{
for (i=0; i<32; i++)
{
R_GPT_ODC->GTDLYFnRC0[1].GTDLYFnA=i;//set falling edge delay
for(j=0;j<100000;j++);
}
}
}
Thanks!!!
George