Driving multiple servos from the RaspberryPi


210 posts   Page 9 of 9   1 ... 5, 6, 7, 8, 9
by mikerr » Sun Feb 08, 2015 4:56 pm
Servoblaster doesn't work with the new Pi 2 , and according to this is a simple change:

joan wrote:Anything which uses userland DMA will require updating above and beyond the peripheral base address move (0x20000000 -> 0x3F00000) to work on the Pi 2.




Looking in servo.d I see

Code: Select all
#define DMA_BASE                0x20007000
#define DMA_LEN                 0x24
#define PWM_BASE                0x2020C000
#define PWM_LEN                 0x28
#define CLK_BASE                0x20101000
#define CLK_LEN                 0xA8
#define GPIO_BASE               0x20200000
#define GPIO_LEN                0x100
#define PCM_BASE                0x20203000
#define PCM_LEN                 0x24


So it should be a matter of editing those to the following and recompiling ?


Code: Select all
#define DMA_BASE                0x3F007000
#define DMA_LEN                 0x24
#define PWM_BASE                0x3F20C000
#define PWM_LEN                 0x28
#define CLK_BASE                0x3F101000
#define CLK_LEN                 0xA8
#define GPIO_BASE               0x3F200000
#define GPIO_LEN                0x100
#define PCM_BASE                0x3F203000
#define PCM_LEN                 0x24


I guess this would make a Pi-2 specific version
Last edited by mikerr on Sun Feb 08, 2015 5:18 pm, edited 3 times in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !
User avatar
Posts: 2416
Joined: Thu Jan 12, 2012 12:46 pm
Location: Up north , UK
by joan » Sun Feb 08, 2015 5:15 pm
mikerr wrote:Servoblaster doesn't work with the new Pi 2 , and according to this is a simple change:

joan wrote:Anything which uses userland DMA will require updating above and beyond the peripheral base address move (0x20000000 -> 0x3F00000) to work on the Pi 2.


...
...
So it should be a matter of editing those to the following and recompiling ?
...

Afraid not. With "will require updating above and beyond the peripheral base address move" I was trying to point out there is rather more involved than just changing a number and recompiling.
User avatar
Posts: 12686
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by mikerr » Wed Apr 08, 2015 11:22 am
Richard has posted a new pi-2 version here:

viewtopic.php?f=28&t=99115&start=47

works for me ;)
Android app - Raspi Card Imager - download and image SD cards - No PC required !
User avatar
Posts: 2416
Joined: Thu Jan 12, 2012 12:46 pm
Location: Up north , UK
by raver79 » Fri Apr 24, 2015 8:59 am
Hi

I am having a bit of a problem. I have managed to wire up two servos to create a pan/tilt mechanism for my camera. The servos are both moving although one servo moves to the default position before moving to the position i have requested. If i ask it to go to 50% for example it goes to 0% and then moves to 50%. Anyone got any idea how i may be able to solve this problem?

Dean
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am
by joan » Fri Apr 24, 2015 9:20 am
raver79 wrote:Hi

I am having a bit of a problem. I have managed to wire up two servos to create a pan/tilt mechanism for my camera. The servos are both moving although one servo moves to the default position before moving to the position i have requested. If i ask it to go to 50% for example it goes to 0% and then moves to 50%. Anyone got any idea how i may be able to solve this problem?

Dean

Is this a one-off initialisation problem or does it happen whenever you change servo position?

Anyhow, check your code. It seems unlikely to be a problem with servoblaster.
User avatar
Posts: 12686
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by raver79 » Mon Apr 27, 2015 6:10 pm
Hi

It happens whenever i change the servo position
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am
by joan » Mon Apr 27, 2015 6:57 pm
raver79 wrote:Hi

It happens whenever i change the servo position

I've not heard of anything like that before.

Which Pi model and which model of servos?
User avatar
Posts: 12686
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by raver79 » Mon Apr 27, 2015 7:47 pm
It's the B+ model. The other servo is fine. I have a feeling that one of them is faulty. I have contacted the seller off Amazon. It's a Tower Pro servo
Posts: 3
Joined: Fri Apr 24, 2015 8:56 am
by ame » Mon Apr 27, 2015 11:32 pm
raver79 wrote:It's the B+ model. The other servo is fine. I have a feeling that one of them is faulty. I have contacted the seller off Amazon. It's a Tower Pro servo


Did you try swapping the connectors over? i.e. drive the 'faulty' servo from the 'good' servo's GPIO?

If the 'good' servo shows the same faulty behaviour, or the 'faulty' servo gets better then you know it's a software problem.
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea
by jcg1541 » Mon Mar 27, 2017 6:38 pm
Love it. Just don't put it on the transatlantic 747 plane that I will fly to Paris to visit my wife's family.
Posts: 1
Joined: Mon Mar 27, 2017 6:33 pm