Device Tree Compiler

7,538 views
Skip to first unread message

Jacob Stockton

unread,
Aug 6, 2013, 2:34:41 PM8/6/13
to beagl...@googlegroups.com
How does one get the device tree compiler installed on the BBB with Ubuntu (-uname 3.8.13)? I am trying to compile device trees specific to the BBB. I found a guide here for this in the "Thoughts" section, but it didn't work for me. It would be nice to have a simple explicit set of instructions.

Thanks,

Jacob 

Robert Nelson

unread,
Aug 6, 2013, 2:37:05 PM8/6/13
to beagl...@googlegroups.com
Here's a quick script for ubuntu/debian that'll install the patched
dtc, till teh '@' gets accepted upstream..

wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
./dtc.sh

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Jacob Stockton

unread,
Aug 6, 2013, 2:45:20 PM8/6/13
to beagl...@googlegroups.com
Thanks! Do I need to install the DTC using sudo apt-get install device-tree-compiler first?

Robert Nelson

unread,
Aug 6, 2013, 2:48:02 PM8/6/13
to beagl...@googlegroups.com
On Tue, Aug 6, 2013 at 1:45 PM, Jacob Stockton
<jacob.d....@gmail.com> wrote:
> Thanks! Do I need to install the DTC using sudo apt-get install
> device-tree-compiler first?

It's up to you, as the repo version of device-tree-compiler will install it to..

/usr/bin/dtc

Where as the script installs it to:
/usr/local/bin/dtc

such that they will not collide..
Message has been deleted

Robert Nelson

unread,
Aug 6, 2013, 7:13:25 PM8/6/13
to beagl...@googlegroups.com
On Tue, Aug 6, 2013 at 6:02 PM, Jacob Stockton
<jacob.d....@gmail.com> wrote:
> Why is it that on that kernel I cannot remove device trees? I am trying to
> remove the HDMI device tree so that I can access the pins for SPI1.

Because, it just doesn't work yet..

if you want to remove the hdmi cape and add the spi..

First disable the hdmi cape on bootup via (in uEnv.txt)

optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Jacob Stockton

unread,
Aug 6, 2013, 7:30:31 PM8/6/13
to beagl...@googlegroups.com
A couple issues. I needed to write to and from slots, but everytime I try (even when using sudo) it said permission denied. So I tried changing the permissions with:

sudo chmod ugo+w

At this point it showed write access like below.

ubuntu@arm:/sys/devices/bone_capemgr.9$ ls -al
total 0
drwxr-xr-x  6 root root    0 Jan  1  2000 .
drwxr-xr-x 14 root root    0 Jan  1  2000 ..
drwxr-xr-x  2 root root    0 Aug  6 23:12 baseboard
lrwxrwxrwx  1 root root    0 Aug  6 23:12 driver -> ../../bus/platform/drivers/bone-capemgr
-r--r--r--  1 root root 4096 Aug  6 23:12 modalias
drwxr-xr-x  2 root root    0 Aug  6 23:12 power
drwxr-xr-x  2 root root    0 Aug  6 23:12 slot-4
drwxr-xr-x  2 root root    0 Aug  6 23:12 slot-5
-rw-rw-rw-  1 root root 4096 Aug  6 23:20 slots
lrwxrwxrwx  1 root root    0 Jan  1  2000 subsystem -> ../../bus/platform
-rw-r--r--  1 root root 4096 Jan  1  2000 uevent

Next I try to cat slots with:

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

So I know that I have the HDMI device tree mounted (or whatever the proper verbage for 'mounted' is). Now, I also know that this device tree utilizes the pins that I need for SPI1. So i need to remove device tree number 5. Hence, I type the following command that I found here.

ubuntu@arm:/sys/devices/bone_capemgr.9$ # echo -5 >/sys/devices/bone_capemgr*/slots
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

But as you can see nothing happens. Why is that? I tried a reboot just in case that was what was required, but still the HDMI device tree is present. Also, the permissions that I set get overwritten upon a reboot. Why is it that every time I reboot my system, the user permissions change on slots? Ok, that should be enough to get me going.

Thanks,

Jacob

PS. Sorry for deleting my last post, but I wanted to be more thorough.

Robert Nelson

unread,
Aug 6, 2013, 7:42:55 PM8/6/13
to beagl...@googlegroups.com
On Tue, Aug 6, 2013 at 6:30 PM, Jacob Stockton
<jacob.d....@gmail.com> wrote:
> A couple issues. I needed to write to and from slots, but everytime I try
> (even when using sudo) it said permission denied. So I tried changing the
> permissions with:

sudo sh -c "echo something > somewhere"

Will bypass the permission problem..

or you can load them on startup:
optargs=capemgr.enable_partno=BB-SPI-xyz

Jacob Stockton

unread,
Aug 6, 2013, 8:10:02 PM8/6/13
to beagl...@googlegroups.com
Robert, 

You have been awesome, thanks so much for the assistance. I don't know if I am just not executing what you are telling me well or what, but it is still not working. I got into my uEnv.txt file (in /boot/uboot) and typed what you told me (see the uEnv.txt below), but now it is showing that I have the HDMIN device tree overlay too when I "cat slots".

