The multiplication by 2 is only valid for the 2MHz case, where each tick is half a microsecond or each 2 ticks are one microsecond. The ESC is likely not arming as result of sending the wrong pulse width. Your example doesn't show how you set the pulse width. Also, you seem to be setting the default pulse width to 0 instead of 1060us, which means that every time you stall the sequencer you'd get 0, which the ESC is likely to interpret as a fault. If you send me the entire code in question (please reduce it to the minimum that demonstrates your problem) I can probably help you find your actual problems and save a few email round trips. On Dec 22, 2014 3:20 AM, <[email protected]> wrote:
> One more thing. > > If I switch to: > new Sequencer.ChannelConfigPwmSpeed(Sequencer.Clock.CLK_250K, 750, 0, new > DigitalOutput.Spec(2)); > which would translate to the same input PWM freq as with the 2MHz example, > the ESC does not arm. > > I feel I am missing something basic but I am not sure what. > > Claudiu > > On Monday, December 22, 2014 12:54:19 PM UTC+2, [email protected] > wrote: >> >> Thank you Ytai for jumping in. >> >> Just tried the value of 40000. The ESC does not arm. >> Also tried the value of 2000 (the ESC specs state the Input PWM is 1KHz). >> Same behavior. >> >> When switching back to 6100 (it works with 6200 as well and any value in >> between) things work again. >> Does this mean that the ESC input PWM freq is at around 350Hz? >> Do you have any idea how I could probe this? >> >> When you say we feed the pulse width in microseconds instead of ticks, >> what do you mean? >> The difference I see from your way of feeding the pulseWidth is that you >> multiply by 2. Is this how it should be converted from microseconds to >> ticks? >> If we multiply by 2 like in your example, the ESC doesn't arm. >> >> Thank you, >> Claudiu >> >> On Sunday, December 21, 2014 7:45:15 PM UTC+2, Ytai wrote: >>> >>> Is it possible that you're confusing the motor (output) PWM rate with >>> the control (input) PWM? >>> Hobby ESC are almost universally 50Hz (20ms) input. >>> You also used the wrong type of PWM channel and fed the pulse width in >>> microseconds instead of ticks. >>> >>> So I imagine you should need something like: >>> >>> // 40000 ticks @ 2MHz == 20000us == 20ms >>> // Also, the PWM rate corresponds to SPEED not POSITION >>> new Sequencer.ChannelConfigPwm*Speed*(Sequencer.Clock.CLK_2M, 40000, 0, >>> new DigitalOutput.Spec(2)); >>> >>> ... >>> >>> // Then: >>> ChannelCuePwmSpeed cue; >>> >>> ... >>> float power = <value between 0 (stopped) and 1 (full speed)>; >>> cue.pulseWidth = Math.round((1060.f + (800 * power)) * 2); >>> >>> On Sun, Dec 21, 2014 at 4:29 AM, <[email protected]> wrote: >>>> >>>> Hello, >>>> >>>> I am having troubles understanding how the Sequencer works for >>>> controlling a couple of ESCs. >>>> The ESCs are Afro ESC from HobbyKing. Their manual can be here: >>>> http://www.hobbyking.com/hobbyking/store/uploads/ >>>> 745353836X1335174X28.pdf >>>> According to their specs: For PWM input, motor stop / arm below 1060µs, >>>> full power at 1860µs. >>>> That would be the pulse width for controllig the speed of the motor, >>>> right? >>>> >>>> The code we have in our Android app to initiate the sequencer: >>>> final ChannelConfigPwmPosition motorESC = new Sequencer. >>>> ChannelConfigPwmPosition( >>>> Sequencer.Clock.CLK_2M, 6120, 0, new DigitalOutput.Spec(2)); >>>> >>>> the cue value is set to 10: sequencer_.push(cue_, 10); >>>> >>>> and the value that we send for the pulse width are generated as follows: >>>> uno_varValue = (int) (1060 + (motorsPowers.nw * 8)); >>>> >>>> The motor is running with these values but I just can't understand why. >>>> Some of the questions we have: >>>> - why only values around 6100 work for the period. The ESC should have >>>> an input freq of 1 Khz (according to this: http://www.hobbyking.com/ >>>> hobbyking/store/__52338__Afro_ESC_30Amp_Multi_rotor_Motor_ >>>> Speed_Controller_SimonK_Firmware_US_Warehouse_.html) though the manual >>>> says this: The default PWM frequency is 18kHz with 800 distinct steps, but >>>> may be adjusted to any frequency. >>>> - why only 2Mhz clock values worked. I was not able to make it work >>>> with other values >>>> - if the documentation says that 1860µs is the value for full power, >>>> why I don't get full power when I send 1860(I can send up to 2500 and there >>>> is a clear change in the motor speed) >>>> >>>> The whole code can be found here: https://github.com/ >>>> cllaudiu/vespi/tree/master/vespidrone/src/ioio/rd/vespidrone >>>> >>>> We are trying to build a drone based on Android and we have some >>>> stability issues at this stage. It flies but we find it hard to control it. >>>> Before getting into PID tuning and other elements we want to make sure that >>>> the Android - IOIO part works perfectly and that we understand what happens >>>> there. Thank you for your time. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "ioio-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/ioio-users. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "ioio-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/ioio-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
