On Sunday 21 September 2008 16:04:48 Eric Johnson wrote: > As for the PWM, I think I have something for you. It looks to me like > something in the scaling must not be working in FPGA. Fortunately it does > appear to be linear, so I think I can get my system going by adjusting my > scaling. It may affect the granularity, but for this application that > really isn't an issue. > > Here is what I am getting; > > Any value for the PWM set at 0.126 and above results in a duty cycle of > almost 100% (99.3). At 0.125 the duty cycle is 99.1. The following table > lists the duty cycles for values of 0.120 to 0.010 in increments of 0.010. > > Value Duty Cycle > 0.120 95.3 > 0.110 87.3 > 0.100 79.5 > 0.090 71.6 > 0.080 63.7 > 0.070 55.8 > 0.060 47.9 > 0.050 40.0 > 0.040 32.1 > 0.030 24.2 > 0.020 16.3 > 0.010 8.4 > > Pretty consistent at 7.9% per 0.010 of value. As a hunch, it looks to me > like you are off by 4 bits some place, because 0.125 is 1/8th of the range > of 0.0 to 1.0.
How are you measuring duty cycle? I'm confident that (at least in my test setup) setting pwmgen.XX.value causes the correct number to be set in the FPGA register. Take a look at <http://pastebin.ca/1208030>. I updated pwmgen.c to decode the number in the PWM Value Register, then used raw.dump-state to show the register when pwmgen.value was -1.0 to +0.3 in increments of 0.1. Lines 1-22 show the relevant dmesg output for .value=0, then I just show the PWM Value Register for the other .value settings. In addition to the correct numbers being set in the register, the corresponding LED on the 7i31 LED Debug board varies in intensity as expected, and the small DC servo (driven by a 7i30 servo amp) changes its speed as expected. I'm not sure why you're seeing what you're seeing. Is maybe your pwmgen.scale not set to 1.0? -- Sebastian Kuzminsky "On the molecular scale, you find it's reasonable to have a machine that does a million steps per second, a mechanical system that works at computer speeds." -- K. Eric Drexler ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