kernel_file=zImage
initrd_file=uInitrd
initrd_high=0xffffffff
fdt_high=0xffffffff

#Video: Uncomment to override:
#kms_force_mode=video=HDMI-A-1:1024x768@60

##BeagleBone Cape Overrides
##Note: On the BeagleBone Black, there is also an uEnv.txt in the eMMC, so if these changes do not seem to be makeing a difference...

##BeagleBone Black:
##Disable HDMI/eMMC
#capemgr=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONE-EMMC-2G

console=ttyO0,115200n8

mmcroot=UUID=0a595bd3-2716-41ca-986a-0da77d5ebb0e ro
mmcrootfstype=ext4 rootwait fixrtc

loadkernel=load mmc ${mmcdev}:${mmcpart} 0x80200000 ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} 0x815f0000 /dtbs/${fdtfile}

boot_classic=run loadkernel; run loadinitrd
boot_ftd=run loadkernel; run loadinitrd; run loadfdt

device_args=run expansion_args; run mmcargs
mmcargs=setenv bootargs console=${console} ${optargs} ${kms_force_mode} root=${mmcroot} rootfstype=${mmcrootfstype} ${expansion} ${capemgr}

optargs=expansion_args=setenv expansion ip=${ip_method}
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

#Classic Board File Boot:
#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}
#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}
#New Device Tree Boot:
uenvcmd=run boot_ftd; run device_args; bootz 0x80200000 0x81000000:${initrd_size} 0x815f0000

I even tried uncommenting line that disables the HDMI and eMMC. Luckily it didn't work or I would have been screwed because I am booting off of the eMMC currently (I didn't realize when I did it that it was supposed to be for the eMMC, obviously). I noticed there is supposedly an eMMC version of the file, but I couldn't find it. Should I have replaced the "optargs=expansion_arg" line with the one you posted? Sorry I am new to embedded linux, and I have never had to edit a uEnv.txt file, so I don't want to do something that would mess up the kernel.


Charles Steinkuehler

unread,
Aug 6, 2013, 8:12:08 PM8/6/13
to beagl...@googlegroups.com, Jacob Stockton
On 8/6/2013 6:30 PM, Jacob Stockton wrote:
> But as you can see nothing happens. Why is that? I tried a reboot just in
> case that was what was required, but still the HDMI device tree is present.

You have already been told, and it is several other places in the
archives if you search:

Unloading device tree overlays is currently broken. It is an excellent
way to crash your kernel, cause erratic behavior, or just plain mess
things up. If you want something unloaded (like HDMI), you have to tell
the cape manager to not load it in the first place using a kernel
command line switch, typically passed via the uEnv.txt file to uBoot,
but that assumes you are using one of the typical stock images.

See Robert's first reply for a typical uEnv.txt entry that disables HDMI.

> Also, the permissions that I set get overwritten upon a reboot. Why
> is it that every time I reboot my system, the user permissions change
> on slots? Ok, that should be enough to get me going.

Robert gave you the solution, but not the reason. The reason you can't
just "sudo echo whatever > root.owned.file" is the redirection is
happening before the sudo. That's why "sudo sh -c ..." fixes the issue,
the redirection happens after you are granted root privileges.

As for why the permissions change doesn't "stick", that's because sysfs
is a dynamic filesystem generated on the fly. There is no permanent
storage backing it up, so any changes you make disappear when you reboot.

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

signature.asc

Charles Steinkuehler

unread,
Aug 6, 2013, 8:14:07 PM8/6/13
to beagl...@googlegroups.com, Jacob Stockton
On 8/6/2013 7:10 PM, Jacob Stockton wrote:
> Robert,
>
> You have been awesome, thanks so much for the assistance. I don't know if I
> am just not executing what you are telling me well or what, but it is still
> not working. I got into my uEnv.txt file (in /boot/uboot) and typed what
> you told me (see the uEnv.txt below), but now it is showing that I have the
> HDMIN device tree overlay too when I "cat slots".

You need to disable both the HDMI and the HDMIN (no audio) versions of
the display driver on the latest images.

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

signature.asc

Robert Nelson

unread,
Aug 6, 2013, 8:20:59 PM8/6/13
to beagl...@googlegroups.com
On Tue, Aug 6, 2013 at 7:10 PM, Jacob Stockton
<jacob.d....@gmail.com> wrote:
> Robert,
>
> You have been awesome, thanks so much for the assistance. I don't know if I
> am just not executing what you are telling me well or what, but it is still
> not working. I got into my uEnv.txt file (in /boot/uboot) and typed what you
> told me (see the uEnv.txt below), but now it is showing that I have the
> HDMIN device tree overlay too when I "cat slots".

I love it when people run old/broken release's. ;) I can tell by this line:

##Disable HDMI/eMMC
#capemgr=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONE-EMMC-2G

was actually a work/in/progress and in-correct at the time i uploaded
the image.. I think that was the may release. It was fixed in the
June/July releases.. Yuck..

