B4J Library pigpio for b4j

pigpio is a library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO). pigpio works on all versions of the Pi.

I have use i2c(example), spi


get DIO hat use I2C and write text to I2c LCD

breadpi
 

Attachments

  • pigpiod.rar
    13.3 KB · Views: 212
  • breadpi_i2c.rar
    47.3 KB · Views: 188
Last edited:

max123

Well-Known Member
Licensed User
Longtime User
I admit that not already tried it. For sure I will try it when have some time.

In future I want to try control stepper motors with a driver like this directly from Raspberry.
DRV8825 Stepper Motor Driver

Because I want to control 4 and more stepper motors in the same time (controlling a 3D Printer and CNC machine)
and here need an high resolution GPIO control around 10 us resolution, I need to explore more solutions.

Probably require interrupts or something sophysticated like control any stepper motor on a different thread.

What is best suitable to do it for your opinion ? Pi4J or PIGPIO ?

Thanks
 
Last edited:

jinyistudio

Well-Known Member
Licensed User
Longtime User
I admit that not already tried it. For sure I will try it when have some time.

In future I want to try control stepper motors with a driver like this directly from Raspberry.
DRV8825 Stepper Motor Driver

Because I want to control 4 and more stepper motors in the same time (controlling a 3D Printer and CNC machine)
and here need an high resolution GPIO control around 10 us resolution, I need to explore more solutions.

Probably require interrupts or something sophysticated like control any stepper motor on a different thread.

What is best suitable to do it for your opinion ? Pi4J or PIGPIO ?

Thanks
Pigpio uses sockets, so the response time is long. You may need to use C language or similar to achieve the 10us you want.
 

max123

Well-Known Member
Licensed User
Longtime User
Thanks for reply, even jPi4J is too slow to archieve this timing ?

The only solution is to build the full project directly on C language, compilers like cMake and similar ...
... and abandon completely the idea to develop it on B4J with GUI interface and great development tool ?

Here a relevant discussion where author of PIGPIO replied, see 5 us, but probably
under C or C++ enviroment, and this is not strictly related to GPIO output togling a pin:

what time resolution can I get with raspberry ??

Fri Jan 26, 2018 6:19 pm
Hi
:P

can any body help me
:cry:

I need to know what is the best time resolution I can get with the raspberry pi to measure the time difference between two events on GPIO pins
can I get a nanosecond resolution or that is impossiable with the raspberry
can I use the CPU clock to measure the time difference
I have raspberry pi 3 model B
User avatar
joanPosts: 16079Joined: Thu Jul 05, 2012 5:09 pmLocation:UK

Re: what time resolution can I get with raspberry ??

Fri Jan 26, 2018 8:31 pm
If you program in bare metal (that is without an operating system) you might be able to get into the tens of nanoseconds region. You would need to ask on the bare metal forum for details of how it might be done, and if it is actually feasible.

Under Linux (unless you write a kernel driver) you are looking at the hundreds of nanoseconds region.

If you do busy spin polling of the GPIO you might be able to resolve down to 250 nanoseconds or so.

If you use (my) pigpio you should be able to get to within +/- 5 µs fairly easily.

If you use interrupts you will probably be in the +/- 50 µs region.
 
Last edited:

jinyistudio

Well-Known Member
Licensed User
Longtime User
Thanks for reply, even jPi4J is too slow to archieve this timing ?

The only solution is to build the full project directly on C language, compilers like cMake and similar ...
... and abandon completely the idea to develop it on B4J with GUI interface and great development tool ?

Here a relevant discussion where author of PIGPIO replied, see 5 us, but probably
under C or C++ enviroment, and this is not strictly related to GPIO output togling a pin:
In terms of jpi4j, you can experiment to see if you can output the step you want stably and at high speed. Sorry I don't have experience with this kind of application so I can't give you advice :)
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
Thanks for reply, even jPi4J is too slow to archieve this timing ?

The only solution is to build the full project directly on C language, compilers like cMake and similar ...
... and abandon completely the idea to develop it on B4J with GUI interface and great development tool ?

Here a relevant discussion where author of PIGPIO replied, see 5 us, but probably
under C or C++ enviroment, and this is not strictly related to GPIO output togling a pin:

https://abyz.me.uk/rpi/pigpio/cif.html This is pigpio's website. There is also a C library with more functions than jpi4j, you can study to see if it is suitable
 

max123

Well-Known Member
Licensed User
Longtime User
Yes, need to be tested.
 
Top