I'm trying to turn a knob with a servo for ... reasons ... and while all of the features I want are working individually they do not work when combined.
My code is here: https://gist.github.com/jschoch/9afa3cf ... 2ef394956b
Right now the servo writes to the 0 position on setup. This is setup before my PWM measurment timer is started and configured. The signal works and the servo moves to the 0 position and I can see a good signal on my scope. After that setup routine and the timer has been started I cannot get the servo to move and the signal looks like this:
https://drive.google.com/open?id=18B-S0 ... 6U33V3ddXx
this is when the servo should be doing nothing.
https://drive.google.com/open?id=18A5oX ... iZfe1UdBTX
I'm wondering what may be causing this. I've tried a variety of pins with no effect on the servo signal. The PWM measurement works fine and the i2c display also works fine. I tried to pause the timer before I called servo.write but that did not seem to help. Any thoughts, is this a bug?
Servo with SSD1306 and TIMER_INPUT_FREQ_DUTY_MEASUREMENT
Re: Servo with SSD1306 and TIMER_INPUT_FREQ_DUTY_MEASUREMENT
you did not mention your core or your board, no one can guess what are those.
Re: Servo with SSD1306 and TIMER_INPUT_FREQ_DUTY_MEASUREMENT
Looking at the code, it is for the STM32 core.
If it works individually, I guess you can have those kind of issues:
- IRQ priority
- TIMER shared ressource
The best would be you can debug to see exactly why you failed?
If it works individually, I guess you can have those kind of issues:
- IRQ priority
- TIMER shared ressource
The best would be you can debug to see exactly why you failed?
Re: Servo with SSD1306 and TIMER_INPUT_FREQ_DUTY_MEASUREMENT
I agree with fpiSTM, also take care with frequency measurement:
if input frequency is too high, you may send most of your time in interrupt callbacks
if input frequency is too high, you may send most of your time in interrupt callbacks
Re: Servo with SSD1306 and TIMER_INPUT_FREQ_DUTY_MEASUREMENT
It is a blue pill f103
I have it working now. I had to delay after the servo.write and I also changed the prescaler on the timer. Not sure which one fixed it or if both helped.
Now i need to get it in a shielded box since the EMI from the spindle motor creates noise and false readings when running > 80% speed.
I have it working now. I had to delay after the servo.write and I also changed the prescaler on the timer. Not sure which one fixed it or if both helped.
Now i need to get it in a shielded box since the EMI from the spindle motor creates noise and false readings when running > 80% speed.