You should atleast upgrade first, to solve a few of the 'other' problems.. ;)

http://elinux.org/BeagleBoardUbuntu#eMMC:_BeagleBone_Black

Jacob Stockton

unread,
Aug 7, 2013, 12:13:50 AM8/7/13
to beagl...@googlegroups.com
Charles,

I am aware I have to disable both HDMI and HDMIN. If you'll notice in the uEnv.txt example that I posted, I used the changed the file to read:

optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Which is exactly what Robert told me to do, and as far as I can tell, disables both. Thanks for the heads up though. I wont try to unload device trees that way in the future. Also, keep in mind that there are often contradicting sources online. Hence, one of the reasons for me asking my question about unloading device trees.

Robert,

Ok. I updated to the newest release (7/22) as requested. I think the issue here is that I am changing the wrong uEnv.txt file? I do not have any SD card in, so I would assume that the file system that is mounted is on the eMMC. However, after changing the uEnv.txt (in /boot/uboot/)file to:

kernel_file=zImage
initrd_file=uInitrd
initrd_high=0xffffffff
fdt_high=0xffffffff

#Video: Uncomment to override:
#kms_force_mode=video=HDMI-A-1:1024x768@60

##BeagleBone Cape Overrides
##Note: On the BeagleBone Black, there is also an uEnv.txt in the eMMC, so if these changes do not seem to be makeing a difference...

##BeagleBone Black:
##Disable HDMI/eMMC
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

#,BB-BONE-EMMC-2G <-- This does the eMMC too

console=ttyO0,115200n8

mmcroot=UUID=f1200610-1760-4283-99fd-46076bc38371 ro
mmcrootfstype=ext4 rootwait fixrtc

loadkernel=load mmc ${mmcdev}:${mmcpart} 0x80200000 ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} 0x815f0000 /dtbs/${fdtfile}

boot_classic=run loadkernel; run loadinitrd
boot_ftd=run loadkernel; run loadinitrd; run loadfdt

device_args=run expansion_args; run mmcargs
mmcargs=setenv bootargs console=${console} ${optargs} ${kms_force_mode} root=${mmcroot} rootfstype=${mmcrootfstype} ${expansion}

expansion_args=setenv expansion ip=${ip_method}
#Classic Board File Boot:
#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}
#New Device Tree Boot:
uenvcmd=run boot_ftd; run device_args; bootz 0x80200000 0x81000000:${initrd_size} 0x815f0000

Then I rebooted, and I used cat /sys/devices/bone_capemgr.8/slots which resulted in:

ubuntu@arm:~$ cat /sys/devices/bone_capemgr.8/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-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

So it seems like I am editing the wrong uEnv.txt. If so, where the heck is the other copy, and how do I get to it?

Charles Steinkuehler

unread,
Aug 7, 2013, 8:19:47 AM8/7/13
to beagl...@googlegroups.com, Jacob Stockton
On 8/6/2013 11:13 PM, Jacob Stockton wrote:
> Then I rebooted, and I used cat /sys/devices/bone_capemgr.8/slots which
> resulted in:
>
> ubuntu@arm:~$ cat /sys/devices/bone_capemgr.8/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-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
^
No "L" for the HDMI means they are not loaded

Looks like it's working.

> So it seems like I am editing the wrong uEnv.txt. If so, where the heck is
> the other copy, and how do I get to it?

You can double-check the kernel is getting the correct settings by
running "cat /proc/cmdline" and looking for the capemgr.disable entry.

