Categories

LEDzep – Servos and Motors

Yesterday and this morning I worked on driving the servos and the motors.

It was a bit harder than expected since the two timers the servo used both had weird behavior with Chibios. The first one TIM8 had advanced functions not supported by Chibios (we were on an N channel, so I had to change a bit in the CCER register in order to switch the polarity of the channel), it wasn’t hard to fix but took me a while to find where the bug came from.
The second timer TIM9 had an issue on his PWM function, the frequency was twice what it was supposed to be, after a while trying to figure out why it behaved this way Sam told me to check the implementation made by ChibiOS/RT of the clock, after a while reading the datasheets (and checking the implementation which indeed respected the datasheet) I decided to look on the ChibiOS/RT support forum and discovered that it really came from ChibiOS/RT and was discovered the day before … Eventually I solved the problem by taking another timer as we still had a few free ones.
Once I solved this problem it let it rest for the night and finished it this morning, Thomas took a nice video you should see it soon.

I also worked on the H-Bridges, after losing two hours on a stupid board.h issue (I forgot to put pin linked to the enable of the H-Bridges as outputs …) they were running !
Later I fixed an issue which allowed us to control the speed of the motor (but only when they turned forward) when I looked at the signal with the oscilloscope I discovered that the PWM for the backward rotation wasn’t generated properly … I was sick with PWMs for that day and decided to call it a night.
This morning Thomas discovered that it was a simple sign issue in the code so we fixed it, and now both the motors and the servos are working !

See you soon 😉

Félix Raimundo

Twitter 

Commentaires fermés.