Are the GPIO pins on a Raspberry Pi accessible from gForth? - gpio

I am building a robot and want to use gForth to develop the software. I am unable to tell, after looking through the manual and searching on the web, whether or not the GPIO pins can be changed from within gForth running on a Raspberry PI 2. In Python there is the GPIO library that gets imported. But, I see no provision for that in gForth.
Has anyone had success in doing this from gForth? Your help is greatly appreciated.

This might be a little late, but here's what I do. I access the port using the /sys/class/gpio/ file structure. It means using the EXPORT file, the DIRECTION file and the VALUE file. It works perfectly.
Let me know if you need more info.

Related

STM MP157C DK2 Is Node.js possible?

Currently i am running a Raspberry PI and STM32 in a project and i was looking into the MP1 to replace it with. As its an easier setup.
I am running a node.js application on the raspberry and I am trying to get that application to run on the MP1. I have tried to follow the tutorials from stm32 but doesnt help that much. Has anyone done anything like this? I know the microcontroller is new as it has been released in Oktober.
I know its a broad question. But anything helps as i cant find a lot about it.
Thanks
If you run an embedded OS like Embedded Linux or RTOS on the ARM you can run node.js and see https://elinux.org/images/1/14/Karagoz-nodejs-presentation_0.pdfhttps://stackoverflow.com/questions/44753321/is-it-possible-to-run-node-js-on-an-rtos. On a completely bare metal machine it may also be possible however this is very effortful to implement a JavaScript runtime like it was done for the ESP32-WROVER module (https://www.neonious.com/lowjs/)
You can implement websockets also in C/C++ that can run on bare metal ARM see https://github.com/zaphoyd/websocketpp

How to add splash screen on custom linux(specially raspberry pi)

I currently have a project so basically what i want is to create an embedded linux in raspberry pi. What i want to achieve is to boot my custom made linux in my raspberry pi. I'm currently using Buildroot for that.
Here are the things what i want to happen:
Create a splash screen(How to implement this? What are the files on linux needed to edit. )
Override login prompt after booting(I want to use my own prompt which is i already created using python. What i want here is after booting my python app will be the first one to display)
Display my python application after booting.
WHAT files/configurations i need to know.
HOW to implement this. Process or a work flow.
Just like osmc or kido but i want to build my own also from scratch. Any help will be appreciated.
There are multiple components involved in splash screen. One is what you can display when u-boot starts and then the kernel takes over. You can get some information here and here. Both require re compilation of u-boot and Linux kernel. May be even some more additional steps depending on system. Also note this transition is not going to be smooth, between the logo displayed by u-boot and then the kernel.
On desktops, this is generally taken care of by software like Plymouth.
From what I understand, you want your python application to auto start after booting. Have a look at writing a systemd service for that as described here.

Using 7" TouchScreen Cape on Beaglebone Black

So, im developing an robotics application that uses a BeagleboneBlack as a controller for 3 different servos.
I know how to access the pins and everything from Cloud9 IDE directly into the board.
However, im using a 7" cape ( 4d Systems, 4DCAPE-70T ) and when i connect them, Debian automatically starts up.
I guess my question is, how do you code an app with a UI that can be accessed from the Debian distro directly from the 7" screen?
All my research has lead me to a final decision, which is mounting a node.js server on the bbb and making an HTML interface and with the bonescript libs, access the pins.
Has anybody done anything similar to this?
If anybody has a another approach to this, that would be great
If any time traveller out there stumbles upon this question, here is how i figured it out:
1) Get rid of bonescript. It will give you a hard time assigning pins for PWM and some other uses. Instead, use octalbonescript. reference to repo
2) Install socket.io
try and start a local server with it. Follow various tutos out there. If you run into a boot-up error regarding the server, use port 8090.
3) Design a web page that connects to a local host ( beaglebone itself) using socket.io. Again, various tutos out there.
DONT TOUCH THE KERNEL, NOR THE FILE TREE. Its unnecesary.
4) Open that same web page on your beaglebone. That way, you dont need an internet connection or whatever. The javascript side of the web page will call the appropriate methods on the beaglebone through socket.io ( socket.emit() ).
Its important to understand that all the beaglebone-side instructions, such as pin access, pwm and such, are performed on the same file where the socket is made. The web page 'calls' this methods on the bbb.
5) Enjoy!
I was using it for a robotics project. We were building a delta robot controlled by the Beaglebone Black ( Rev C ). I am serious, start with what i am telling you, you will save a LOT of time.
Edit: Guess i forgot the most important part. The cape uses several of the pins, incluiding various PWM. Octalbonescript, as of this moment, does not support capes. It will, but not at the moment. So, dump the screen and use an ethernet cable to connect your beaglebone to the network. That way, you can access the interface from any device through a browser at beaglebone:8090. ( NOT beaglebone.local:8090 )

