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

Raspberry Pi 2 Incompatibility #33

Closed
maxjwalker opened this issue Feb 12, 2015 · 23 comments · Fixed by #38
Closed

Raspberry Pi 2 Incompatibility #33

maxjwalker opened this issue Feb 12, 2015 · 23 comments · Fixed by #38

Comments

@maxjwalker
Copy link

PI-Blaster is no longer compatible with the updated system image used since the release of the Raspberry Pi 2 http://direct.raspberrypi.org/forums/viewtopic.php?t=99115&p=690599

@phueper
Copy link

phueper commented Feb 13, 2015

According to the above link the DMA base hase moved from 0x20000000 to 0x3f000000

i tried to change that in pi-blaster.c :

-#define DMA_BASE 0x20007000
+#define DMA_BASE 0x3f007000
#define DMA_LEN 0x24
-#define PWM_BASE 0x2020C000
+#define PWM_BASE 0x3f20C000
#define PWM_LEN 0x28
-#define CLK_BASE 0x20101000
+#define CLK_BASE 0x3f101000
#define CLK_LEN 0xA8
-#define GPIO_BASE 0x20200000
+#define GPIO_BASE 0x3f200000
#define GPIO_LEN 0x100
-#define PCM_BASE 0x20203000
+#define PCM_BASE 0x3f203000
#define PCM_LEN 0x24

recompiled, but GPIOs / PWM still does not seem to work

@phueper
Copy link

phueper commented Feb 13, 2015

maybe also worth to follow this: richardghirst#43

@phueper
Copy link

phueper commented Feb 23, 2015

richardghirst seems to have fixed servoblaster (see comment in the above bug), he is now using mailbox commands to request memory and some more changes as far as i can see... i am not sure how easy it is to adapt to pi-blaster... the mailbox files look like they are open source from Broadcom so the could be copied to pi-blaster as well... then the different membases would need to be used in pi-blaster i guess...

@Keridos
Copy link

Keridos commented Feb 23, 2015

Servoblaster is the original repository this is a fork of as far as I know and it had no commit in the past 12 months, so how should that be more up to date than this?

@phueper
Copy link

phueper commented Feb 23, 2015

In case anyone cares... i started adapting richardghirsts changes mentioned above from http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=99115&p=699651#p699651 to pi-blaster...
not quite ready for a pull request yet (printf debugging ;)) but the diff is here:
phueper/pi-blaster@sarfata:master...master

I just got my first pi-blaster PWM signal on my Pi 2 using that code... it did not seem very stable but that may be due to me adding -g to CFLAGS and maybe other problems...

I did not try the code on my Pi 1 B+ either... will do so in the next days and maybe post updates.

@phueper
Copy link

phueper commented Feb 24, 2015

I tested my current state on my Pi 1 B+ and Pi 2... it is generating a PWM Signal on both, however i can currently see 2 issues:

  • on Pi 1 the Frequency is correct at 100 Hz on my scope, on the Pi 2 however, the cycles are much shorter and the frequency on the scope is shown as 1.7 kHz
  • the code is not restartable, when i have started pi-blaster already it seems to hang in mem_alloc on the second start (at least on Pi 2, not verified on Pi 1 yet)

So... still some work left ;)

@sarfata
Copy link
Owner

sarfata commented Mar 3, 2015

@phueper Thanks for working on this and sharing the result.

@Keridos This code has seen little commits because we did not need them ;) I do not have a Raspberry Pi 2 so I have not been able to try this out yet. I would be happy to review and merge a pull-request when @phueper gets it working.

@phueper
Copy link

phueper commented Mar 3, 2015

i didn't have a lot of time lately... still working on it though... and having fun :) my guess is that something is wrong in the setup of the PWM/CLK/DMA Registers but i haven't figured it out... with servoblaster the frequency on Pi2 is ok so i must be missing something... i'll keep you updated, maybe i'll find some time this weekend

@fcakinci
Copy link

@phueper Any news on the Pi 2 issue?

@kboyington
Copy link

Any news? I just got a PI2 and am looking forward to this!

@phueper
Copy link

phueper commented Mar 19, 2015

Sorry... family kept me busy the last few weeks... I am planning to work on
it this weekend... from what i found so far the clocking setup seems to be
ok, i suspect something wrong in the DMA engine causing the frequency to be
too high... but i havent found it yet... the current state in my fork is
still the most up-to-date code i have :(

On Thu, Mar 19, 2015 at 2:57 AM, kboyington [email protected]
wrote:

Any news? I just got a PI2 and am looking forward to this!


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

@Cap-n-Proud
Copy link

Really appreciate your efforts and hope you will find some time to fix it: the life of many robots depend on this :)

