Hi @EdwinHz,
Earlier we had discussions regarding the auto updation of the duty cycle into the registers. And that issue got solved using the SetSoftwareTrigger function as instructed by you. Now, I am now facing a few issues if the code is inside the while loop. Without the code inside the while loop, the output is obtained as per the table I have mentioned in my previous query (I have also attached it in here below). But if I put the code inside the while loop, I am unable to generate the desired signal. The auto-updating of registers is ensured but not the output generation.
Input 1 | Input 2 | Input 3 | PWM o/p | |||||
GPIOB 1 | GPIOB 10 | GPIOB 2 | Channel 0 | Channel 1 | Channel 2 | Channel 4 | Channel 5 | Channel 6 |
0 | 0 | 1 | 1 | Disabled | Disabled | Disabled | Disabled | 1 |
0 | 1 | 0 | Disabled | 1 | Disabled | 1 | Disabled | Disabled |
0 | 1 | 1 | Disabled | 1 | Disabled | Disabled | Disabled | 1 |
1 | 0 | 0 | Disabled | Disabled | 1 | Disabled | 1 | Disabled |
1 | 0 | 1 | 1 | Disabled | Disabled | Disabled | 1 | Disabled |
1 | 1 | 0 | Disabled | Disabled | 1 | 1 | Disabled | Disabled |
Figure 1. 3.3V output from the pins which need to produce PWM pulses.
Figure 2. PWM pulses from the undesired pins having 20 percent duty cycle and 100kHz frequency.
Please help in debugging this issue @EdwinHz!
Hi again, @HARINI_T!
I see your while look is constantly polling for the status of the three GPIO inputs, and updating the PWMs accordingly. When you mention:
“Without the code inside the while loop, the output is obtained as per the table”, where would you place the trigger, if at all? Do you mean you would only do a single trigger, the output would be reflected, and then no update would be done and the PWM configurations would be soft-locked into a single state?
I believe the polling might be being done a little bit too often, not giving the trigger enough time to properly update all of the registers and ending up with unexpected results like the ones you mention.
The better solution would be to update the PWMs and generate a trigger, only when a GPIO changes (interrupt based solution) instead of constantly polling the GPIOs and creating triggers to fast (current implementation). This way, you ensure that the register buffers get enough time to refresh their values and set them properly on the FTM module without mistake.
BR,
Edwin.