Auto login on BeagleBone White + Angstrom 3.2

I'd like to find a way to make my BeagleBone (white) Rev A6a autologin after being powered up. I'm using Angstrom with kernel 3.2.34, which uses systemd instead of innitab.
I've already seen some topics (like this question) with reference to modifications on some service files (like /etc/systemd/system/getty.target.wants/getty#tty1.service), but that only helped me partly: If I power/reset my BBone while keeping it connected via USB to my computer, it autologs as expected. But, if I just power the BBone with a wallwart (without any other connections), it doesn't seem to log in. At least I believe that's what is happening, as I have a program prepared to autorun after login and it only starts on the first case (with USB on).
I'd appreciate any help. Thanks.
Turned out that a RF module attached to my beaglebone was being powered via USB, and this module should be activated by my test program mentioned in the question. So, when I unplugged my BBone USB cable, I was actually separating its GND from the RF Module's ground.
In short, I just had to use the same source in the entire circuit and keep the autologin configuration explained in the topic I also mentioned in my question.
You could make your program a service and run after user instance of systemd.
Lets say you have a graphical.target in your /usr/lib/systemd/system then just put symlink to ../systemd-user#.target to /usr/lib/systemd/system/graphical.target.wants/system named like systemd-user#<your-user-name>.service.
This systemd-user#.service should containe ExecStart line like /usr/bin/systemd --user.
Then you'll have to add your application's service-file to /usr/lib/systemd/user.
More info is at http://www.freedesktop.org/software/systemd/man/systemd.html and http://www.freedesktop.org/software/systemd/man/systemd.unit.html

Bluetooth for ARM embedded linux

I'm struggling now for a few days to setup bluetooth services on an ARM embedded device running Linux. I'm using a bluetooth dongle connected via USB.
Let's start with the beginning. I had to compile myself all the required packages, and that means expat, dbus, zlib, libffi, glib, bluez-3.36-libs and bluez-3.36-utils (yeah 3.36, I know they're old but so is my cross-compiler), libopenobex-1.3, obexd-0.3, obexftp. Then I put the binaries and libs on the device. Also, bluetooth is enabled in kernel.
I'm able to activate the bluetooth using hciconfig hci0 up command, I can perform scan using hcitool scan, I can even ping with l2ping previously discovered devices.
What I want is to be able to transfer files between that ARM device and another bluetooth device using ftp protocol and here my problems begin.
Are these the only tools that I need?
After putting everything on the device, I turn on bluetooth using hciconfig hci0 up, then I start dbus daemon using dbus-launch and after these I try to start obexd. When I run dbus-launch, it prints the values for DBUS_SESSION_BUS_ADDRESS and some pid and next when I try to start obexd it asks me to set the DBUS_SESSION_BUS_ADDRESS. Is this normal because I read that you have to set this only for test purposes? What is the default (real) dbus session bus address? How should I properly configure dbus?
I tend to think that the problem is in the pairing process, when the two bluetooth devices are trying to authenticate. How can I do this from command line as this is all that I have (no GUI)?
Could you please present me the detailed step to follow in order to achieve my goal. I tried to learn more about them from the Internet and also I tried to find these steps online but I could not find what I need.
Could you please explain me the difference between obexd, obexd-client, obexd-server, obex-data-server, obexftp? Are they meant to be used together or they offer the same functionalities? I could not clarify this from their man pages.
I know this is a really long post with a lot of questions, but I don't have experience with bluetooth and I'm under time pressure to solve this. Any help would be kindly appreciated.
Many questions you raised, but will try to answer them :
Thatz pretty much everything you will need.
Why are you starting session bus ? Will not starting system bus help and hcid uses system bus( as far as i know ). You need to execute the cross-compiled obexd ( or any other utility) with correct parameters.
you can use simple-agent ( it is in tools dir in 3.36 release if i am not wrong ). In a non-gui mode ( simple-agent --default [ follower by your pincode ] ) will work.
Basically you will need to find a device ( do scan ), authenticate ( pair ) and then proceed with file transfer which will involve obex level request / response ( to put in simple words).
As much i know, initially obexftp / obex-push were the only standalone utilities that worked on top of openobex for file transfer. Obex-data-serer was developed as part of GSOC competition, which got included in major distros. obexd is the slimmer version of obex-data-server specifically designed for embedded usage and is closely integrated with hcid ( and bluetoothd later). Please use only one of the utilities and not all at same time.

Resources