@kboyington
Copy link

@phueper Thanks for the update! Enjoy the weekend! Looking forward to the next commit!

@phueper
Copy link

phueper commented Mar 24, 2015

Still no good news, sorry...

The problem still is that the frequency of the PWM is too high (~1kHz) the
Duty Cycle is correct so my current suspiciion is that the DMA Control
Blocks are setup ok, but something with the clocking setup does not work...
since it did work in the PI1 last time i checked i probably have some
offset for the clk/pwm registers wrong but i cant figure it out...

I will checkin my current code into my repo with lots of debugging in case
someone wants to take a look and will continue to investigate.

Regards, Pattrick

On Sun, Mar 22, 2015 at 3:09 AM, kboyington [email protected]
wrote:

@phueper https://github.com/phueper Thanks for the update! Enjoy the
weekend! Looking forward to the next commit!


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

@phueper
Copy link

phueper commented Mar 26, 2015

Hi,

FINALLY... some good news... i think i have figured out the problem i had... wrong calculation of the wait trigger address for the DMA... i need to cleanup the code a little bit... probably will checkin a version sometime later today

Regards, Pattrick

@phueper
Copy link

phueper commented Mar 26, 2015

I committed the fix into https://github.com/phueper/pi-blaster

The code only worked by chance on the Pi1 since the Pi1, the calculation of the phys_fifo_addr was wrong.

I am not quite ready for a Pull Request, some debug printfs need to be removed and i would also like to test the code on my Pi1... but if anyone wants to try the current state it should be working on Pi2 now... any feedback is appreciated

Regards, Pattrick

@fcakinci
Copy link

Thank you very much. I will test it on Pi2 as soon as possible.

@phueper
Copy link

phueper commented Mar 27, 2015

Quick Test on my Pi1 indicates that it is also still working on Pi1... so here comes the Pull Request

@radjkarl
Copy link

Hi,
thank you very much for this great package!

I found 2 issues playing with phueper's fork:

  1. I have a python program to control 5 leds via PWM

  2. to access them i execute 'echo [port]=[val]...'

  3. at the end all ports released
    however, after executing the program 2 times the leds remain dark

    if i start ./pi-blaster i get the following output:

    Failed to create mailbox device

    pi-blaster stopped

  4. At the end of the boot process i start the xserver with a Qt-based application.
    If pi-blaster is installed the desktop remains black.
    As soon as I uninstall pi-blaster I get the Qt-Application back.

My ugly workaround for both problems is at the moment to install and uninstall pi-blaster (sudo make (un)install) everytime i start my application.

Cheers,
Karl

@phueper
Copy link

phueper commented Mar 28, 2015

Hi,

Thanks for testing...

The "failed to create mailbox device" message is maybe because you didn't
start pi blaster with sudo?

I have not tried running with X, but others have reported problems with
pi-blaster and X as well... Will try to investigate.

Cheers, Pattrick
Am 28.03.2015 21:52 schrieb "Karl Bedrich" [email protected]:

Hi,
thank you very much for this great package!

I found 2 issues playing with phueper's fork:

  1. I have a python program to control 5 leds via PWM

  2. to access them i execute 'echo [port]=[val]...'
    3.

    at the end all ports released
    however, after executing the program 2 times the leds remain dark
    if i start ./pi-blaster i get the following output:

    Failed to create mailbox device
    pi-blaster stopped
    4.

    At the end of the boot process i start the xserver with a Qt-based
    application.
    If pi-blaster is installed the desktop remains black.
    As soon as I uninstall pi-blaster I get the Qt-Application back.

My ugly workaround for both problems is at the moment to install and
uninstall pi-blaster (sudo make (un)install) everytime i start my
application.

Cheers,
Karl


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

@phueper
Copy link

phueper commented Mar 31, 2015

I can confirm that X is not starting (screen remains dark) when pi-blaster is running... if i start pi-blaster after X everything seems to be OK.
I have no idea why this happens :(

@phueper
Copy link

phueper commented Mar 31, 2015

... i think i have an idea what the problem might be... expect an update today, maybe tomorrow...

@phueper
Copy link

phueper commented Mar 31, 2015

PR #38 updated... works for me now with startx while pi-blaster is running

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

Successfully merging a pull request may close this issue.

8 participants