9 Replies Latest reply on Aug 31, 2016 8:52 AM by Thomas Kirven

    PWM troubles

    Thomas Kirven

      Can't get an ESC to respond to Edison pwm signal. I send the same exact signal with an arduino and the ESC easily accepts it: low beep, high beep, motor spins.

      The signal is 400 hz square wave, with 1.4 ms duty cycle. I compared the signals on an oscilloscope and they are virtually Identical.

      I have tried many other frequencies as well, with duty cycle between 1-2 milliseconds, all of which are accepted by the ESC when the arduino sends the signal.


      I have tried changing the internal pullup/pulldown resistances on the Edison, not that I think this would effect the pwm lines as they are driven high and low depending on set frequency and duty, but I am trying everything to get this to work.


      All that being said if anyone has an idea of what might be going wrong, I would be so grateful to hear it. I have been struggling with this problem for 3 days. Far too long in my opinion.



        • 1. Re: PWM deceit

          I will not answer to emotions, but let's look into PWM. Technically it has a counter where step is set as a number up to 2^22-1 and comparator value is up to 2^8-1. So, on higher frequencies the resolution is 1 bit (52 nanoseconds per step). I know that the driver in BSP is kinda interesting, but still the hardware provides this range. So, at lowest frequencies you might experience resolution loss, since least significant bits in comparator value do nothing, As far as I know this is described in documentation.

          • 2. Re: PWM deceit
            Thomas Kirven

            Does that explain the 2ms jump though ? Also I really dont know what any of that means. Is there a source you could direct me to so I can learn more about the pwm drivers?



            • 3. Re: PWM deceit

              Let's do a simple math. Input frequency is 19 200 000 Hz. The maximum value of the counter (taking into account 50% duty cycle) is 2^22 (8 integer + 14 fractional bits). This means lowest frequency approx. 4.58Hz or 218.46ms.

              Do this for nearest steps [1..12].



























              And where is the lie exactly?


              So, summarize, on lowest frequencies the resolution of frequency is low, but resolution of duty cycle is highest, and otherwise on higher frequencies.

              • 4. Re: PWM deceit
                Thomas Kirven

                Ok I understand. Thank you for your explanation. No lie, I just wasn't aware of how the pwm driver works.


                However I am still having this maddening problem where I can't get an ESC to register pwm input from the Edison. When I send the same exact pwm signal from and arduino (I compared them side by side on an oscilloscope) the ESC immediately recognizes it. Low beep, then high beep, then the motor spins. It simply does not accept the pwm signal from the edison, though it is virtually exactly the same.


                The only reason I can come up with as to why this is happening is that there is such a subtle difference in the signals that the esc pics up on, but the oscilloscope does not show. This seems very unlikely to me but is there really any other explanation??

                • 5. Re: PWM deceit

                  The hardware which reacts so on subtle changes is a badly designed one. What I can think of is pull-up/pull-down bias. By default it set to something interesting like 20k pull-up for some of interfaces.

                  • 6. Re: PWM troubles
                    Thomas Kirven

                    I agree, not sure that is the case though, just the only thing I could think of given the situation. I have tried all the possible pullup/pulldown values available internally on the Edison, but no luck. Anyway it doesn't seem like pwm output shouldn't be effected by pullup or pulldown resistances.


                    I am at a complete loss.

                    • 7. Re: PWM troubles
                      Thomas Kirven

                      I have noticed that the off (or low) part of the pwm signal from the Edison looks to be slightly higher than that of the Arduino. Is this part of the pwm signal supposed to be the ground voltage level?? I have both devices connected to the same ground, yet on the oscilloscope it looks slightly different - about .1 volts if that.

                      • 8. Re: PWM troubles
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Hello lit,
                        Yes, you are right, the low part of the PWM signal should be at the ground voltage level. However, it's been reported by arfoll, that the resolution of the pwm generator is not very good (as you can see in https://communities.intel.com/message/290158#290158). The workaround that has been provided before for these issues has been to use an external PWM generator (as you can see in https://communities.intel.com/message/378061#378061). Also, the next thread mentions a similar behavior to what you've described: https://communities.intel.com/message/292004#292004, you might be interested in checking it to see if the solution found in there helps you.
                        I've also noticed that you've posted another thread (https://communities.intel.com/thread/105850). I believe it is about the same issue, am I right? If so, can we continue the support there? We would like to avoid any confusions and maintain all the information in one place.

                        • 9. Re: PWM troubles
                          Thomas Kirven

                          Yes that is correct, at this point the resolution isn't even the problem, I will explain further on the other post.