Use "df" and "mount" to see where your fat partition is mounted (or
mount it somewhere manually if it's not currently mounted) so you know
you are editing the proper uEnv.txt file. Particularly on the default
Angstrom release, IIRC it auto-mounts the FAT partition under /media or
somesuch, but this is done by the gui and only happens if you leave HDMI
enabled. Once you turn off HDMI I think you have to manually mount the
boot partition. RCN's images include the boot partition in fstab, so
it's always in the same place.

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

signature.asc

William Hermans

unread,
Aug 7, 2013, 1:35:27 PM8/7/13
to beagl...@googlegroups.com
From what I understand Jacob Stockton is correct. You can also . . .

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins | grep HDMI
and you should get no output if they have not loaded. You can test by . . .
cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins | grep emmc
where you should get ten pin instances as a result back. 0-7 and 32, 33 I think they are.

Jacob Stockton

unread,
Aug 7, 2013, 1:51:27 PM8/7/13
to beagl...@googlegroups.com, Jacob Stockton
Thanks Charles. Ok, we are almost where I need to be. I got all of the UARTs working (1,2,4,5) that I need and I have i2c-port enabled, but I don't see the SPI in /dev. The literature I have found says it will be named spi1 or spidev, but I don't see it in /dev.


./pingroups 
[sudo] password for ubuntu: 
registered pin groups:
group: pinmux_userled_pins
pin 21 (44e10854)
pin 22 (44e10858)
pin 23 (44e1085c)
pin 24 (44e10860)

group: pinmux_rstctl_pins
pin 20 (44e10850)

group: pinmux_i2c0_pins
pin 98 (44e10988)
pin 99 (44e1098c)

group: pinmux_i2c2_pins
pin 94 (44e10978)
pin 95 (44e1097c)

group: pinmux_bb_i2c1_pins
pin 86 (44e10958)
pin 87 (44e1095c)

group: pinmux_bb_uart1_pins
pin 97 (44e10984)
pin 96 (44e10980)

group: pinmux_bb_uart2_pins
pin 84 (44e10950)
pin 85 (44e10954)

group: pinmux_bb_uart4_pins
pin 28 (44e10870)
pin 29 (44e10874)

group: pinmux_bb_uart5_pins
pin 49 (44e108c4)
pin 48 (44e108c0)

group: pinmux_bb_spi1_pins
pin 100 (44e10990)
pin 101 (44e10994)
pin 102 (44e10998)
pin 103 (44e1099c)

group: pinmux_emmc2_pins
pin 32 (44e10880)
pin 33 (44e10884)
pin 0 (44e10800)
pin 1 (44e10804)
pin 2 (44e10808)
pin 3 (44e1080c)
pin 4 (44e10810)
pin 5 (44e10814)
pin 6 (44e10818)
pin 7 (44e1081c)

group: pinmux_userled_pins
pin 21 (44e10854)
pin 22 (44e10858)
pin 23 (44e1085c)
pin 24 (44e10860)


And... 

ls /dev/
alarm            loop3               ram3    tty21  tty48   ttyS2
ashmem           loop4               ram4    tty22  tty49   ttyS3
autofs           loop5               ram5    tty23  tty5    ubi_ctrl
binder           loop6               ram6    tty24  tty50   uinput
block            loop7               ram7    tty25  tty51   urandom
btrfs-control    mapper              ram8    tty26  tty52   usbmon0
bus              mem                 ram9    tty27  tty53   usbmon1
char             mmcblk0             random  tty28  tty54   usbmon2
console          mmcblk0boot0        rtc0    tty29  tty55   vcs
cpu_dma_latency  mmcblk0boot1        shm     tty3   tty56   vcs1
disk             mmcblk0p1           snd     tty30  tty57   vcs2
fd               mmcblk0p2           stderr  tty31  tty58   vcs3
full             net                 stdin   tty32  tty59   vcs4
fuse             network_latency     stdout  tty33  tty6    vcs5
i2c-0            network_throughput  tty     tty34  tty60   vcs6
i2c-1            null                tty0    tty35  tty61   vcs7
i2c-2            ppp                 tty1    tty36  tty62   vcsa
input            psaux               tty10   tty37  tty63   vcsa1
kmem             ptmx                tty11   tty38  tty7    vcsa2
kmsg             pts                 tty12   tty39  tty8    vcsa3
log              ram0                tty13   tty4   tty9    vcsa4
log_events       ram1                tty14   tty40  ttyGS0  vcsa5
log_main         ram10               tty15   tty41  ttyO0   vcsa6
log_radio        ram11               tty16   tty42  ttyO1   vcsa7
log_system       ram12               tty17   tty43  ttyO2   watchdog
loop-control     ram13               tty18   tty44  ttyO4   watchdog0
loop0            ram14               tty19   tty45  ttyO5   zero
loop1            ram15               tty2    tty46  ttyS0
loop2            ram2                tty20   tty47  ttyS1

I know that UARTS are tty01, is the SPI named something similar?

Thanks,

Jacob

Mark Grosen

unread,
Aug 7, 2013, 1:58:42 PM8/7/13
to beagl...@googlegroups.com, Jacob Stockton
If you want SPI in user-space, you need to mark the SPI device as "spidev" compatible in the the dts file. See this recent article from David Anders:
http://elinux.org/BeagleBone_Black_Enable_SPIDEV

Mark


Mark


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

nathan.ta...@gmail.com

unread,
Mar 13, 2014, 12:11:11 PM3/13/14
to beagl...@googlegroups.com, Jacob Stockton, ma...@grosen.org
Im looking through David Ander's article and I just dont understand whats going on when "applying diff to kernel"
 
could you offer any assistance

John Syn

unread,
Mar 13, 2014, 8:50:27 PM3/13/14
to beagl...@googlegroups.com

From: <nathan.ta...@gmail.com>
Reply-To: <beagl...@googlegroups.com>
Date: Thursday, March 13, 2014 at 9:11 AM
To: <beagl...@googlegroups.com>
Cc: Jacob Stockton <jacob.d....@gmail.com>, <ma...@grosen.org>
Subject: Re: [beagleboard] Device Tree Compiler

Im looking through David Ander's article and I just dont understand whats going on when "applying diff to kernel"
 
could you offer any assistance
Open the file drivers/spi/spidev.c and add the line:
       { .compatible = "linux,spidev" },
This line should be placed after the line:
       { .compatible = "rohm,dh2228fv" },
Regards,
John

For more options, visit https://groups.google.com/d/optout.

Mike

unread,
Mar 13, 2014, 9:52:16 PM3/13/14
to beagl...@googlegroups.com
On 03/13/2014 08:50 PM, John Syn wrote:

From: <nathan.ta...@gmail.com>
Reply-To: <beagl...@googlegroups.com>
Date: Thursday, March 13, 2014 at 9:11 AM
To: <beagl...@googlegroups.com>
Cc: Jacob Stockton <jacob.d....@gmail.com>, <ma...@grosen.org>
Subject: Re: [beagleboard] Device Tree Compiler

Im looking through David Ander's article and I just dont understand whats going on when "applying diff to kernel"
 
could you offer any assistance
Open the file drivers/spi/spidev.c and add the line:
       { .compatible = "linux,spidev" },
This line should be placed after the line:
       { .compatible = "rohm,dh2228fv" },
Regards,
John

It's a patch file to apply to the spidev.c file.  As it's only one line you can simply just edit the file and add the line, then rebuild the file.

Mike

amitsa...@gmail.com

unread,
Aug 17, 2014, 12:19:19 PM8/17/14
to beagl...@googlegroups.com
Hi Robert, 

I am new to BeagleBone. Right now I am stuck up in the intial phase of using SPI0 (once I am able to use SPI0, I would go for SPI1). I tried to run the command for installing device tree compiler, but prompted "bash: dtc not found"

I have on my BBB :

Linux arm 3.8.13xenomai-bone28.1 #1 SMP Thu Nov 21 09:53:58 CET 2013 armv7l armv7l armv7l GNU/Linux

And when I tried to install the dtc by sudo apt-get install dtc, it does not work and gave error like:


Err http://security.ubuntu.com precise-security/universe Translation-en
  Something wicked happened resolving 'security.ubuntu.com:http' (-11 - System error)

the same error appear when I used apt-get install for other packages.

I googled the error and accordingly two solutions:


I did what is asked for but still the same results. I want to tell that for checking if my BBB has proxy I used the following command

env | grep -i proxy

Nothing got printed with this command (so there is no proxy) to from the link above I only used the lines 
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"

But I have a doubt since BBB device connect to PC via USB and when I use a site to find my proxy it gives some IP, but when I used the command "env | grep -i proxy". It  does not print anything. I need your suggestion.

2) I added these two lines in the file /etc/resolvconf/resolv.conf.d/tail

nameserver 8.8.8.8
nameserver 8.8.4.4

and then sudo /etc/init.d/resolvconf restart

Still apt-get install does not work and gives the same error as 
 
  Err http://security.ubuntu.com precise-security/universe Translation-en
  Something wicked happened resolving 'security.ubuntu.com:http' (-11 - System error)


I would be highly obliged if you would give some suggestions.

BR

Robert Nelson

unread,
Aug 18, 2014, 2:25:04 PM8/18/14
to Beagle Board
On Sun, Aug 17, 2014 at 11:19 AM, <amitsa...@gmail.com> wrote:
> Hi Robert,
>
> I am new to BeagleBone. Right now I am stuck up in the intial phase of using
> SPI0 (once I am able to use SPI0, I would go for SPI1). I tried to run the
> command for installing device tree compiler, but prompted "bash: dtc not
> found"
>
> I have on my BBB :
>
> Linux arm 3.8.13xenomai-bone28.1 #1 SMP Thu Nov 21 09:53:58 CET 2013 armv7l
> armv7l armv7l GNU/Linux

lots of bugs have been fixed since bone28...

> And when I tried to install the dtc by sudo apt-get install dtc, it does not
> work and gave error like:
>
>
> Err http://security.ubuntu.com precise-security/universe Translation-en
> Something wicked happened resolving 'security.ubuntu.com:http' (-11 -
> System error)

why do you have "security.ubuntu.com" enabled in /etc/apt/sources.list
? there is no armhf binaries on that server...

> the same error appear when I used apt-get install for other packages.
>
> I googled the error and accordingly two solutions:
>
> 1)
> http://askubuntu.com/questions/150210/how-do-i-set-systemwide-proxy-servers-in-xubuntu-lubuntu-or-ubuntu-studio
>
> I did what is asked for but still the same results. I want to tell that for
> checking if my BBB has proxy I used the following command
>
> env | grep -i proxy
>
> Nothing got printed with this command (so there is no proxy) to from the
> link above I only used the lines
> no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
> NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
>
> But I have a doubt since BBB device connect to PC via USB and when I use a
> site to find my proxy it gives some IP, but when I used the command "env |
> grep -i proxy". It does not print anything. I need your suggestion.
>
> 2) I added these two lines in the file /etc/resolvconf/resolv.conf.d/tail
>
> nameserver 8.8.8.8
> nameserver 8.8.4.4
>
> and then sudo /etc/init.d/resolvconf restart
>
> Still apt-get install does not work and gives the same error as
>
> Err http://security.ubuntu.com precise-security/universe Translation-en
> Something wicked happened resolving 'security.ubuntu.com:http' (-11 -
> System error)
>
>
> I would be highly obliged if you would give some suggestions.

