mfarrukhali / ardupirates

Automatically exported from code.google.com/p/ardupirates
0 stars 0 forks source link

APM_RC_Class::Init sets timer to 1.5ms, should be 1ms #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The ICRx register are set to 3000, should be 2000 to set all PWM outputs to 
1ms, so the ESCs are off.

Original issue reported on code.google.com by al...@arcor.de on 30 Jan 2011 at 6:09

GoogleCodeExporter commented 9 years ago
Sorry, ment the OCRxy registers, of course.

Original comment by al...@arcor.de on 30 Jan 2011 at 6:13

GoogleCodeExporter commented 9 years ago
Agreed, seems like at least OCR5B and OCR5C are not even set (channels 0 and 1) 
?

This might explain why I have two engines on my hex that stop much earlier than 
others at low throttle ?

//OCR5B = 3000; //PL4, OUT0
//OCR5C = 3000; //PL5, OUT1

Original comment by kidogof...@gmail.com on 1 Feb 2011 at 2:46

GoogleCodeExporter commented 9 years ago
Channel 0+1 run on OCR5B+OCR5C, so they also have to be initialized to 1ms. The 
bad initialisation caused a major problem in the AeroQuad code. ESCs were not 
initialized correctly and behaving mad.

Original comment by al...@arcor.de on 1 Feb 2011 at 5:35

GoogleCodeExporter commented 9 years ago
I just finished checking the PWM outputs with an old oscilloscope, and indeed 
you're right. The PWMs on my hexa run at around 730Hz (not an exact science and 
not an exact scope). 730Hz is 730 times per second, so 1000ms/730 = 1.34ms. 
Sounds about right, but really wrong :)
I believe the margin there is way too high to expect ESCs to behave reliably.
I set to 2000, and uncommented the values for 
OCR1B,OCR1C,OCR3B,OCR3C,OCR5B,OCR5C,OCR4B,OCR4C. That's all the output 
channels, 8 of them. 
I do believe I see a difference with at least one of my ESCs that would 
sometimes flutter somewhat - the flutter is now gone.

Original comment by kidogof...@gmail.com on 1 Feb 2011 at 7:44

GoogleCodeExporter commented 9 years ago
No matter how old the scope is, it can handle 730 Hz, but no standard ESC can, 
and the source code allows only 200 Hz if the Force_Out* functions are called. 
Are you mixing up signal high time with Hz by mistake ?

Original comment by al...@arcor.de on 1 Feb 2011 at 10:57

GoogleCodeExporter commented 9 years ago
Errr yes... my fault ;) Sorry about that... it's been a long while since I used 
anything like a scope. Had to go up to the attic and crawl for a while before I 
found it :D

Original comment by kidogof...@gmail.com on 1 Feb 2011 at 11:38