After 5 months doing other things, I'm back to trying
to use a BeagleBone Green + LCD Cape as a HAL-only
machine controller.

As before, I'm going to document my progress (or lack
thereof) in this thread.

The first thing I did today isn't really related to the task
at hand, but it is a convenience.  I had some issues getting
the BBG networking after 5 months of idle, and I really 
wanted to be able to run diagnostics on the bone.  But
lack of a keyboard prevents that.  So after I got it running
properly (mostly involved re-seating the SD card and
cables), I installed the "Florence" virtual keyboard.

sudo apt-get install florence

Now I can type (even if it is painfully slow).

Now to the real issue - a machine controller needs I/O.
I'm very familiar with HAL on the PC using for example
a parallel port.  Time to dive into the BeagleBone 
specific drivers.

I went to the machinekit Integrator's Manual
http://www.machinekit.io/docs/index-integrator/
Scrolled down to "drivers" and found a list that did
NOT include a Beaglebone GPIO driver.

I looked at the sample configs.  In 
~/machinekit/configs/ARM.BeagleBone.Xylotex/Xylotex.hal 
it seems like the appropriate driver might be hal_bb_gpio. 
So I copied the loadrt line from that sample config to my
HAL file:

~/grinder/grinder.hal
    # load RT components
    loadrt threads name1=servo period1=1000000
    loadrt siggen
    # load low-level drivers
    loadrt hal_bb_gpio output_pins=107,113,119,126,214 
input_pins=109,110,114,118,241

Trying it resulted in an insmod failure, and what seems
to be two more errors during the cleanup process:

    machinekit@beaglebone:~/grinder$ halrun -f grinder.hal
    msgd:0 stopped
    rtapi:0 stopped
    grinder.hal:5: insmod failed, returned -1:
    rtapi_rpc(): reply timeout
    See /var/log/linuxcnc.log for more information.
    halcmd: cant connect to rtapi_app: -1 (uri= 
uuid=a42c8c6b-4025-4f83-ba28-dad21114744a): rtapi_rpc(): reply timeout
    
    halcmd: the rtapi:0 RT demon is not running - please investigate 
/var/log/linuxcnc.log
    halcmd: the msgd:0 logger demon is not running - please investigate 
/var/log/linuxcnc.log
    halcmd: cant connect to rtapi_app: -1 (uri= 
uuid=a42c8c6b-4025-4f83-ba28-dad21114744a): rtapi_rpc(): reply timeout
    
    halcmd: the rtapi:0 RT demon is not running - please investigate 
/var/log/linuxcnc.log
    halcmd: the msgd:0 logger demon is not running - please investigate 
/var/log/linuxcnc.log
    machinekit@beaglebone:~/grinder$ 

The log file is unhelpful:

    Jul 31 17:15:34 beaglebone msgd:0: startup pid=28615 flavor=xenomai 
rtlevel=1 usrlevel=1 halsize=524288 shm=Posix gcc=4.9.2 version=unknown
    Jul 31 17:15:34 beaglebone msgd:0: ØMQ=4.0.5 czmq=2.2.0 protobuf=2.4.1 
libwebsockets=<no version symbol>
    Jul 31 17:15:34 beaglebone msgd:0: configured: sha=5257e28
    Jul 31 17:15:34 beaglebone msgd:0: built:      Jan 12 2016 15:11:16 
sha=5257e28
    Jul 31 17:15:34 beaglebone msgd:0: register_stuff: actual hostname as 
announced by avahi='beaglebone.local'
    Jul 31 17:15:34 beaglebone msgd:0: zeroconf: registering: 'Log service on 
beaglebone.local pid 28615'
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user accepting commands 
at ipc:///tmp/0.rtapi.a42c8c6b-4025-4f83-ba28-dad21114744a
    Jul 31 17:15:35 beaglebone msgd:0: zeroconf: registered 'Log service on 
beaglebone.local pid 28615' _machinekit._tcp 0 TXT 
"uuid=a42c8c6b-4025-4f83-ba28-dad21114744a" 
"instance=eb9f0aae-5763-11e6-be02-68c90bdea250" "service=log" 
"dsn=ipc:///tmp/0.log.a42c8c6b-4025-4f83-ba28-dad21114744a"
    Jul 31 17:15:35 beaglebone msgd:0: hal_lib:28620:rt memmapped gpio port 2 
to 0xb6673000, oe: 0xb6673134, set: 0xb6673194, clr: 0xb6673190
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user signal 7 - 'Bus 
error' received, dumping core (current dir=/home/machinekit/grinder)
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user  --- rtapi_app 
backtrace: ---
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user ERROR decoding 
backtrace: no debug info in ELF executable (-1)
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user ERROR decoding 
backtrace: no debug info in ELF executable (-1)
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user ERROR decoding 
backtrace: no debug info in ELF executable (-1)
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user ERROR decoding 
backtrace: no debug info in ELF executable (-1)
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app:28620:user  
--------------------
    Jul 31 17:15:35 beaglebone msgd:0: rtapi_app exit detected - scheduled 
shutdown
    Jul 31 17:15:37 beaglebone msgd:0: msgd shutting down
    Jul 31 17:15:37 beaglebone msgd:0: zeroconf: unregistering 'Log service on 
beaglebone.local pid 28615'
    Jul 31 17:15:37 beaglebone msgd:0: log buffer hwm: 0% (8 msgs, 796 bytes 
out of 524288)
    Jul 31 17:15:37 beaglebone msgd:0: normal shutdown - global segment detached

I think the first 8 lines of the log file are normal startup stuff.
Line 9 (hal_lib:28620:rt memmapped gpio....) seems to have been
generated by the loadrt attempt but doesn't give me any clues.
Line 10 (rtapi_app:28620:user signal 7....) seems to be rtapi_app
crashing and definitely doesn't give me any clues.
No indication of any messages from the hal_bb_gpio driver.

Googling hal_bb_gpio give NO documentation of any kind for
the driver.

I found the source on github, which included a commit from 
January 2015, where Charles changed the pin numbering from 
1xx and 2xx to 8xx and 9xx.  However, the Xylotex sample 
configuration (as shipped in early 2016) is still using the 1xx
and 2xx pin numbering scheme.  It looks like the Xylotex 
config wasn't updated when the pin numbering was revised
(and it also looks like it hasn't been tested since early 2015,
since that change should have broken the config).

I'm about 99.9% sure that I need to invoke the startup script
to deal with device trees and other hardware issues.  But the
startup script is also totally undocumented.

My plan was for this email chain to continue documenting
forward progress.  However, I'm very frustrated by the lack of
documentation for BeagleBone specific code that has been
added to machinekit.  I will continue trying to figure this out,
but I'm going to hit send in that hopes that someone can
help.


-- 
  John Kasunich
  [email protected]

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to