Remove security and try again.

William Hermans

unread,
Aug 18, 2014, 3:08:36 PM8/18/14
to beagl...@googlegroups.com
OK, not meaning to derail the post but I would not know where else to say this. Personally, I think the device tree fragment such as is in 3.8.13* is perfect.  I also rather like loading / disabling dtb's from within uboot


Amit Sama

unread,
Aug 20, 2014, 2:38:05 PM8/20/14
to beagl...@googlegroups.com
Hi Robert,

I changed the /etc/apt/sources.list to the following:

deb http://ports.ubuntu.com/ubuntu-ports/ raring main universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ raring main universe multiverse

deb http://ports.ubuntu.com/ubuntu-ports/ raring-updates main universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ raring-updates main universe multiverse

Now the error while apt-get update is 

Err http://ports.ubuntu.com raring-updates/universe Translation-en
  Something wicked happened resolving 'ports.ubuntu.com:http' (-11 - System error)
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/raring/Release.gpg  Something wicked happened resolving 'ports.ubuntu.com:http' (-11 - System error)

I would be highly obliged.

BR

Best Regards,
Amit Sama
Pursuing M.Sc. Informatics
Technical University Munich
Contact : +49-15214455380



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/zQ039ckqp3E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.

Robert Nelson

unread,
Aug 20, 2014, 2:43:48 PM8/20/14
to Beagle Board
On Tue, Aug 19, 2014 at 4:03 PM, Amit Sama <amitsa...@gmail.com> wrote:
> Hi Robert,
>
> I changed the /etc/apt/sources.list to the following:
>
> deb http://ports.ubuntu.com/ubuntu-ports/ raring main universe multiverse
> deb-src http://ports.ubuntu.com/ubuntu-ports/ raring main universe
> multiverse

Laughs! Doing random things is not going to fix this..

Let's look at your previous email:

"Err http://security.ubuntu.com precise-security/universe Translation-en"

okay, so it looked like you were on "precise" and i told you to drop
"security.ubuntu.com" which you did.. But now it's also "raring"

umm: "precise" =/= "raring" also "raring" is eol..

So at this point, i'm just going to say... "You" totally hosed your OS
doing some random stuff, that why it doesn't work..

Start over with a fresh image.

Amit Sama

unread,
Aug 27, 2014, 3:06:58 PM8/27/14
to beagl...@googlegroups.com
Hi Robert, 

Though I managed to enable the spi interface on my BB. I have following questions/information:

1) I have following urls in /etc/apt/sources.list

THESE WERE EARLIER IN THE BBB

#deb http://ports.ubuntu.com/ubuntu-ports/ raring main universe multiverse
#deb-src http://ports.ubuntu.com/ubuntu-ports/ raring main universe multiverse

#deb http://ports.ubuntu.com/ubuntu-ports/ raring-updates main universe multiverse
#deb-src http://ports.ubuntu.com/ubuntu-ports/ raring-updates main universe multiverse


THESE I COPIED FROM THE link IN ORDER TO SOLVE THE PROBLEM

deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse


THESE I COPIED FROM MY DESKTOP
#deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
#deb http://security.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ precise-update main restricted universe multiverse

NONE OF THEM WORKS, DO TELL ME WHAT ARE THE RIGHT URLS

2) I could see these two files in /dev/spidev1.0 and /dev/spidev1.1 . Though I configures for the spi0 channel I think it should be like spidev0.0 and spidev0.1

3) In order to check if I have configured the spidev correctly, I copied a file from here 


NOW WHEN I compile it using 


gcc -c spidev_test.c 

It gives error like 

/usr/include/libio.h:334:3: error: unknown type name ‘size_t’
/usr/include/libio.h:338:67: error: ‘size_t’ undeclared here (not in a function)
/usr/include/libio.h:366:62: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:375:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:497:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from spidev_test.c:9:0:
/usr/include/stdio.h:320:35: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:326:47: error: expected declaration specifiers or ‘...’ before ‘size_t’


Am I am compiling using wrong options ? Do tell me the correct one.

Best Regards,
Amit Sama
Pursuing M.Sc. Informatics
Technical University Munich
Contact : +49-15214455380



Robert Nelson

unread,
Aug 27, 2014, 3:18:30 PM8/27/14
to Beagle Board
On Wed, Aug 27, 2014 at 4:39 AM, Amit Sama <amitsa...@gmail.com> wrote:
> Hi Robert,
>
"Yelling" isn't going to fix this problem, either is random coping the
right URLS's.

So to repeat:

<quote>
So at this point, i'm just going to say... "You" totally hosed your OS
doing some random stuff, that why it doesn't work..

Start over with a fresh image.
</quote>

> 2) I could see these two files in /dev/spidev1.0 and /dev/spidev1.1 . Though
> I configures for the spi0 channel I think it should be like spidev0.0 and
> spidev0.1

Nope it isn't..

