Other Parts Discussed in Thread: HALCOGEN
Hi,
I'm using HALCoGen to setup a simple PWM output and am having problems getting the output frequency correct. My requirement is 460.8kHz 50% duty cycle. Some other system parameters are:
HCLK = VCLK = VCLK2 = 64MHz
hetREG->PFR->LRPFC = 4
hetREG->PFR->HRPFC = 0
HALCoGen settings for PWM:
Duty % = 50, actual calc = 1.250us
Period us = 2.17, actual calc = 2.250us
These settings achieve a 444.444 kHz signal on the output as predicted by HALCoGen. The next lower setting for Period us will bump the actual calc down to 2.0 us, which would be a 500kHz signal. So it seems like I need a smaller LRP to achieve a higher resolution of frequency. If I set HALCoGen to use a 125ns Loop Time, it will drop the LRPFC setting to 3 from 4 and now my PWM frequency calc can change in 125ns increments. So this will get me closer at 2.125us period (470.6kHz). When I try the LRPFC setting of 3, then my PWM will not output correctly. Instead, it outputs a constant logic high.
So my question is what's going on here to make the HET functionality break w/ the LRPFC setting of 3 rather than 4? I suspect the answer has to do with the number of instructions in the HET program and how many cycles it takes to run to completion per loop cycle. If this is correct, then can it be that the HALCoGen generated HET code is too long for my required LRPFC? At the moment, all I need is 1 PWM, but we will need a 2 other timers at some point. How can I get HALCoGen to generate a minimum set of code that meets my requirements? There is a lot of code generated that is for channels that are not going to be used. Please advise.
Thanks,
Marco




