Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: analogWriteFrequency bug

  1. #1
    Senior Member
    Join Date
    Mar 2013
    Posts
    651

    analogWriteFrequency bug

    I seem to have found a small bug in analogWriteFrequency. While working on my eGocart project I managed to do this.
    Code:
    analogWriteFrequency(22, PWMfrequency);
    analogWriteFrequency(23, PWMfrequency);
    It looks harmless but boy did it kill my afternoon.
    I was trying to set pin 25 High with a switch and a few other variables and it would sometimes go on and off quickly and other times do nothing. After banging my head on my Keyboard for a few hours trying to figure out why my If statement was broken I started disabling huge chunks of code. 900lines later...... I commented out the above code and pin 25 started working......

    It seems that if you write to the same timer twice it borks something, even though pin25 is on a different timer and was not being used for PWM it was pulsing the pin one time instead of holding it High.

    Well I have just enough time left in the day to get drunk and go to bed so later everyone.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,805
    Can you please post a complete program which demonstrates the problem?

    There may indeed be a bug in analogWriteFrequency or analogWrite itself. If so, I would really like to investigate and fix it. But I need you to post an actual program that demonstrates the problem.

  3. #3
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    I will see what I can do, I need to take a break, just spend a few hours troubleshooting pin33......

    I will try to make a small example that has what is needed to reproduce but right now I need Excedrin and Crown.

    The good news is I have a working Precharge and Bypass for my eGocart, and the faults work to Was hoping to run the test motor today but probably be further into the week.

  4. #4
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    Cant seem to reproduce it with a basic test program.

    I will play around with an older version of the code before I removed the second analogWriteFrequency.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,805
    I hope you'll manage to trim it down to something you can post here, which reproduces the problem.

    If there really is a bug in either of those Teensyduino functions, I certainly want to fix it. But I can't even start without knowing how to reproduce the problem.

  6. #6
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    I have been unable to reproduce it :/

    I even went back to an older version and tried playing with it and could not get it to reproduce.
    Maybe I should have had the Crown before I started yesterday instead of after.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •