How to use hal_pru_generic module

596 views
Skip to first unread message

euerka

unread,
Jul 20, 2016, 9:53:44 AM7/20/16
to Machinekit
Dear All,

I am trying to test pru with machinekit on Beaglebone Black. The issue is when i compile machinkit from source, I can not find pru_generic.bin in the whole system as this post(https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!searchin/machinekit/pru$20bin|sort:relevance/machinekit/WaLAhcWKoVU/t_JTv4leGkkJ).

My system is:
ubuntu@arm:~/linuxcnc/machinekit/src$ uname -a
Linux arm 4.1.28-bone-rt-r22 #1 PREEMPT RT Sun Jul 17 13:09:38 CST 2016 armv7l armv7l armv7l GNU/Linux


I thought my system have to do some correct setting before compile machinekit. I did following tryings:
1. build and install  capemgr: v4.1.x+ refer to (https://eewiki.net/display/linuxonarm/BeagleBone+Black) and ( https://github.com/beagleboard/bb.org-overlays/blob/master/readme.md).  OK, and modprobe uio_pruss works well.

2.build and install AM335x PRU PACKAGE (https://github.com/beagleboard/am335x_pru_package).
   There is an error as below when i try this hello world test(http://mythopoeic.org/bbb-pru-minimal/) to  Enable the PRU
ubuntu@arm:~$ sudo sh -c "echo 'BB-BONE-PRU-01' > /sys/devices/platform/bone_capemgr/slots"
sh
: echo: I/O error
ubuntu@arm
:~$ dmesg
[84997.711528] bone_capemgr bone_capemgr: part_number 'BB-BONE-PRU-01', version 'N/A'
[84997.711559] bone_capemgr bone_capemgr: slot #5: override
[84997.711573] bone_capemgr bone_capemgr: Using override eeprom data at slot 5
[84997.711587] bone_capemgr bone_capemgr: slot #5: 'Override Board Name,00A0,Override Manuf,BB-BONE-PRU-01'

ubuntu@arm
:~$ cat /sys/devices/platform/bone_capemgr/slots
 
0: PF----  -1
 
1: PF----  -1
 
2: PF----  -1
 
3: PF----  -1


As I am understanding, I have to set my system compile environment correctly , then it is possible to build hal_pru_generic module.

I am appreciated that anyone can give any advise about how to check or set up system environment to build PRU?

Thanks in advance!

-chengxi

schoo...@btinternet.com

unread,
Jul 20, 2016, 10:57:51 AM7/20/16
to machi...@googlegroups.com
AFAIK   ./configure --with-platform-beaglebone
--
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 machinekit+...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

陈成细

unread,
Jul 20, 2016, 11:14:28 AM7/20/16
to schoo...@btinternet.com, machi...@googlegroups.com

‎Thanks for your reply. 
Yes, I did this configure , I can get hal_pru_generic.so, but there is no pru_generic.bin.

I think it is device tree and pasm issue. 
You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/qncQ_Dh7V9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.

Charles Steinkuehler

unread,
Jul 20, 2016, 4:21:40 PM7/20/16
to machi...@googlegroups.com
I'm traveling with limited internet, but the PRU binary should be
automatically built via the Submakefile:

https://github.com/machinekit/machinekit/blob/master/src/hal/drivers/hal_pru_generic/Submakefile

But I believe you have to build for the xenomai flavor to get the *.bin
file to build.

On 7/20/2016 10:14 AM, 陈成细 wrote:
>
> ‎Thanks for your reply.
> Yes, I did this configure , I can get hal_pru_generic.so, but there is no
> pru_generic.bin.
>
> I think it is device tree and pasm issue.
>
>
> *From: *schoo...@btinternet.com
> *Sent: *Wednesday, 20 July, 2016 23:57
> *To: *machi...@googlegroups.com
> *Subject: *Re: [Machinekit] How to use hal_pru_generic module
>
>
> AFAIK ./configure --with-platform-beaglebone
>
>
> On 20/07/16 14:53, euerka wrote:
>> Dear All,
>>
>> I am trying to test pru with machinekit on Beaglebone Black. The issue is when
>> i compile machinkit from source, I can not find pru_generic.bin in the whole
>> system as this
>> post(https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!searchin/machinekit/pru$20bin|sort:relevance/machinekit/WaLAhcWKoVU/t_JTv4leGkkJ
>> <%28https://groups.google.com/forum/?utm_source=digest&utm_medium=email#%21searchin/machinekit/pru$20bin%7Csort:relevance/machinekit/WaLAhcWKoVU/t_JTv4leGkkJ>).
>>
>> My system is:
>> |
>> ubuntu@arm:~/linuxcnc/machinekit/src$ uname -a
>> Linuxarm 4.1.28-bone-rt-r22 #1 PREEMPT RT Sun Jul 17 13:09:38 CST 2016 armv7l
>> armv7l armv7l GNU/Linux
>>
>> |
>>
>> I thought my system have to do some correct setting before compile machinekit.
>> I did following tryings:
>> 1. build and install capemgr: v4.1.x+ refer to
>> (https://eewiki.net/display/linuxonarm/BeagleBone+Black) and (
>> https://github.com/beagleboard/bb.org-overlays/blob/master/readme.md). OK, and
>> modprobe uio_pruss works well.
>>
>> 2.build and install AM335x PRU PACKAGE
>> (https://github.com/beagleboard/am335x_pru_package).
>> There is an error as below when i try this hello world
>> test(http://mythopoeic.org/bbb-pru-minimal/) to Enable the PRU
>> |
>> ubuntu@arm:~$ sudo sh -c "echo 'BB-BONE-PRU-01' >
>> /sys/devices/platform/bone_capemgr/slots"
>> sh:echo:I/O error
>> ubuntu@arm:~$ dmesg
>> [84997.711528]bone_capemgr bone_capemgr:part_number 'BB-BONE-PRU-01',version 'N/A'
>> [84997.711559]bone_capemgr bone_capemgr:slot #5: override
>> [84997.711573]bone_capemgr bone_capemgr:Usingoverrideeeprom data at slot 5
>> [84997.711587]bone_capemgr bone_capemgr:slot #5: 'Override Board
>> Name,00A0,Override Manuf,BB-BONE-PRU-01'
>>
>> ubuntu@arm:~$ cat /sys/devices/platform/bone_capemgr/slots
>> 0:PF-----1
>> 1:PF-----1
>> 2:PF-----1
>> 3:PF-----1
>>
>> |
>>
>> As I am understanding, I have to set my system compile environment correctly ,
>> then it is possible to build hal_pru_generic module.
>>
>> I am appreciated that anyone can give any advise about how to check or set up
>> system environment to build PRU?
>>
>> Thanks in advance!
>>
>> -chengxi
>> --
>> 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 machinekit+...@googlegroups.com
>> <mailto:machinekit+...@googlegroups.com>.
>> Visit this group at https://groups.google.com/group/machinekit.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> website: http://www.machinekit.io blog: http://blog.machinekit.io github:
> https://github.com/machinekit
> ---
> You received this message because you are subscribed to a topic in the Google
> Groups "Machinekit" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/machinekit/qncQ_Dh7V9s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> machinekit+...@googlegroups.com
> <mailto:machinekit+...@googlegroups.com>.
> 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 machinekit+...@googlegroups.com
> <mailto:machinekit+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/machinekit.
> For more options, visit https://groups.google.com/d/optout.
>

--
Charles Steinkuehler
cha...@steinkuehler.net

Michael Haberler

unread,
Jul 20, 2016, 4:23:38 PM7/20/16
to Charles Steinkuehler, machi...@googlegroups.com

> Am 20.07.2016 um 22:21 schrieb Charles Steinkuehler <cha...@steinkuehler.net>:
>
> I'm traveling with limited internet, but the PRU binary should be automatically built via the Submakefile:
>
> https://github.com/machinekit/machinekit/blob/master/src/hal/drivers/hal_pru_generic/Submakefile
>
> But I believe you have to build for the xenomai flavor to get the *.bin file to build.

right, the posix build does not do that
> To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.

Chen Cheng Xi

unread,
Jul 25, 2016, 7:52:55 AM7/25/16
to Charles Steinkuehler, Machinekit
Dear Charles,

Thanks for your hints. Yeah, you are right. I re-compile the kernel with xenomai flavor.
It automatically compile and generate  pru_generic.bin. But it seems other issue occurs as follows:
halcmd: loadrt hal_pru_generic prucode=/home/ubuntu/machinekit/rtlib/xenomai/pru_generic.bin pru=1 num_stepgens=3 num_pwmgens=1
<stdin>:2: insmod failed, returned -1:
rtapi_app_main(hal_pru_generic): -1 Operation not permitted

See /var/log/linuxcnc.log for more information.

Dmesg shows as below:
Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt prussdrv_init
Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt prussdrv_open
Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt hpg: ERROR: failed to initialize PRU
Jul 25 11:39:55 arm msgd:0: rtapi_app:1844:user rtapi_app_main(hal_pru_generic): -1 Operation not permitted
Now i just start to learn how to use PRU in BBB.
Thanks for any hints from anyone in advance!

-chengxi

Michael Haberler

unread,
Jul 25, 2016, 7:55:17 AM7/25/16
to Chen Cheng Xi, Charles Steinkuehler, Machinekit

> Am 25.07.2016 um 13:52 schrieb Chen Cheng Xi <crazyin...@gmail.com>:
>
> Dear Charles,
>
> Thanks for your hints. Yeah, you are right. I re-compile the kernel with xenomai flavor.
> It automatically compile and generate pru_generic.bin. But it seems other issue occurs as follows:
> halcmd: loadrt hal_pru_generic prucode=/home/ubuntu/machinekit/rtlib/xenomai/pru_generic.bin pru=1 num_stepgens=3 num_pwmgens=1
> <stdin>:2: insmod failed, returned -1:
> rtapi_app_main(hal_pru_generic): -1 Operation not permitted


sure you did a 'sudo make setuid' as per here: http://www.machinekit.io/docs/developing/machinekit-developing/ after the build?

>
> See /var/log/linuxcnc.log for more information.
>
> Dmesg shows as below:
> Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt prussdrv_init
> Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt prussdrv_open
> Jul 25 11:39:55 arm msgd:0: hal_lib:1844:rt hpg: ERROR: failed to initialize PRU
> Jul 25 11:39:55 arm msgd:0: rtapi_app:1844:user rtapi_app_main(hal_pru_generic): -1 Operation not permitted
> Now i just start to learn how to use PRU in BBB.
> Thanks for any hints from anyone in advance!
>
> -chengxi
>
> --
> 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 machinekit+...@googlegroups.com.

Chen Cheng Xi

unread,
Jul 25, 2016, 8:47:00 AM7/25/16
to Michael Haberler, Charles Steinkuehler, Machinekit
Thanks Michael for you join this discussion.

Yes, i did sudo make setuid. Otherwise i can not run halrun in command line.
By the way, i am wondering should i load any overlay device tree?
ubuntu@arm:/sys/devices/bone_capemgr.9$ cat slots
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
And i also buid universal io get from https://github.com/cdsteinkuehler/beaglebone-universal-io .

Sorry it is my first time to try pru.

-chengxi
--
Best regards!
陈成细
R&D Engineer
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.

Charles Steinkuehler

unread,
Jul 25, 2016, 7:27:15 PM7/25/16
to machi...@googlegroups.com
On 7/25/2016 7:46 AM, Chen Cheng Xi wrote:
> Thanks Michael for you join this discussion.
>
> Yes, i did sudo make setuid. Otherwise i can not run halrun in command line.
> By the way, i am wondering should i load any overlay device tree?
>
> ubuntu@arm:/sys/devices/bone_capemgr.9$ cat slots
> 0: 54:PF---
> 1: 55:PF---
> 2: 56:PF---
> 3: 57:PF---
> 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
> 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
>
> And i also buid universal io get from
> https://github.com/cdsteinkuehler/beaglebone-universal-io .
>
> Sorry it is my first time to try pru.

Yes, you will need to load a device tree overlay that enables the PRU
and configures the pins the way you want. You can do this using the
cape-universal overlay, an overlay for a specific cape, or with your
own custom overlay.

But if you don't enable the PRU via device-tree, the hal_pru_generic
driver won't be able to run.

--
Charles Steinkuehler
cha...@steinkuehler.net

Chen Cheng Xi

unread,
Jul 26, 2016, 10:16:32 AM7/26/16
to Charles Steinkuehler, Machinekit
Dear Charles,

I compile 3.8.13-xenomai kernel branch guided by https://eewiki.net/display/linuxonarm/BeagleBone+Black .

I have device tree automatically loaded as below:
ubuntu@arm:~$ cat /sys/devices/bone_capemgr.9/slots
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

Then i try to load cape-universal overlay, it will conflict with Bone-Black-HDMI.
[    1.626520] bone-capemgr bone_capemgr.9: slot #6: Requesting firmware 'cape-boneblack-hdmin-00A0.dtbo' for board-name 'Bone-Black-HDMIN', version '00A0'
[    1.640792] bone-capemgr bone_capemgr.9: slot #6: dtbo 'cape-boneblack-hdmin-00A0.dtbo' loaded; converting to live tree
[    1.652228] bone-capemgr bone_capemgr.9: slot #6: BB-BONELT-HDMIN conflict P8.45 (#5:BB-BONELT-HDMI)
[    1.661778] bone-capemgr bone_capemgr.9: slot #6: Failed verification
[    1.668513] bone-capemgr bone_capemgr.9: loader: failed to load slot-6 BB-BONELT-HDMIN:00A0 (prio 2)


 Then i try to unload 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI,
             sudo sh -c "echo '-5' > /sys/devices/bone_capemgr.9/slots"
but it faled.
ubuntu@arm:~$ sudo sh -c "echo '-5' > /sys/devices/bone_capemgr.9/slots"
[sudo] password for ubuntu:
Segmentation fault

 Dmesg
[  831.197663] Unable to handle kernel NULL pointer dereference at virtual address 0000001b
[  831.206185] pgd = de4b4000, hw pgd = de4b4000
[  831.210743] [0000001b] *pgd=00000000
[  831.214496] Internal error: Oops: 5 [#1] THUMB2
[  831.219216] Modules linked in: omap_rng g_ether libcomposite
[  831.225136] CPU: 0    Not tainted  (3.8.13-xenomai-r79 #1)
[  831.230871] PC is at omap_device_idle+0xa/0x38
[  831.235502] LR is at _od_runtime_suspend+0x15/0x18
[  831.240499] pc : [<c0020b02>]    lr : [<c0020b45>]    psr: 200e0033
               sp : df07bd58  ip : fffffffe  fp : 00000000
[  831.252473] r10: 00000000  r9 : c089d380  r8 : c089d380
[  831.257917] r7 : 00000000  r6 : c0020b31  r5 : df369610  r4 : 00000000
[  831.264722] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : df369600
[  831.271532] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment user
[  831.279153] Control: 50c5387d  Table: 9e4b4019  DAC: 00000015
[  831.285145] Process sh (pid: 1512, stack limit = 0xdf07a238)
[  831.291034] Stack: (0xdf07bd58 to 0xdf07c000)
[  831.295574] bd40:                                                       00000000 c0020b45
[  831.304104] bd60: 00000000 df369610 df369680 c02e75dd df369610 00000000 00000000 c02e78d1
[  831.312633] bd80: 00000000 df07a000 df07bda8 00000003 c08e8bdc df4acb88 c08a0c6c 00000000
[  831.321167] bda0: 00000000 df369610 00000000 df369680 00000000 df34d0a0 00100100 df0b2a18
[  831.329697] bdc0: beeea370 c02e8723 00000000 df369610 df369680 c00202c9 00000000 c02e51a1
[  831.338228] bde0: df369610 c02e75dd df369610 00000004 00000004 c02e7d2f df369610 00000004
[  831.346750] be00: df369680 00000000 df34d0a0 c02e7e63 00000006 df369610 c08df0e4 df049600
[  831.355283] be20: c08be738 c0431437 df369610 c02e2d31 c02e2d25 c02e1e9b df054ac0 df369644
[  831.363814] be40: df369610 c02e1ee5 00000000 df04963c df369610 c02e1bab 00000002 df369600
[  831.372334] be60: df369610 df095410 00000000 c02e085d df369600 df095400 00000000 c02e2f8d
[  831.380870] be80: df369600 c02e3121 df36bd40 c03ef2d9 df35aa54 df36bd40 df34d0d8 00200200
[  831.389399] bea0: df34d0d8 c03ef3b7 df054ac0 df34d050 00000001 df34d0a8 df0b2a10 df0b2a10
[  831.397923] bec0: df342018 c03ef673 df34d810 00000000 de4c2bd8 c02f238d df054ac0 df342020
[  831.406451] bee0: 00000005 de4c2bd8 de280000 c02f3539 c04e3f89 de4c2bec c08e6f08 22222222
[  831.414987] bf00: 22222222 22222222 00000000 c02f3351 de4c2bc0 de4c2bd8 df07bf80 df350c08
[  831.423514] bf20: c0532cc4 df0b2a18 beeea370 c02dfc2b 00000003 c0138df9 de31ce00 b6f32300
[  831.432047] bf40: 00000003 df07a000 df07bf80 00000003 00000000 c00f892b de48e680 c010211f
[  831.440569] bf60: df054ac0 00000000 00000000 de31ce00 00000000 b6f32300 00000003 c00f8b31
[  831.449104] bf80: 00000000 00000000 00000000 00000003 b6f32300 b6f2ed08 00000004 c000ca48
[  831.457628] bfa0: df07a000 c000c841 00000003 b6f32300 00000001 b6f32300 00000003 b6f2f034
[  831.466155] bfc0: 00000003 b6f32300 b6f2ed08 00000004 00000270 000001cc 00000000 beeea370
[  831.474690] bfe0: 00000000 beeea134 b6f161ff b6e781d6 20030030 00000001 00000000 00000000
[  831.483230] [<c0020b02>] (omap_device_idle+0xa/0x38) from [<c0020b45>] (_od_runtime_suspend+0x15/0x18)
[  831.492947] [<c0020b45>] (_od_runtime_suspend+0x15/0x18) from [<c02e75dd>] (__rpm_callback+0x1d/0x40)
[  831.502560] [<c02e75dd>] (__rpm_callback+0x1d/0x40) from [<c02e78d1>] (rpm_suspend+0xb5/0x428)
[  831.511537] [<c02e78d1>] (rpm_suspend+0xb5/0x428) from [<c02e8723>] (__pm_runtime_suspend+0x37/0x4c)
[  831.521079] [<c02e8723>] (__pm_runtime_suspend+0x37/0x4c) from [<c02e51a1>] (pm_generic_runtime_idle+0x1d/0x24)
[  831.531598] [<c02e51a1>] (pm_generic_runtime_idle+0x1d/0x24) from [<c02e75dd>] (__rpm_callback+0x1d/0x40)
[  831.541565] [<c02e75dd>] (__rpm_callback+0x1d/0x40) from [<c02e7d2f>] (rpm_idle+0x9f/0x150)
[  831.550278] [<c02e7d2f>] (rpm_idle+0x9f/0x150) from [<c02e7e63>] (__pm_runtime_idle+0x37/0x4c)
[  831.559272] [<c02e7e63>] (__pm_runtime_idle+0x37/0x4c) from [<c0431437>] (davinci_mcasp_remove+0x1b/0x28)
[  831.569249] [<c0431437>] (davinci_mcasp_remove+0x1b/0x28) from [<c02e2d31>] (platform_drv_remove+0xd/0x10)
[  831.579319] [<c02e2d31>] (platform_drv_remove+0xd/0x10) from [<c02e1e9b>] (__device_release_driver+0x3b/0x70)
[  831.589657] [<c02e1e9b>] (__device_release_driver+0x3b/0x70) from [<c02e1ee5>] (device_release_driver+0x15/0x20)
[  831.600265] [<c02e1ee5>] (device_release_driver+0x15/0x20) from [<c02e1bab>] (bus_remove_device+0x77/0x94)
[  831.610336] [<c02e1bab>] (bus_remove_device+0x77/0x94) from [<c02e085d>] (device_del+0x95/0xf0)
[  831.619410] [<c02e085d>] (device_del+0x95/0xf0) from [<c02e2f8d>] (platform_device_del+0xd/0x30)
[  831.628571] [<c02e2f8d>] (platform_device_del+0xd/0x30) from [<c02e3121>] (platform_device_unregister+0x9/0x14)
[  831.639107] [<c02e3121>] (platform_device_unregister+0x9/0x14) from [<c03ef2d9>] (of_overlay_device_entry_change.isra.0+0x35/0xd0)
[  831.651354] [<c03ef2d9>] (of_overlay_device_entry_change.isra.0+0x35/0xd0) from [<c03ef3b7>] (of_overlay_revert_one+0x43/0x174)
[  831.663318] [<c03ef3b7>] (of_overlay_revert_one+0x43/0x174) from [<c03ef673>] (of_overlay_revert+0x27/0x3c)
[  831.673487] [<c03ef673>] (of_overlay_revert+0x27/0x3c) from [<c02f238d>] (bone_capemgr_remove_slot_no_lock+0x5d/0xa8)
[  831.684556] [<c02f238d>] (bone_capemgr_remove_slot_no_lock+0x5d/0xa8) from [<c02f3539>] (slots_store+0x1e9/0x29c)
[  831.695258] [<c02f3539>] (slots_store+0x1e9/0x29c) from [<c02dfc2b>] (dev_attr_store+0xb/0x14)
[  831.704246] [<c02dfc2b>] (dev_attr_store+0xb/0x14) from [<c0138df9>] (sysfs_write_file+0xe5/0x10c)
[  831.713591] [<c0138df9>] (sysfs_write_file+0xe5/0x10c) from [<c00f892b>] (vfs_write+0x5f/0xf8)
[  831.722579] [<c00f892b>] (vfs_write+0x5f/0xf8) from [<c00f8b31>] (sys_write+0x29/0x4c)
[  831.730845] [<c00f8b31>] (sys_write+0x29/0x4c) from [<c000c841>] (ret_fast_syscall+0x1/0x46)
[  831.739645] Code: 4604 b108 f8d0 41c8 (7ee3) 2b01
[  831.751090] ---[ end trace 7406d7aaafe2fcfe ]---

Or 3.8.13-xenomai branch broken, because Robert Nelson remove this line from this website.

Actually i just want to try PWM through machinekit in BBB. Any ideas?

Thanks!
-chengxi

Charles Steinkuehler

unread,
Jul 26, 2016, 10:37:27 AM7/26/16
to machi...@googlegroups.com
On 7/26/2016 9:16 AM, Chen Cheng Xi wrote:
> Dear Charles,
>
> I compile 3.8.13-xenomai kernel branch guided by
> https://eewiki.net/display/linuxonarm/BeagleBone+Black .
>
> I have device tree automatically loaded as below:
>
> ubuntu@arm:~$ cat /sys/devices/bone_capemgr.9/slots
> 0: 54:PF---
> 1: 55:PF---
> 2: 56:PF---
> 3: 57:PF---
> 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
> 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
>
> Then i try to load cape-universal overlay, it will conflict with Bone-Black-HDMI.

Either disable the HDMI cape (with audio) or load the cape-universaln
that doesn't use the audio pins:

machinekit@beaglebone:~$ grep -C1 "^cape_disable" /boot/uEnv.txt
##Disable HDMI Audio
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI

machinekit@beaglebone:~$ cat /sys/devices/bone_capemgr.9/slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
7: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-universal
8: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-bone-iio

> Then i try to unload 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas
> Instrument,BB-BONELT-HDMI,|

You generally can't unload device-tree overlays, you have to reboot
and start over.

--
Charles Steinkuehler
cha...@steinkuehler.net

Chen Cheng Xi

unread,
Jul 29, 2016, 11:00:31 AM7/29/16
to Charles Steinkuehler, Machinekit
Thanks Charles,

As you advised, It seems work better, dmesg as follow:

Jul 29 14:14:15 arm rtapi:0: rtapi_app_main(hal_pru_generic): -1 Operation not permitted
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_init
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_open
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_pruintc_init
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_map_prumem
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt PRU data ram mapped
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_pwmgens : 1
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_stepgens: 3
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_encoders: 0
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt Init pwm
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg_pwm_init
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt Init stepgen
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg_stepgen_init
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pin_newfv:28 HAL error: length 49 invalid for name starting 'hal_pru_generic.stepgen.00.dbg_pos_minus_'
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg: stepgen 00: Error adding pin 'dbg_pos_minus_prev_cmd', aborting
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pru_generic: ERROR: failed to export stepgen 0: -12
Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg: ERROR: stepgen init failed: -1
Jul 29 14:14:15 arm msgd:0: rtapi_app:1414:user rtapi_app_main(hal_pru_generic): -1 Operation not permitted

It seems there is bugs in source code. I will try to figure it out.
Just for your update!

thanks!
-chengxi

 


--
Charles Steinkuehler
cha...@steinkuehler.net

You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/qncQ_Dh7V9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.

Michael Haberler

unread,
Jul 29, 2016, 11:03:03 AM7/29/16
to Chen Cheng Xi, Charles Steinkuehler, Machinekit

> Am 29.07.2016 um 17:00 schrieb Chen Cheng Xi <crazyin...@gmail.com>:
>
> Thanks Charles,
>
> As you advised, It seems work better, dmesg as follow:
>
> Jul 29 14:14:15 arm rtapi:0: rtapi_app_main(hal_pru_generic): -1 Operation not permitted
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_init
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_open
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_pruintc_init
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt prussdrv_map_prumem
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt PRU data ram mapped
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_pwmgens : 1
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_stepgens: 3
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt num_encoders: 0
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt Init pwm
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg_pwm_init
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt Init stepgen
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg_stepgen_init
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pin_newfv:28 HAL error: length 49 invalid for name starting 'hal_pru_generic.stepgen.00.dbg_pos_minus_'
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg: stepgen 00: Error adding pin 'dbg_pos_minus_prev_cmd', aborting
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pru_generic: ERROR: failed to export stepgen 0: -12
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hpg: ERROR: stepgen init failed: -1
> Jul 29 14:14:15 arm msgd:0: rtapi_app:1414:user rtapi_app_main(hal_pru_generic): -1 Operation not permitted
>
> It seems there is bugs in source code. I will try to figure it out.

Shorten the name 'hal_pru_generic' to say 'hpg'.

This has been discussed here many times. Please use the search function.

Is there any specific reason why you just cannot start from a known-to-work configuration?
> 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 machinekit+...@googlegroups.com.

schoo...@btinternet.com

unread,
Jul 29, 2016, 11:56:38 AM7/29/16
to machi...@googlegroups.com

On 29/07/16 16:00, Chen Cheng Xi wrote:
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pin_newfv:28 HAL
> error: length 49 invalid for name starting
> 'hal_pru_generic.stepgen.00.dbg_pos_minus_'

Please see Michael's recent post plus these 4 previous posts on the same

https://groups.google.com/forum/#!searchin/machinekit/length$2049$20invalid$20for$20name$20starting;context-place=searchin/machinekit/length$2049$20invalid$20for$20name$20starting$20$26$2339

You have to alias it hpg or similar or some of the pin names exceed the
buffer length

Chen Cheng Xi

unread,
Jul 30, 2016, 12:11:52 AM7/30/16
to schoo...@btinternet.com, Machinekit
Thanks, you are right. It seems almost work.
ubuntu@arm:~/machinekit$ halrun
msgd:0 stopped
rtapi:0 stopped

halcmd: loadrt hal_pru_generic prucode=/home/ubuntu/machinekit/rtlib/xenomai/pru_generic.bin pru=1 num_stepgens=3 num_pwmgens=1
<stdin>:1: module 'hal_pru_generic' not loaded

/var/log/linuxcnc.log as follow:

Jul 30 00:05:07 arm msgd:0: zeroconf: unregistering 'Log service on arm.local pid 1408'
Jul 30 00:05:07 arm msgd:0: log buffer hwm: 0% (17 msgs, 1215 bytes out of 524288)
Jul 30 00:05:07 arm msgd:0: normal shutdown - global segment detached
Jul 30 00:05:11 arm msgd:0: startup pid=4268 flavor=xenomai rtlevel=1 usrlevel=1 halsize=524288 shm=Posix gcc=5.4.0 20160609 version=unknown
Jul 30 00:05:11 arm msgd:0:  ^ MQ=4.2.0 czmq=3.0.3 protobuf=2.6.1 libwebsockets=1.5 4bc6f95
Jul 30 00:05:11 arm msgd:0: configured: sha=abfa33d
Jul 30 00:05:11 arm msgd:0: built:      Jul 27 2016 14:26:04 sha=abfa33d
Jul 30 00:05:11 arm msgd:0: register_stuff: actual hostname as announced by avahi='arm.local'
Jul 30 00:05:11 arm msgd:0: zeroconf: registering: 'Log service on arm.local pid 4268'
Jul 30 00:05:11 arm msgd:0: rtapi_app:4273:user accepting commands at ipc:///tmp/0.rtapi.a42c8c6b-4025-4f83-ba28-dad21114744a
Jul 30 00:05:11 arm msgd:0: zeroconf: registered 'Log service on arm.local pid 4268' _machinekit._tcp 0 TXT "uuid=a42c8c6b-4025-4f83-ba28-dad$
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt prussdrv_init
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt prussdrv_open
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt prussdrv_pruintc_init
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt prussdrv_map_prumem
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt PRU data ram mapped
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt num_pwmgens : 1
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt num_stepgens: 3
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt num_encoders: 0
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt Init pwm
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt hpg_pwm_init
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt Init stepgen
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt hpg_stepgen_init
Jul 30 00:05:29 arm msgd:0: hal_lib:4273:rt Init encoder


halcmd: show pin
Component Pins:
  Comp   Inst Type  Dir         Value  Name                             Epsilon         Flags
    73        s32   OUT             0  hpg.capture-position.time             0
    73        u32   IN     0x00000080  hpg.pru_busy_pin                      0
    73        bit   IN          FALSE  hpg.pwmgen.00.out.00.enable           0
    73        u32   IN     0x00000011  hpg.pwmgen.00.out.00.pin              0
    73        float IN              1  hpg.pwmgen.00.out.00.scale        0.0000100
    73        float IN              0  hpg.pwmgen.00.out.00.value        0.0000100
    73        u32   IN     0x00989680  hpg.pwmgen.00.pwm_period              0
    73        bit   IN          FALSE  hpg.stepgen.00.control-type           0
    73        s32   OUT             0  hpg.stepgen.00.counts                 0
    73        float OUT             0  hpg.stepgen.00.dbg_err_at_matc    0.0000100
    73        float OUT             0  hpg.stepgen.00.dbg_ff_vel         0.0000100
    73        float OUT             0  hpg.stepgen.00.dbg_pos_minus_p    0.0000100
    73        float OUT             0  hpg.stepgen.00.dbg_s_to_match     0.0000100
    73        s32   OUT             0  hpg.stepgen.00.dbg_step_rate          0
    73        float OUT             0  hpg.stepgen.00.dbg_vel_error      0.0000100
    73        u32   IN     0x00000064  hpg.stepgen.00.dirhold                0
    73        u32   IN     0x00000011  hpg.stepgen.00.dirpin                 0
    73        u32   IN     0x00000064  hpg.stepgen.00.dirsetup               0
    73        bit   IN          FALSE  hpg.stepgen.00.enable                 0
    73        float IN              1  hpg.stepgen.00.maxaccel           0.0000100
    73        float IN              0  hpg.stepgen.00.maxvel             0.0000100
    73        float IN              0  hpg.stepgen.00.position-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.00.position-fb        0.0000100
    73        float IN              1  hpg.stepgen.00.position-scale     0.0000100
    73        bit   IN          FALSE  hpg.stepgen.00.stepinvert             0
    73        u32   IN     0x00000064  hpg.stepgen.00.steplen                0
    73        u32   IN     0x00000011  hpg.stepgen.00.steppin                0
    73        u32   IN     0x00000064  hpg.stepgen.00.stepspace              0
    73        s32   OUT             0  hpg.stepgen.00.test1                  0
    73        s32   OUT             0  hpg.stepgen.00.test2                  0
    73        s32   OUT             0  hpg.stepgen.00.test3                  0
    73        float IN              0  hpg.stepgen.00.velocity-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.00.velocity-fb        0.0000100
    73        bit   IN          FALSE  hpg.stepgen.01.control-type           0
    73        s32   OUT             0  hpg.stepgen.01.counts                 0
    73        float OUT             0  hpg.stepgen.01.dbg_err_at_matc    0.0000100
    73        float OUT             0  hpg.stepgen.01.dbg_ff_vel         0.0000100
    73        float OUT             0  hpg.stepgen.01.dbg_pos_minus_p    0.0000100
    73        float OUT             0  hpg.stepgen.01.dbg_s_to_match     0.0000100
    73        s32   OUT             0  hpg.stepgen.01.dbg_step_rate          0
    73        float OUT             0  hpg.stepgen.01.dbg_vel_error      0.0000100
    73        u32   IN     0x00000064  hpg.stepgen.01.dirhold                0
    73        u32   IN     0x00000011  hpg.stepgen.01.dirpin                 0
    73        u32   IN     0x00000064  hpg.stepgen.01.dirsetup               0
    73        bit   IN          FALSE  hpg.stepgen.01.enable                 0
    73        float IN              1  hpg.stepgen.01.maxaccel           0.0000100
    73        float IN              0  hpg.stepgen.01.maxvel             0.0000100
    73        float IN              0  hpg.stepgen.01.position-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.01.position-fb        0.0000100
    73        float IN              1  hpg.stepgen.01.position-scale     0.0000100
    73        bit   IN          FALSE  hpg.stepgen.01.stepinvert             0
    73        u32   IN     0x00000064  hpg.stepgen.01.steplen                0
    73        u32   IN     0x00000011  hpg.stepgen.01.steppin                0
    73        u32   IN     0x00000064  hpg.stepgen.01.stepspace              0
    73        s32   OUT             0  hpg.stepgen.01.test1                  0
    73        s32   OUT             0  hpg.stepgen.01.test2                  0
    73        s32   OUT             0  hpg.stepgen.01.test3                  0
    73        float IN              0  hpg.stepgen.01.velocity-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.01.velocity-fb        0.0000100
    73        bit   IN          FALSE  hpg.stepgen.02.control-type           0
    73        s32   OUT             0  hpg.stepgen.02.counts                 0
    73        float OUT             0  hpg.stepgen.02.dbg_err_at_matc    0.0000100
    73        float OUT             0  hpg.stepgen.02.dbg_ff_vel         0.0000100
    73        float OUT             0  hpg.stepgen.02.dbg_pos_minus_p    0.0000100
    73        float OUT             0  hpg.stepgen.02.dbg_s_to_match     0.0000100
    73        s32   OUT             0  hpg.stepgen.02.dbg_step_rate          0
    73        float OUT             0  hpg.stepgen.02.dbg_vel_error      0.0000100
    73        u32   IN     0x00000064  hpg.stepgen.02.dirhold                0
    73        u32   IN     0x00000011  hpg.stepgen.02.dirpin                 0
    73        u32   IN     0x00000064  hpg.stepgen.02.dirsetup               0
    73        bit   IN          FALSE  hpg.stepgen.02.enable                 0
    73        float IN              1  hpg.stepgen.02.maxaccel           0.0000100
    73        float IN              0  hpg.stepgen.02.maxvel             0.0000100
    73        float IN              0  hpg.stepgen.02.position-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.02.position-fb        0.0000100
    73        float IN              1  hpg.stepgen.02.position-scale     0.0000100
    73        bit   IN          FALSE  hpg.stepgen.02.stepinvert             0
    73        u32   IN     0x00000064  hpg.stepgen.02.steplen                0
    73        u32   IN     0x00000011  hpg.stepgen.02.steppin                0
    73        u32   IN     0x00000064  hpg.stepgen.02.stepspace              0
    73        s32   OUT             0  hpg.stepgen.02.test1                  0
    73        s32   OUT             0  hpg.stepgen.02.test2                  0
    73        s32   OUT             0  hpg.stepgen.02.test3                  0
    73        float IN              0  hpg.stepgen.02.velocity-cmd       0.0000100
    73        float OUT             0  hpg.stepgen.02.velocity-fb        0.0000100
    73        s32   OUT             0  hpg.update.time                       0


It is quite strange that everything works well except this module load failed.





--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
--- You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/qncQ_Dh7V9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Michael Haberler

unread,
Jul 30, 2016, 9:40:32 AM7/30/16
to Chen Cheng Xi, schoo...@btinternet.com, Machinekit
this log is with default debug level 1 and truncated, and does not show any error.

run again like so:

export DEBUG=5
halrun ....
now post ALL of /var/log/linuxcnc.log (please via pastebin.com). No smart excerpts please.
where?

>
>
>
>
>
> On Fri, Jul 29, 2016 at 11:56 PM, schoo...@btinternet.com <schoo...@btinternet.com> wrote:
>
> On 29/07/16 16:00, Chen Cheng Xi wrote:
> Jul 29 14:14:15 arm msgd:0: hal_lib:1414:rt hal_pin_newfv:28 HAL error: length 49 invalid for name starting 'hal_pru_generic.stepgen.00.dbg_pos_minus_'
>
> Please see Michael's recent post plus these 4 previous posts on the same
>
> https://groups.google.com/forum/#!searchin/machinekit/length$2049$20invalid$20for$20name$20starting;context-place=searchin/machinekit/length$2049$20invalid$20for$20name$20starting$20$26$2339
>
> You have to alias it hpg or similar or some of the pin names exceed the buffer length
>
>
> --
> website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
> --- You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/qncQ_Dh7V9s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.
> Visit this group at https://groups.google.com/group/machinekit.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Best regards!
> 陈成细
> R&D Engineer
> (\__/)
> (='.'=) This is Bunny. Copy and paste bunny into your
> (")_(") signature to help him gain world domination.
>
> --
> 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 machinekit+...@googlegroups.com.

Chen Cheng Xi

unread,
Jul 31, 2016, 4:40:42 AM7/31/16
to Michael Haberler, schoo...@btinternet.com, Machinekit
Dear Michael,

I did export DEBUG=5. Full log as (http://pastebin.com/ySyz4eW3) .

Cammandline as below:

ubuntu@arm:~/machinekit$ halrun
msgd:0 stopped
rtapi:0 stopped
halcmd:  loadrt hal_pru_generic prucode=/home/ubuntu/machinekit/rtlib/xenomai/pru_generic.bin pru=1 num_pwmgens=1

<stdin>:1: module 'hal_pru_generic' not loaded
halcmd: exit
<commandline>:0: Realtime threads stopped
<commandline>:0: Realtime threads stopped
<commandline>:0: error unloading realtime module 'hpg': rc=-1
<commandline>:0: unload: 'hpg' not loaded

<commandline>:0: unloadrt failed

  And also i suspect that i change too many "hal_pru_generic" to "hpg". Because it shows unload
hal_pru_generic when i start to load this module, but when i exit , it shows "hpg" not loaded.
Thanks!

-chengxi

 

Michael Haberler

unread,
Jul 31, 2016, 2:42:10 PM7/31/16
to Chen Cheng Xi, schoo...@btinternet.com, Machinekit

> Am 31.07.2016 um 10:40 schrieb Chen Cheng Xi <crazyin...@gmail.com>:
>
> Dear Michael,
>
> I did export DEBUG=5. Full log as (http://pastebin.com/ySyz4eW3) .
>
> Cammandline as below:
>
> ubuntu@arm:~/machinekit$ halrun
> msgd:0 stopped
> rtapi:0 stopped
> halcmd: loadrt hal_pru_generic prucode=/home/ubuntu/machinekit/rtlib/xenomai/pru_generic.bin pru=1 num_pwmgens=1
> <stdin>:1: module 'hal_pru_generic' not loaded
> halcmd: exit
> <commandline>:0: Realtime threads stopped
> <commandline>:0: Realtime threads stopped
> <commandline>:0: error unloading realtime module 'hpg': rc=-1
> <commandline>:0: unload: 'hpg' not loaded
>
> <commandline>:0: unloadrt failed
>
> And also i suspect that i change too many "hal_pru_generic" to "hpg". Because it shows unload
> hal_pru_generic when i start to load this module, but when i exit , it shows "hpg" not loaded.
> Thanks!

I already suggested to start from a known-to-work config. Have a look at this one: https://github.com/machinekit/machinekit/blob/master/configs/ARM/BeagleBone/CRAMPS/CRAMPS.hal#L28

note the halname=hpg suffix

-m

Chen Cheng Xi

unread,
Aug 1, 2016, 11:22:36 AM8/1/16
to Michael Haberler, Machinekit
Yes, I am trying to start from a known-to-work configuration. It failed when load  device tree overlay.
...
Loading BB-LCNC-BEBOPR overlay
sudo: no askpass program specified, try setting SUDO_ASKPASS
Error loading device tree overlay file: BB-LCNC-BEBOPR
BeBoPr.hal:10: program './setup.sh' failed, returned 1

So when i try to manually load one by one. But i can get the same result as follow:

machinekit@beaglebone:~$ cat /sys/devices/bone_capemgr.9/
slots
 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-universal
 8: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-bone-iio
 But when I try to load overlay BB-LCNC-BEBOPR, it shows conflicted with BB-BONE-EMMC-2G. Then i also try to disable BB-BONE-EMMC-2G as:
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONE-EMMC-2G
or
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI
cape_disable=capemgr.disable_partno=BB-BONE-EMMC-2G
 First one only disable BB-BONELT-HDM, second only disable BB-BONE-EMMC-2G.
So i am wondering how to disable these two and load device tree overlay BB-LCNC-BEBOPR.
Or there is any other ways to load it?

-chengxi
 
 

Chen Cheng Xi

unread,
Aug 2, 2016, 9:05:05 AM8/2/16
to Michael Haberler, Machinekit
Hi, I solved BB-LCNC-BEBOPR can not loaded issue as below:
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G

ubuntu@arm:~/machinekit$ linuxcnc
MACHINEKIT - 0.1
Machine configuration directory is '/home/ubuntu/machinekit/configs/ARM/BeagleBone/BeBoPr'
Machine configuration file is 'BeBoPr.ini'
Starting Machinekit...
io started
halcmd loadusr io started
Loading BB-LCNC-BEBOPR overlay
Loading cape-bone-iio overlay
BeBoPr.hal:28: module 'hal_pru_generic' not loaded
Shutting down and cleaning up Machinekit...

<commandline>:0: error unloading realtime module 'hpg': rc=-1
<commandline>:0: unload: 'hpg' not loaded

<commandline>:0: unloadrt failed
<commandline>:0: error unloading realtime module 'hpg': rc=-1
<commandline>:0: unload: 'hpg' not loaded

<commandline>:0: unloadrt failed
Cleanup done
Machinekit terminated with an error.  You can find more information in the log:
    /home/ubuntu/linuxcnc_debug.txt
and
    /home/ubuntu/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
ubuntu@arm:~/machinekit$ export DEBUG=5
ubuntu@arm:~/machinekit$ linuxcnc
MACHINEKIT - 0.1
Machine configuration directory is '/home/ubuntu/machinekit/configs/ARM/BeagleBone/BeBoPr'
Machine configuration file is 'BeBoPr.ini'
Starting Machinekit...
io started
<commandline>:0: Component 'iocontrol' ready
<commandline>:0: Program 'io' started
halcmd loadusr io started
BB-LCNC-BEBOPR overlay found
cape-bone-iio overlay found
BeBoPr.hal:10: Program './setup.sh' finished
BeBoPr.hal:18: Realtime module 'trivkins' loaded
BeBoPr.hal:22: Realtime module 'tp' loaded
BeBoPr.hal:23: Realtime module 'motmod' loaded
BeBoPr.hal:27: Realtime module 'hal_bb_gpio' loaded
BeBoPr.hal:28: module 'hal_pru_generic' not loaded
Shutting down and cleaning up Machinekit...

<commandline>:0: Realtime threads stopped
<commandline>:0: error unloading realtime module 'hpg': rc=-1
<commandline>:0: unload: 'hpg' not loaded

<commandline>:0: Realtime module 'hal_bb_gpio' unloaded
<commandline>:0: Realtime module 'motmod' unloaded
<commandline>:0: Realtime module 'tp' unloaded
<commandline>:0: Realtime module 'trivkins' unloaded
<commandline>:0: unloadrt failed

<commandline>:0: Realtime threads stopped
<commandline>:0: error unloading realtime module 'hpg': rc=-1
<commandline>:0: unload: 'hpg' not loaded

<commandline>:0: unloadrt failed
Cleanup done
Machinekit terminated with an error.  You can find more information in the log:
    /home/ubuntu/linuxcnc_debug.txt
and
    /home/ubuntu/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

 linuxcnc.log as(http://pastebin.com/hPwXU9cr).

-chengxi
 

Michael Haberler

unread,
Aug 2, 2016, 9:56:52 AM8/2/16
to Chen Cheng Xi, Machinekit
I understand you are running your self-compiled kernel. This could be part of the problem. It seems the component loads work fine but the RT thread immediately exits which points to this cause.


first, try the kernel supplied with the SD image. It is next to impossible to verify you got a working kernel and I see no reason to use a self-built one, however that was done.

Then, can you post the following:
- output of uname -a
- output of dmesg

after boot, and after starting linuxcnc.

in case you changed anything in the config, please push that to github.

Chen Cheng Xi

unread,
Aug 3, 2016, 9:15:06 AM8/3/16
to Charles Steinkuehler, Michael Haberler, Machinekit
Hi,

I tried to load other configurations, such as configs/sim/axis, it works fine.
So i think it might not be related to self-build kernel.

By the way, actually i do not have BeBePr board hardware, is it the problem?
I just want to have a PWM signal from GPIO.

-chengxi

Charles Steinkuehler

unread,
Aug 3, 2016, 10:14:32 AM8/3/16
to machi...@googlegroups.com
On 8/3/2016 8:15 AM, Chen Cheng Xi wrote:
> Hi,
>
> I tried to load other configurations, such as configs/sim/axis, it works
> fine.
> So i think it might not be related to self-build kernel.
>
> By the way, actually i do not have BeBePr board hardware, is it the problem?
> I just want to have a PWM signal from GPIO.

If you don't actually have a BeBoPr board, you're starting with about
the worst example configuration you could choose. The BeBoPr was
designed for the original BeagleBone (White) and uses a device tree
overlay that conflicts with the eMMC and HDMI pins (as you've found).

I'd recommend starting with a more current configuration targeting the
BeagleBone Black that uses the universal overlay (which is easier to
modify than having to craft your own custom device tree overlay).

Try loading the CRAMPS example configuration. It will work fine even if
you don't have an actual CRAMPS board, you will just have to either wire
a normally-closed ESTOP switch between P8.26 and P8.17, or modify the
HAL file to bypass the external switch:

https://github.com/machinekit/machinekit/blob/master/configs/ARM/BeagleBone/CRAMPS/CRAMPS.hal#L224

There are already two PWM outputs configured, and you can add more if
you need.

--
Charles Steinkuehler
cha...@steinkuehler.net

Chen Cheng Xi

unread,
Aug 7, 2016, 8:50:54 AM8/7/16
to Machinekit

Hi Michael,

After several days struggling, i tried your suggestions.
I followed the way from http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#BBW.2FBBB_.28All_Revs.29_Machinekit

Yes, you are right. It works fine when i run with CRAMPS. Thanks!
Dmesg detail as http://pastebin.com/VrPubejm
linuxcnc.log as http://pastebin.com/cUMpC8gE

-uname -r
Linux beaglebone 3.8.13-xenomai-r79 #1 Wed Jun 15 22:12:09 UTC 2016 armv7l GNU/Linux

I suddenly remember that xenomai version in Robert's kernel 3.8.13-xenomai is 2.6.3 and i compiled 2.6.5 for userland and what you suspect is correct, so i should re-do my kernel again.

By they way,I have some question about:
xzcat bone-debian-8.5-machinekit-armhf-2016-06-19-4gb.img.xz | sudo dd of=/dev/sdX
Note: sdX is sdb in my case.
There is error:
dd: writing to `/dev/sdb': Input/output error
I ignore it and the system works. This is strange~

As I compared setup SD card procedure with https://eewiki.net/display/linuxonarm/BeagleBone+Black, should i format SD card first and write in bootloader or something else?

In the end, I am wondering how to create bone-debian-8.5-machinekit-armhf-2016-06-19-4gb.img.xz?

Because once i get my system stable, i need not repeated build from scratch every time.


Thanks!
-chengxi



On Wed, Aug 3, 2016 at 10:59 PM, Michael Haberler <mai...@mah.priv.at> wrote:

> Am 03.08.2016 um 09:15 schrieb Chen Cheng Xi <crazyin...@gmail.com>:
>
> Hi,
>
> I tried to load other configurations, such as configs/sim/axis, it works fine.
> So i think it might not be related to self-build kernel.

In fact it supports what I suspect.

Would you kindly follow my suggestions from below. Thanks.
> > > > To unsubscribe from this group and all its topics, send an email to machinekit+unsubscribe@googlegroups.com.

> > > > Visit this group at https://groups.google.com/group/machinekit.
> > > > For more options, visit https://groups.google.com/d/optout.
> > > >
> > > >
> > > >
> > > > --
> > > > Best regards!
> > > > 陈成细
> > > > R&D Engineer
> > > > (\__/)
> > > > (='.'=) This is Bunny. Copy and paste bunny into your
> > > > (")_(") signature to help him gain world domination.
> > > >
> > > > --
> > > > 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 machinekit+unsubscribe@googlegroups.com.

> > > > Visit this group at https://groups.google.com/group/machinekit.
> > > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> > >
> > >
> > > --
> > > Best regards!
> > > 陈成细
> > > R&D Engineer
> > > (\__/)
> > > (='.'=) This is Bunny. Copy and paste bunny into your
> > > (")_(") signature to help him gain world domination.
> > >
> > > --
> > > 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 machinekit+unsubscribe@googlegroups.com.

> > > Visit this group at https://groups.google.com/group/machinekit.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> >
> > --
> > Best regards!
> > 陈成细
> > R&D Engineer
> > (\__/)
> > (='.'=) This is Bunny. Copy and paste bunny into your
> > (")_(") signature to help him gain world domination.
> >
> >
> >
> > --
> > Best regards!
> > 陈成细
> > R&D Engineer
> > (\__/)
> > (='.'=) This is Bunny. Copy and paste bunny into your
> > (")_(") signature to help him gain world domination.
>
>
>
>
> --
> Best regards!
> 陈成细
> R&D Engineer
> (\__/)
> (='.'=) This is Bunny. Copy and paste bunny into your
> (")_(") signature to help him gain world domination.
>
> --
> 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 machinekit+unsubscribe@googlegroups.com.

> Visit this group at https://groups.google.com/group/machinekit.
> For more options, visit https://groups.google.com/d/optout.




--
Best regards!
陈成细
R&D Engineer
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.
Reply all
Reply to author
Forward
0 new messages