Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servoblaster not compatible with Raspberry Pi 2 #43

Closed
tomfogg opened this issue Feb 4, 2015 · 23 comments
Closed

Servoblaster not compatible with Raspberry Pi 2 #43

tomfogg opened this issue Feb 4, 2015 · 23 comments

Comments

@tomfogg
Copy link

tomfogg commented Feb 4, 2015

Looks like the DMA addresses have changed but I can't find any details on what the new ones are

@tomfogg
Copy link
Author

tomfogg commented Feb 5, 2015

as some extra info, the userland servod hangs the pi2, the kernel module loads with

Feb 5 21:18:20 raspberrypi kernel: [ 5.821933] ServoBlaster: Control page is at 0xb9364000, cycle_ticks 2000, tick_scale 6, idle_timeout 0

but doesnt do anything on the gpio ports

@tomfogg
Copy link
Author

tomfogg commented Feb 5, 2015

Since it looks like the DMA base has changed to 0x3F000000 from 0x20000000 i tried changing the userland daemon to start from that base but this still hangs the pi unfortunately

@Gadgetoid
Copy link

I have been having this same issue with a WS2812 LED driver which uses DMA and PWM- I have changed the GPIO offsets but suspect there are other changes and a lack of documentation.

@tomfogg
Copy link
Author

tomfogg commented Feb 10, 2015

There are some updates on the rpi forum here apart from the change in DMA addresses there seem to be some changes in how the cache is being dealt with

@vallettea
Copy link

Also interested in this question, i'm trying to make servoBlaster run on odroid c1, which basically equivalent to rpi2

@tomfogg
Copy link
Author

tomfogg commented Feb 16, 2015

The pigpio library is now working with the pi2, support was added with this commit I haven't got the understanding of the DMA code to port this fix to servoblaster

@richardghirst
Copy link
Owner

That's not a real fix though - as Joan admits in the forum thread the
pigpio code is just accessing other memory locations in the hope of
triggering a cache flush, and initialising the DMA engine multiple times
until it seems to have started up. I'm hoping we'll come up with a better
solution than that, but I've not got a Pi2 to play with yet.

On Mon, Feb 16, 2015 at 7:29 PM, tomfogg notifications@github.com wrote:

The pigpio http://abyz.co.uk/rpi/pigpio/ library is now working with
the pi2, support was added with this commit
joan2937/pigpio@b14e0a0
I haven't got the understanding of the DMA code to port this fix to
servoblaster


Reply to this email directly or view it on GitHub
#43 (comment).

@tomfogg
Copy link
Author

tomfogg commented Feb 18, 2015

I thought it looked quite hairy. It does seem to work pretty well though, havent noticed any issues with it controlling 6 servos. If you need some code testing, let me know

@richardghirst
Copy link
Owner

Code for testing posted on the forum, see
http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=99115&p=699651#p699651

Richard

On Wed, Feb 18, 2015 at 9:13 AM, tomfogg notifications@github.com wrote:

I thought it looked quite hairy. It does seem to work pretty well though,
havent noticed any issues with it controlling 6 servos. If you need some
code testing, let me know


Reply to this email directly or view it on GitHub
#43 (comment).

@tomfogg
Copy link
Author

tomfogg commented Feb 19, 2015

That code is working a treat for me with 6 servos. Good stuff, especially if you didn't have a pi2 to try it on!

@richardghirst
Copy link
Owner

Got my hands on a Pi2 about 5 hours ago :-)

On Thu, Feb 19, 2015 at 10:09 PM, tomfogg notifications@github.com wrote:

That code is working a treat for me with 6 servos. Good stuff, especially
if you didn't have a pi2 to try it on!


Reply to this email directly or view it on GitHub
#43 (comment).

@wennycooper
Copy link

Same problem here. servoBlaster is cool!

@richardghirst
Copy link
Owner

Hey Kevin, I assume you saw the link to some working code further up this
thread?
On 1 Mar 2015 10:46, "Kevin Kuei" notifications@github.com wrote:

Same problem here. servoBlaster is cool!


Reply to this email directly or view it on GitHub
#43 (comment).

@wennycooper
Copy link

Ahh... yes, you are right. The new code worked on my Pi2. Thanks a lot!!

Kevin Kuei

On Sun, Mar 1, 2015 at 11:42 PM, richardghirst notifications@github.com
wrote:

Hey Kevin, I assume you saw the link to some working code further up this
thread?
On 1 Mar 2015 10:46, "Kevin Kuei" notifications@github.com wrote:

Same problem here. servoBlaster is cool!


Reply to this email directly or view it on GitHub
<#43 (comment)
.


Reply to this email directly or view it on GitHub
#43 (comment).

@lbaulig
Copy link

lbaulig commented May 9, 2015

Hi, today I updated Raspian and also re-compiled ServoBlaster on my Pi B+, and now when I execute a program that used to run just fine, I get "Invalid pin number 33 in P1 pin list", the command I issued to run ServoBlaster is "sudo servod --cycle-time=5000 --step-size=10 --min=1000us --max=2000us --p1pins=13,18,33,40,7 ", really strange. Maybe some pin mapping was changed?

FIXED: forgot to change array layout to 40 pins in servod.c .

@improti
Copy link

improti commented Sep 13, 2015

Hi, do I get this right? There is a fix for this problem posted on the Raspberry forums but there is no updated version here? If so why?

@friksa
Copy link

friksa commented Sep 21, 2015

Any news on an update?

@richardghirst
Copy link
Owner

I'm on holiday at the moment so can't look at the code but maybe a problem
with it deciding which version of Pi it thinks it is running on. Didn't
have 33 pins on the original Pi. You could try to find that code and change
it to think it is always a Pi B+ as a short-term fix.
On 9 May 2015 9:15 pm, "luks3n" notifications@github.com wrote:

