inevitable jambalaya
Member
Hi Everybody,
I have a project where I need to operate 9 LRA's with high frequency PWM (10K hz). According to the chart from pjrc, the 4.0 has 20 pins which are PWM capable: 0-12, 13-15, 18-19, and 22-23. I am using the USB serial, which I think eliminates pins 0 and 1. I am also using two I2C buses, and this should also eliminate pins 18-19. That leaves me with 16 possible pins. However, I can only get 8 to work: 2, 4-9, and 22. I've read that 10 - 15 are QaudTimers, and I can't get those to work at all. That leaves only two problem pins that run with FlexPWM modules, pins 3 and 23.
Pin 23 locks logic high and stays there no matter what the code tells it to do.
Pin 3 operates at the correct frequency but has ghosting and the voltage is much lower (5 mv) than the pins that do work (400 mV). I hooked a scope up to pin 4 (which does work) as well as pin 3 (which doesn't), took pics and attached them so you can see what I am talking about.
My code is really long so I'll just show the relevant parts here:
int pwmPin13 = 3; // test
..
pinMode(pwmPin13, OUTPUT);
...
analogWriteFrequency(pwmPin13, 10000);
...
analogWrite(pwmPin13, 120);
I'm kind of a newbie at this so I'm hoping the answer is something that is easy to fix.
Thanks in advance
I have a project where I need to operate 9 LRA's with high frequency PWM (10K hz). According to the chart from pjrc, the 4.0 has 20 pins which are PWM capable: 0-12, 13-15, 18-19, and 22-23. I am using the USB serial, which I think eliminates pins 0 and 1. I am also using two I2C buses, and this should also eliminate pins 18-19. That leaves me with 16 possible pins. However, I can only get 8 to work: 2, 4-9, and 22. I've read that 10 - 15 are QaudTimers, and I can't get those to work at all. That leaves only two problem pins that run with FlexPWM modules, pins 3 and 23.
Pin 23 locks logic high and stays there no matter what the code tells it to do.
Pin 3 operates at the correct frequency but has ghosting and the voltage is much lower (5 mv) than the pins that do work (400 mV). I hooked a scope up to pin 4 (which does work) as well as pin 3 (which doesn't), took pics and attached them so you can see what I am talking about.
My code is really long so I'll just show the relevant parts here:
int pwmPin13 = 3; // test
..
pinMode(pwmPin13, OUTPUT);
...
analogWriteFrequency(pwmPin13, 10000);
...
analogWrite(pwmPin13, 120);
I'm kind of a newbie at this so I'm hoping the answer is something that is easy to fix.
Thanks in advance