AbhraneelBera / wiringBone

Wiring/Arduino style library for BeagleBone Black Platform
25 stars 14 forks source link

Comparison to Userspace-Arduino #2

Open jadonk opened 9 years ago

jadonk commented 9 years ago

Have you compared against https://github.com/prpplague/Userspace-Arduino? Is there a reason you might have started from scratch?

AbhraneelBera commented 9 years ago

Yes, I have tested the Userspace-Arduino library and worked with it. It is a good library and it will work well for some basic applications. But there are certain shortcomings which led me to start from scratch.

  1. The Userspace-Arduino library uses the bacone cape overlay with which some limited number of pins from P8 and P9 headers can be used. Also it uses its own pin numbering which does not match with the numberings of P8 and P9 header pins. So everytime you write a program you will always have to refer to the pin mapping used by the library. Moreover, once the bacone cape overlay is loaded you can use a pin in only one mode (until you reboot). Whereas the wiringBone library uses the powerful beaglebone-universal-io overlays. In the UserPinConfig.h file you will just have to define which pin you want to use in which mode. The program will configure the overlay at run-time and the overlay will revert back to the default pin modes at program exit. This library also uses pin names (for example: P9_14) instead of pin numbers. So you don't have to remember any pin mapping while writing a code. Also you can access all the GPIOs on P8 and P9 header with this library.
  2. The UART library is non functional in Userspace-Arduino. Whereas the wiringBone library has a fully functional UART library which allows you to control any serial device present, even the Gadget Serial and bluetooth serial, with standard arduino functions. The "termios" structure from "termios.h" in linux kernel only allows a fixed number of baud rates for serial devices. But I have implemented the library with the new "termios2" structure which allows you to use a serial port with any baud rate.

Some features that are only available with wiringBone :

  1. The wiringBone library uses an auto clean-up feature. The basic idea is, if the program is using a pin then that pin should be restored back to its previous state after program termination. When you stop the program using ctrl+c it will reset all the GPIOs being used, turn off PWM outputs, unexport the GPIO and PWM pins being used and configure the overlay back to default states.
  2. The wiringBone library has a failsafe feature for the PRU output pins. If the host processor hangs then the PRU will automatically go to failsafe mode and will generate a pre-configured PWM signal.
  3. The wiringBone library can capture input pulse trains and return its pulse width with the help of pulseIn() function. There are other advanced functions also which returns other useful information about the captured pulses.

There are several other minor differences in the behaviour of Userspace-Arduino and wiringBone. To summarize I will say that for basic applications the Userspace-Arduino will work fine. But wiringBone may be used for both basic and advanced applications which may involve a lot of i/o devices to be interfaced and control them easily with standard Arduino functions.

jadonk commented 9 years ago

Thanks!!! It would be great to incorporate these notes in the README.md.

AbhraneelBera commented 9 years ago

Welcome!! I had already explained the features of this library in detail in the previous commit. I have added some more points and updated the README.md .