Smart PWM generation for servos sync

Hi!

I’m working on a home-made (hard/soft) hexapod. For my tests, I’m using a dedicated board to drive the servos; this board is able to sync several servos, by driving them together so they start/stop at the same time. And I was thinking to use a RPi for the main code execution (framework entirely written in python/numpy).

But a friend told me about the BBB, and I found it amazing! These PRUs stuff is very impressive. I’m making tests with another friend’s board, and my python code is working fine on it.

The idea, now, is to replace the Veyron servo driver by using the BBB PRUs.

To deep into details, I need to generate 32 PWMs, and have a mecanism to make them vary together, in a synchronized way. Then, I need something to send the positionning command from linux to the low level code (a shared memory with a simple mailbox would be fine at first).

Questions is: do you think it is possible to do that? What do you suggest to implement it: using one PRU to make the PWMs, and the other one to manage the speed/synchro? Or all on the same PRU? Are there some restriction when using both PRUs?

Any advice is welcome, as I’m new to BBB and PRUs.

Thanks,

Frédéric

PS: I started to make simple tests using PRUSS, and all works fine. Compilation toolchain is very easy to deploy/use, thanks for the great job people done!

I think what you want to do is possible, but really depends largely on how fast you expect it to be. The PRUs have access to many pins on the board, a few of which can be accessed in a single cycle, if memory serves me correctly. Less than 32 total between both PRU’s I think.

For those who know much more than I on this subject to answer, I think you will have to provide a bit more information. At least how fast you expect your setup to be.

With that said however, I do not think the rPI can even come close to how fast this could be done on the BBB . . .

Thanks for your answer.

I think what you want to do is possible, but really depends largely
on how fast you expect it to be. The PRUs have access to many pins on
the board, a few of which can be accessed in a single cycle, if
memory serves me correctly. Less than 32 total between both PRU's I
think.

For those who know much more than I on this subject to answer, I
think you will have to provide a bit more information. At least how
fast you expect your setup to be.

Servos are driven with a 500µs-2500µs pulse width, every 20ms; the
pulse width gives the servo position (1500µs for neutral).

For the sync. variation, I don't know exactly what speed I use. I may
send a new position to all legs (18 servos) every 0.1s (I think I'm
limited by the python side, as I have to recompute all positions).

If we use 1000 intermediate points (which is huge), it will need a
refresh of pulses widths every 100µs, which allows thousands PRUs
intructions!

With that said however, I do not think the rPI can even come close to
how fast this could be done on the BBB . . .

Yes, the RPi solution way was to keep the Veyron servo controller,
which does the servo sync.

BTW, this board uses a stm32F103; don't know how fast it is compared
to PRUs...

PRUs are 200Mhz with many single cycle instructions

Here, this is a link for some resources.

http://elinux.org/Ti_AM33XX_PRUSSv2

My knowledge of the PRUs is rather limited, and I’d hate to give you bad information. That link has external resource links where you can find lots of projects / information.

The “TRM” ( technical reference manual ) will probably be a big help.

I do not know a lot about ST micro MCUs, but on the outside it seems to be slower than a single PRU. At 72Mhz. But sometimes operating frequency does not mean everything . . .

Hi,

I just wanted to say that my code is working :o) There are still things to
do, but the PRU are fast enough to do the job. My first code uses the 2
PRUs, as described above, but I'm re-writing it will fit in 1 PRU.

For the host-PRU com., using PRU Data Memory is enough and works fine.

I now have to design the cape to plug my servos ;o)

BTW, code is here:

    https://github.com/fma38/BeagleBone/tree/master/servos