> 3) In order to check if I have configured the spidev correctly, I copied a
> file from here
>
> http://osdir.com/ml/beagleboard/2013-05/msg00813.html
>
> NOW WHEN I compile it using
>
>
> gcc -c spidev_test.c
>
> It gives error like
>
> /usr/include/libio.h:334:3: error: unknown type name ‘size_t’

Really! "It gives error like" considering "size_t" isn't in that
source. Your definition of "like" is way different!!! Wow..

Robert Nelson

unread,
Aug 27, 2014, 3:38:30 PM8/27/14
to Beagle Board
build here:

debian@beaglebone:~$ gcc -c spi_test.c
debian@beaglebone:~$ ls -lh
total 20K
-rw-r--r-- 1 debian debian 1.3K Aug 27 19:36 spi_test.c
-rw-r--r-- 1 debian debian 1.8K Aug 27 19:37 spi_test.o

http://paste.debian.net/117888/

Mark Lazarewicz

unread,
Aug 27, 2014, 3:55:18 PM8/27/14
to beagl...@googlegroups.com

What can be the meaning here?

Sent from Yahoo Mail on Android



From: Robert Nelson <robert...@gmail.com>;
To: Beagle Board <beagl...@googlegroups.com>;
Subject: Re: [beagleboard] Re: Device Tree Compiler
Sent: Wed, Aug 27, 2014 7:18:21 PM

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsub...@googlegroups.com.

William Hermans

unread,
Aug 27, 2014, 7:32:00 PM8/27/14
to beagl...@googlegroups.com
What can be the meaning here?

Learn how to use your tools before half fast using / complaining about them ?


To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Amit Sama

unread,
Aug 28, 2014, 3:18:33 PM8/28/14
to beagl...@googlegroups.com
Hi all, 

Thanks for your support till now. I am really grateful to you. 

While I going through the reference manual of the arm processor on the BBB, I came to know that the processor has the capacity for 4 SPI channels but BBB only provides 2 channels.

1) So I want to know if spidev1.0 and spidev1.1 are the interfaces for just one channel (because I have read the spidevB.C means channel B and device C) why are they two in number. Does these files represent the SLAVES which could be attached with this channel ?

And please understand that I am not yelling or complaining. I am just new to this kind of thing. While reading the material through web I gets answers but also get questions. I hope you all don't mind my questions. I apologize if you do. 



Best Regards,
Amit Sama
Pursuing M.Sc. Informatics
Technical University Munich
Contact : +49-15214455380



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

John Syn

unread,
Aug 28, 2014, 4:28:49 PM8/28/14
to beagl...@googlegroups.com

From: Amit Sama <amitsa...@gmail.com>
Reply-To: "beagl...@googlegroups.com" <beagl...@googlegroups.com>
Date: Thursday, August 28, 2014 at 7:49 AM
To: "beagl...@googlegroups.com" <beagl...@googlegroups.com>

Subject: Re: [beagleboard] Re: Device Tree Compiler

Hi all, 

Thanks for your support till now. I am really grateful to you. 

While I going through the reference manual of the arm processor on the BBB, I came to know that the processor has the capacity for 4 SPI channels but BBB only provides 2 channels.

1) So I want to know if spidev1.0 and spidev1.1 are the interfaces for just one channel (because I have read the spidevB.C means channel B and device C) why are they two in number. Does these files represent the SLAVES which could be attached with this channel ?
I believe that is SPI Channel and SPI Chip Select.

Regards,
John

Amit Sama

unread,
Sep 2, 2014, 8:39:58 AM9/2/14
to beagl...@googlegroups.com
Hi John,

Thanks for your reply. You mean whatever we have to send and receive should be done via spidev1.0 only ?

Best Regards,
Amit Sama

John Syn

unread,
Sep 2, 2014, 1:25:06 PM9/2/14
to beagl...@googlegroups.com
Date: Sunday, August 31, 2014 at 4:27 AM

To: "beagl...@googlegroups.com" <beagl...@googlegroups.com>
Subject: Re: [beagleboard] Re: Device Tree Compiler

Hi John,

Thanks for your reply. You mean whatever we have to send and receive should be done via spidev1.0 only ?
No, you can use any SPI interface and any chip select as long as they are defined in the devicetree. If you define the SPI device in the devicetree correctly then they will show up in /dev. 

Regards,
John

Amit Sama

unread,
Sep 11, 2014, 1:31:50 PM9/11/14
to beagl...@googlegroups.com
Hi Robert,

I want to read/write data directly from the registers for SPI0. 

1) I read the arm335X manual for this.
2) I am coding in C.
3) According to the manual I have to first soft reset the the module. For this purpose I have to set the RESETDONE bit in the MCSPI_SYSCONFIG register.
4) So I am first using mmap to map the device register. 
5) then using the offset I am reaching to the particular register's address
6) As soon as I do any operation with the content of the register I get Bus Error.



this is my code 

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
//Xenomai for mapping the register
#include <sys/mman.h>


