Page 1 of 1

Raspberry Pi robot mini driver firmware TCCR2 error

PostPosted: Sun Sep 27, 2015 4:28 pm
by Rui M
Hello,

I tried to post before don´t know what happen...

So if someone can give a help, i am trying to compile the minidriver firmware on the Arduino IDE and it returns the error :

error: 'TCCR2' was not declared in this scope

i have tried on the raspberry pi with the Dawn SD image and also in a MAC and the same error is return.

I don´t know what i missed...

Thank you

RM

Re: Raspberry Pi robot mini driver firmware TCCR2 error

PostPosted: Tue Sep 29, 2015 7:11 pm
by Alan
Hi there,

Welcome to the forums. :) Apologies for the delayed reply.

If you're compiling the sketch for the Mini Driver then you need to set the board type to be Arduino NG or older /w ATmega8.

If you're compiling the sketch for the mini driver MkII then you need to set the board type to Arduino Nano w/ ATmega328. I'm afraid that there will still be compilation errors because the chip on the mini driver mkII is different from the mini driver. To start converting the code I would suggest commenting out the stuff that is causing errors (which will probably be the motor code and then trying to reimplement motor control separately.

Regards

Alan

Re: Raspberry Pi robot mini driver firmware TCCR2 error

PostPosted: Wed Sep 30, 2015 10:02 am
by Rui M
Hello Alan,

Thank you for your reply. I did what you advise and I comment everything regarding the TCCR2 and them the compile it and it worked.

The robot is working with the minidriver MKII.

I would need your help in another things:

What does the TCCR2 part of the code do ? ( sorry i am not a programmer, so i just try to follow the logic)

Is it suppose to be always running and just stop when we pull down the motor "Joystick" or is this related to the comment out that i made in the code?

When i turn off the power switch of the minidriver it starts to pull energy from the RAspberry usb and you can even ear some click sounds, is this normal ?

Thank you

Re: Raspberry Pi robot mini driver firmware TCCR2 error

PostPosted: Wed Sep 30, 2015 6:14 pm
by Alan
Hi there,

The TCCR2 part of the code controls timer 2 of the Atmega8 chip and is used to generate PWM signals that drive the motors (see the timer intterupt code at the bottom of the sketch). You can find a full explanation of how to control the timer in the Atmega8 deatasheet. This code was needed because it was not possible to use the Arduino Servo library (to control the neck motors) at the same time as using AnalogWrite to generate a PWM signal for the wheel motors on the Atmega8. This shouldn't be a problem for the MkII mini driver which uses the Atmega328, so you should be able to write some simpler motor control code.

The mini driver should just wait for motor commands from the Pi. If it doesn't get any movement commands for 2 seconds or more then it will turn off the wheel motors.

If the mini driver power switch is off then the Pi will try to supply power to the mini driver via the USB port. Usually this will cause too much current to be drawn however, and the USB port will temporarily shut down. It will then start up again and repeat the cycle.

Hope that helps.

Regards

Alan