Monday, October 21, 2013

Configuring Multiple Home Switches on LCNC

Back in July, I showed how to configure a home switch with a BeBoPr board.  That blog post is a bit out of date now, as Charles has integrated many of the needed changes (including additions to the device tree config and setup.sh) into the main MachineKit branch.  Nice!

Still, you need to modify the default configuration a bit, and that post only showed how to set up a single axis.  This post will show how to configure multiple home switches in a few ways:

  • Axis-at-a-time: press the home key for each axis.  Common on machine tools; homing each axis separately avoids crashing a milling head into a vise or workpiece.
  • Sequential: each axis moves until it presses a home switch, in turn.  Common with 3D printers; the Z axis is typically homed last, so that the hotend doesn't scratch up the print surface.
  • Combined: all axes moves simultaneously, until each one hits the switch. Necessary with delta robot 3D printers, where moving just one axis might smash the head into one of the tower.  
You can follow the full explanation, or just skip to the bottom section and pull in the config changes for combined homing.

Saturday, October 19, 2013

Hung Task Bug in Xenomai Kernel

Thanks to Ralf Roesch, some glitches I had been writing off to bad SD cards have been shown to be a significant bug in the Xenomai patched kernel for the BeagleBone.  The symptom is the kernel hangs and prints a message similar to the following:

[26160.894920] INFO: task mmcqd/0:74 blocked for more than 60 seconds.
[26160.901577] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[26160.909811] mmcqd/0         D c0699e08     0    74      2 0x00000000
[26160.916607] [] (__schedule+0x5b8/0x774) from [] (schedule_timeout+0x1c/0x21c)
[26160.925943] [] (schedule_timeout+0x1c/0x21c) from [] (wait_for_common+0x130/0x170)
[26160.935718] [] (wait_for_common+0x130/0x170) from [] (mmc_wait_for_req_done+0x1c/0x74)
[26160.945851] [] (mmc_wait_for_req_done+0x1c/0x74) from [] (mmc_start_req+0x50/0x158)
[26160.955712] [] (mmc_start_req+0x50/0x158) from [] (mmc_blk_issue_rw_rq+0xa4/0x348)
[26160.965485] [] (mmc_blk_issue_rw_rq+0xa4/0x348) from [] (mmc_blk_issue_rq+0x3fc/0x450)
[26160.975624] [] (mmc_blk_issue_rq+0x3fc/0x450) from [] (mmc_queue_thread+0xa0/0x104)
[26160.985481] [] (mmc_queue_thread+0xa0/0x104) from [] (kthread+0xa0/0xb0)
[26160.994345] [] (kthread+0xa0/0xb0) from [] (ret_from_fork+0x18/0x38)
[26161.002875] Kernel panic - not syncing: hung_task: blocked tasks
[26161.009184] [] (unwind_backtrace+0x0/0xe0) from [] (panic+0x84/0x1e0)
[26161.017756] [] (panic+0x84/0x1e0) from [] (watchdog+0x1d4/0x234)
[26161.025866] [] (watchdog+0x1d4/0x234) from [] (kthread+0xa0/0xb0)
[26161.034065] [] (kthread+0xa0/0xb0) from [] (ret_from_fork+0x18/0x38)
[26161.042529] drm_kms_helper: panic occurred, switching back to text console

To 'tickle' this bug, all you have to do is boot, get to a console prompt, and run:

grep TestConfig /usr -r

There's a thread over on the Xenomai list about this issue, and it looks like it's a problem with the interrupt code for the am335x MMC or DMA driver (the MMC code makes heavy use of DMA).  I'm not sure how long it will take to track down this bug, or if I'll be able to recruit any help from TI or elsewhere.

NOTE:  You can still use LinuxCNC on the BeagleBone, as this issue doesn't really show up that often (I've done overnight prints and had systems run fine for a couple weeks straight), but it is definitely something that needs to get fixed.

UPDATE: I initially figured this was probably an issue with the TI code for the AM335x mmc controller, but it looks like it could possibly be an actual kernel bug based on the following very similar issue:
UPDATE 2013.10.29: Thanks to tireless efforts by Ralf Roesch, it looks like this is probably fixed.  Ralf identified a 3.12 kernel commit 7472bab236bdee1173412585591329e718f4d324 that seems to resolve this issue for both xenomai patched and 'plain' kernels.  I am still testing, but everything looks good so far.  I have checked in updates to my linux-dev project and expect to make new MachineKit images with updated kernels soon.

Sunday, October 13, 2013

BeagleBoard 3D Printer and CNC Capes

The BeagleBone is rapidly becoming a key player in the CNC and (I hope) 3D Printing space.  Don't believe me?  Just check out the list of 3D, CNC, and motion control capes I threw together.  It turned out to be a *LOT* longer than expected!  Even better, most of these will work out-of-the-box with my existing MachineKit version of LinuxCNC.  Support for the Replicape will need some programming (it requires working I2C and SPI for proper operation, not just twiddling I/O pins), which will probably happen as soon as I can either buy a board or someone sends me one (hint-hint).


If I missed anything, you notice any goofs, or if you have more details on any of the boards (including YouTube "Action Videos" or similar!) please let me know.

Thursday, October 10, 2013

Bridge Boards Arrive!

Look what came in the mail:



After a long wait (which was sort of the point of ordering boards to have available for sale in the first place), 4-and-10 BeBoPr Bridge board sets finally arrived in the mail!

For those of you who have sent me money, I will be mailing your boards out tomorrow (Friday, Oct. 11).  If you are interested in purchasing a set, let me know.  Prices are in my previous post, and are quite reasonable (you actually save both money and time!).

Now buy some from me so I don't regret deciding to sell them at cost!  :-)

Tuesday, October 1, 2013

BeBoPr Support Forums

Bas, creator of the BeBoPr board, has a new support forum for the BeBoPr boards online.  Hopefully this will become a great resource for anyone using a BeBoPr board with the BeagleBone.  Note that I generally prefer e-mail lists over forums, so while I intend to monitor the BeBoPr forums, don't hesitate to "nudge" me (forum username: cdsteinkuehler) via direct message if there's something you think I missed.

Also remember to monitor the BeBoPr wiki pages which have lots of details that haven't made it to the forums yet.

Finally, if you're interested in using a BeBoPr with a BeagleBone Black, I should soon have stock of a quantity of the Bridge Boards (which let you use the HDMI interface to run stand-alone) if you don't want to order 3 (or more) direct from OSH Park or mill them yourself, or you can get the BeBoPr+ boards (with the Bridge included) direct from Bas.