#define SPI0_START_ADDR 0x48030000  //mcspi0 data registers
#define SPI0_END_ADDR   0x48030FFF
#define SPI0_SIZE (SPI0_END_ADDR - SPI0_START_ADDR + 0x01)   // 4KB
#define SPI1_START_ADDR 0x481A0000  //mcspi1 data registers
#define SPI1_END_ADDR   0x481A0FFF
#define SPI1_SIZE (SPI1_END_ADDR - SPI1_START_ADDR + 0x01)  // 4KB
 
//print_output(void *data) {
//      unsigned int *my_data =  &
//}

int main (int *argc, int **argv) 
{

        printf("%d\n",sysconf(_SC_PHYS_PAGES));
        mlockall (MCL_CURRENT | MCL_FUTURE);
        int fd, outputfile;
        struct stat attr;
        void *spi0_addr = NULL;

        //SPI Registers
        volatile unsigned int *mcspi_revision = NULL;
        volatile unsigned int *mcspi_sysconfig = NULL;
        volatile unsigned int *mcspi_sysstatus = NULL;
        volatile unsigned int *mcspi_irqstatus = NULL;
        volatile unsigned int *mcspi_irqenable = NULL;
        volatile unsigned int *mcspi_syst = NULL;
        volatile unsigned int *mcspi_modulctrl = NULL;
        volatile unsigned int *mcspi_ch0conf = NULL;
        volatile unsigned int *mcspi_ch0stat = NULL;
        volatile unsigned int *mcspi_ch0ctrl = NULL;
        volatile unsigned int *mcspi_tx0 = NULL;
        volatile unsigned int *mcspi_rx0 = NULL;

        if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
                fprintf(stderr, "can not open /dev/mem!\n");
                 exit(-1);
        }
        else {
                printf("Mapping %x - %x (size: 0x%x bytes)\n", SPI0_START_ADDR, SPI0_END_ADDR, SPI0_SIZE);
        }
        if (fstat(fd,&attr) == -1) {
                fprintf(stderr,"Error while fstat\n");
        }
        //mapping the file /dev/mem
        spi0_addr = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, SPI0_START_ADDR);
        if (spi0_addr == MAP_FAILED) {
                printf("Mapping of the SPI0 failed!! \n");
                exit(1);
        }
        else {
                printf("/dev/mem file is mapped\n");
        }

        //fprintf(stdout, "size of void* is : %d and size of volatile unsigned int * is: %d\n",*((int *)spi0_addr),\
        //       sizeof(*mcspi_rx0));   
        //fprintf(stdout,"Base address returned from the mmap is: %X and size of value \
        //         returned is: %X \n",(unsigned)spi0_addr, sizeof(*spi0_addr));


mcspi_revision = spi0_addr + 0x00;
        mcspi_sysconfig = spi0_addr + 0x110;
        mcspi_sysstatus = spi0_addr + 0x114;
        mcspi_irqstatus = spi0_addr + 0x118;
        mcspi_irqenable = spi0_addr + 0x11C;
        mcspi_syst = spi0_addr + 0x124;
        mcspi_modulctrl = spi0_addr + 0x128;
        // spi0 channel
        mcspi_ch0conf = spi0_addr + 0x12C;
        mcspi_ch0stat = spi0_addr + 0x130;
        mcspi_ch0ctrl = spi0_addr + 0x134;
        mcspi_tx0 = spi0_addr + 0x138;
        mcspi_rx0 = spi0_addr + 0x13C;

        // Soft reset
   *mcspi_sysconfig = ((*mcspi_sysconfig) | (0x2));    //<---------this is the point where I am getting an error as I am trying to acces the content of the register.
        int  temp  =  (*mcspi_sysconfig & 0x2);
        printf("0x%02X\n",temp);
        //checking if reset is done
        //while (1) {  
                if (((*mcspi_sysstatus) & (0x00000001)) == 0x1) {
                        printf("reset is complete\n");
                        //break;
                }
                else {
                        printf("reset is going on\n");
                }
        //}
        

        if ((outputfile = open("/home/ubuntu/dac/output_file.txt", O_RDWR | O_APPEND))<0) {
                printf("could not open the file\n");
        }
        close(outputfile);
        //mcspi_sysstatus = NULL;
        //fprintf(stdout, "ch0conf: %x\n", mcspi_sysstatus);
        //fpirntf(stdout, "ch0stat: %x\n", (unsigned int)mcspi_ch0stat);
        //fprintf(stdout, "ch0ctrl: %x\n", (unsigned int)mcspi_ch0ctrl);
        //fprintf(stdout, "tx0: %x\n", (unsigned int)mcspi_tx0);
        //fpirntf(stdout, "rx0: %x\n", (unsigned int)mcspi_rx0);


        close(fd);
 
        return 0;
}







Please give your suggestions about where I am going wrong.  


Best Regards,

ssprit...@gmail.com

unread,
Feb 4, 2015, 3:49:01 AM2/4/15
to beagl...@googlegroups.com
thanks

Amit Sama

unread,
Feb 13, 2015, 5:13:32 AM2/13/15
to beagl...@googlegroups.com
Hi,

May be this would help you 


Best Regards,
Amit 



--
Reply all
Reply to author
Forward
0 new messages