Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Servo.h and VNH5019 Motor Shield no 20kHz driving on: April 29, 2012, 05:32:31 pm
I guess it alrady uses Timer 2 as the shield has the wires to the same pins and these pins are with timer 2 on the mega.
Afaik timer2 can't be set to 20kHz as they are very proud at pololu that they use the 16bit timer 1  for the high 20kHz.
Maybe I should try to configure timer 2 for higher frequencies?

Is also thought about programming the servo by myself instead of using the servo lib so that I could use my old Duemilanove (which works fine with 20kHz) instead of my brand new mega.    smiley-confuse
I could then map the speed of the brushless controller from 0 to 100 instead of the servo angle.
2  Using Arduino / Programming Questions / Servo.h and VNH5019 Motor Shield no 20kHz driving on: April 29, 2012, 03:49:34 pm
Hi,

I'd like to run a brushless motor controller using the servo.h and the VNH5019 Motor driver at the same time. I learned that both libraries use the same timer1 on the Duemilanove/One.
So I decided to use the mega 2560 as the servo.h uses timer5.
Now it works but the DC motors are beeping. Seems like the timer is not set correctly.
I now found that pin 9 and 10 is driven by Timer2 which is a 8bit one. smiley-cry
Now I've a nice mega board with a lot of 16bit timers and have to use the 8bit one.
Does anyone know how I could use a 16bit timer instead?
The VNH5019 documentation says that I can't remap the pwm pins...
3  Community / Products and Services / Re: Introducing the Pololu Dual VNH5019 Motor Driver Shield on: April 29, 2012, 08:31:06 am
I found the following code in the VNH cpp:

Code:
#if defined(__AVR_ATmega168__)|| defined(__AVR_ATmega328P__)
  // Timer 1 configuration
  // prescaler: clockI/O / 1
  // outputs enabled
  // phase-correct PWM
  // top of 400
  //
  // PWM frequency calculation
  // 16MHz / 1 (prescaler) / 2 (phase-correct) / 400 (top) = 20kHz
  TCCR1A = 0b10100000;
  TCCR1B = 0b00010001;
  ICR1 = 400;
  #endif

So it seems Timer1 is not set correctly with the Mega.
I'm a total Timer beginner - how is this implemented within the setup of the arduino sketch?

still whishing you a nice sunday
FipsJr
4  Community / Products and Services / Re: Introducing the Pololu Dual VNH5019 Motor Driver Shield on: April 29, 2012, 07:05:36 am
I'm working on an Arduino lawn mower which runs with two DC gear motors and a brushless mowing motor.

First I ran my program on the Duemilanove without the brushless motor where the DC motors worked nice and quiet.

Then I added servo.h for running an additional brushless motor controller which unfortunately doesn't work with the Duemilanove.

With the Duemilanove:
VNH5019 uses Timer 1 which cannot be changed  smiley-confuse
Servo.h uses Timer 1 which cannot be changed  smiley-confuse

With the Mega:
VNH5019 uses Timer 1
Servo.h uses Timer 5 (I'm using Pin 11 as Pin 12 is already in use by the VNH)

The Mega now does a loud pwm-beeping (the DC-motors). (sounds like about 5-10kHz)
I took all the servo.h including etc. out of the program and tested again - the DC-Motors are still beeping.  smiley-cry

For me it looks like the VNH lib doesn't set the Timer1 correctly doesn't it?

Does anyone know what I could do?

have a nice sunday
FipsJr
Pages: [1]