Hi, today I updated Raspian and also re-compiled ServoBlaster on my Pi B+,
and now when I execute a program that used to run just fine, I get "Invalid
pin number 33 in P1 pin list", the command I issued to run ServoBlaster is
"sudo servod --cycle-time=5000 --step-size=10 --min=1000us --max=2000us
--p1pins=13,18,33,40,7 ", really strange. Maybe some pin mapping was
changed?


Reply to this email directly or view it on GitHub
#43 (comment)
.

@richardghirst
Copy link
Owner

Oh, I don't have support for the B+ at the moment (should have shortly
though). I guess if it was working on the B+ for you, you must have used
the servod patch from Martin Habovštiak, see
#48

On Mon, Sep 21, 2015 at 2:29 PM, Richard Hirst richardghirst@gmail.com
wrote:

I'm on holiday at the moment so can't look at the code but maybe a problem
with it deciding which version of Pi it thinks it is running on. Didn't
have 33 pins on the original Pi. You could try to find that code and change
it to think it is always a Pi B+ as a short-term fix.
On 9 May 2015 9:15 pm, "luks3n" notifications@github.com wrote:

Hi, today I updated Raspian and also re-compiled ServoBlaster on my Pi
B+, and now when I execute a program that used to run just fine, I get
"Invalid pin number 33 in P1 pin list", the command I issued to run
ServoBlaster is "sudo servod --cycle-time=5000 --step-size=10 --min=1000us
--max=2000us --p1pins=13,18,33,40,7 ", really strange. Maybe some pin
mapping was changed?


Reply to this email directly or view it on GitHub
#43 (comment)
.

@lbaulig
Copy link

lbaulig commented Oct 1, 2015

The fix for Raspberry pi B+ is pretty easy, basically adding the missing pins to

static uint8_t rev2_p1pin2gpio_map[] = {
    DMY,    // P1-1   3v3
    DMY,    // P1-2   5v
    2,  // P1-3   GPIO 2 (SDA)
    DMY,    // P1-4   5v
    3,  // P1-5   GPIO 3 (SCL)
    DMY,    // P1-6   Ground
    4,  // P1-7   GPIO 4 (GPCLK0)
    14, // P1-8   GPIO 14 (TXD)
    DMY,    // P1-9   Ground
    15, // P1-10  GPIO 15 (RXD)
    17, // P1-11  GPIO 17
    18, // P1-12  GPIO 18 (PCM_CLK)
    27, // P1-13  GPIO 27
    DMY,    // P1-14  Ground
    22, // P1-15  GPIO 22
    23, // P1-16  GPIO 23
    DMY,    // P1-17  3v3
    24, // P1-18  GPIO 24
    10, // P1-19  GPIO 10 (MOSI)
    DMY,    // P1-20  Ground
    9,  // P1-21  GPIO 9 (MISO)
    25, // P1-22  GPIO 25
    11, // P1-23  GPIO 11 (SCLK)
    8,  // P1-24  GPIO 8 (CE0)
    DMY,    // P1-25  Ground
    7,  // P1-26  GPIO 7 (CE1)
};

there are already some forks of this project which do exactly that, but the fix for Raspberry Pi 2 apparently involves changing parameters of the PWM output hardware (register mapping).

@richardghirst
Copy link
Owner

Except that would let you specify pins on P1 above pin 26 on a rev 2 board,
which is not ideal. There are 3 configurations of gpio pins: boards with
just P1 with 26 pins, boards with a P1 of 26 pins and a P5 of 8(?) pins,
and boards with just a P1 of 40 pins.
On 1 Oct 2015 22:05, "luks3n" notifications@github.com wrote:

The fix for Raspberry pi B+ is pretty easy, just add the missing pins to

static uint8_t rev2_p1pin2gpio_map[] = {
DMY, // P1-1 3v3
DMY, // P1-2 5v
2, // P1-3 GPIO 2 (SDA)
DMY, // P1-4 5v
3, // P1-5 GPIO 3 (SCL)
DMY, // P1-6 Ground
4, // P1-7 GPIO 4 (GPCLK0)
14, // P1-8 GPIO 14 (TXD)
DMY, // P1-9 Ground
15, // P1-10 GPIO 15 (RXD)
17, // P1-11 GPIO 17
18, // P1-12 GPIO 18 (PCM_CLK)
27, // P1-13 GPIO 27
DMY, // P1-14 Ground
22, // P1-15 GPIO 22
23, // P1-16 GPIO 23
DMY, // P1-17 3v3
24, // P1-18 GPIO 24
10, // P1-19 GPIO 10 (MOSI)
DMY, // P1-20 Ground
9, // P1-21 GPIO 9 (MISO)
25, // P1-22 GPIO 25
11, // P1-23 GPIO 11 (SCLK)
8, // P1-24 GPIO 8 (CE0)
DMY, // P1-25 Ground
7, // P1-26 GPIO 7 (CE1)
};

there are already some forks of this project which do exactly that.


Reply to this email directly or view it on GitHub
#43 (comment)
.

@richardghirst
Copy link
Owner

Latest code in github should support Pi B+, Pi2, and 4.1 kernels.

@improti
Copy link

improti commented Oct 4, 2015

Thank you for merging the changes mate, much appreciated! And also for the whole thing, while we are at it!

I did migrate my code to https://github.com/sarfata/pi-blaster in the meantime, though. As I'm still using servoblaster on several old Pis: Is there the need for these two different projects? Have you guys been in contact and considered merging them into one? To me it seems that pi-blaster has some technical optimisations while servoblaster offers better configuration (via options instead of the need to modify the source and recompile). And it is a fork, so there should be much in common?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants