* [Xenomai-help] Beagleboard xenomai @ 2011-06-15 4:41 David Wiebe 2011-06-15 5:06 ` Gilles Chanteperdrix 2011-06-18 7:25 ` Robert Berger 0 siblings, 2 replies; 6+ messages in thread From: David Wiebe @ 2011-06-15 4:41 UTC (permalink / raw) To: xenomai Hello, Thanks for reading this. I checked out the beagleboard version of xenomai. I tried make menuconfig and got the following david@domain.hid$ make menuconfig scripts/kconfig/mconf arch/arm/Kconfig init/Kconfig:1319: can't open file "arch/arm/xenomai/Kconfig" make[1]: *** [menuconfig] Error 1 make: *** [menuconfig] Error 2 I know that arch/arm/xenomai/Kconfig is a link to a file but its broken. How now? Where should the link be pointing? Thanks David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Beagleboard xenomai 2011-06-15 4:41 [Xenomai-help] Beagleboard xenomai David Wiebe @ 2011-06-15 5:06 ` Gilles Chanteperdrix [not found] ` <4DF87266.5070703@domain.hid> 2011-06-18 7:25 ` Robert Berger 1 sibling, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-15 5:06 UTC (permalink / raw) To: David Wiebe; +Cc: xenomai On 06/15/2011 06:41 AM, David Wiebe wrote: > Hello, > > Thanks for reading this. I checked out the beagleboard version of > xenomai. I tried make menuconfig and got the following > > david@domain.hid$ make > menuconfig > scripts/kconfig/mconf arch/arm/Kconfig > init/Kconfig:1319: can't open file "arch/arm/xenomai/Kconfig" > make[1]: *** [menuconfig] Error 1 > make: *** [menuconfig] Error 2 > > I know that arch/arm/xenomai/Kconfig is a link to a file but its broken. > How now? Where should the link be pointing? I did not know there was a beagleboard version, and I do not know about it. What I do know, however, is that "make menuconfig", will work in Linux kernel sources prepared with the "prepare-kernel.sh" script, as explained in installation instructions here: http://www.xenomai.org/documentation/xenomai-2.5/README.INSTALL -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <4DF87266.5070703@domain.hid>]
* Re: [Xenomai-help] Beagleboard xenomai [not found] ` <4DF87266.5070703@domain.hid> @ 2011-06-15 10:35 ` Gilles Chanteperdrix 0 siblings, 0 replies; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-15 10:35 UTC (permalink / raw) To: David Wiebe; +Cc: Xenomai help On 06/15/2011 10:50 AM, David Wiebe wrote: > > > On 11-06-14 10:06 PM, Gilles Chanteperdrix wrote: >> On 06/15/2011 06:41 AM, David Wiebe wrote: >>> Hello, >>> >>> Thanks for reading this. I checked out the beagleboard version of >>> xenomai. I tried make menuconfig and got the following >>> >>> david@domain.hid$ make >>> menuconfig >>> scripts/kconfig/mconf arch/arm/Kconfig >>> init/Kconfig:1319: can't open file "arch/arm/xenomai/Kconfig" >>> make[1]: *** [menuconfig] Error 1 >>> make: *** [menuconfig] Error 2 >>> >>> I know that arch/arm/xenomai/Kconfig is a link to a file but its broken. >>> How now? Where should the link be pointing? >> I did not know there was a beagleboard version, and I do not know about >> it. What I do know, however, is that "make menuconfig", will work in >> Linux kernel sources prepared with the "prepare-kernel.sh" script, as >> explained in installation instructions here: >> >> http://www.xenomai.org/documentation/xenomai-2.5/README.INSTALL >> > And thats the other part of my dilemma, there is no prepare-kernel.sh in > the scripts directory. I should have been more explicit. It is part of Xenomai sources distribution. Latest release being: http://download.gna.org/xenomai/stable/xenomai-2.5.6.tar.bz2 If you seek support for any other repackaged sources, you asked the wrong mailing-list. Please keep the discussion public. -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Beagleboard xenomai 2011-06-15 4:41 [Xenomai-help] Beagleboard xenomai David Wiebe 2011-06-15 5:06 ` Gilles Chanteperdrix @ 2011-06-18 7:25 ` Robert Berger 2011-06-18 10:55 ` Gilles Chanteperdrix 1 sibling, 1 reply; 6+ messages in thread From: Robert Berger @ 2011-06-18 7:25 UTC (permalink / raw) To: xenomai Hi David, On 06/15/2011 07:41 AM, David Wiebe wrote: > Hello, > > Thanks for reading this. I checked out the beagleboard version of > xenomai. > Can you please tell me where to check out the beagleboard version of xenomai? Do you happen to know if this works on the beagle-xm rev c as well? Regards, Robert ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Beagleboard xenomai 2011-06-18 7:25 ` Robert Berger @ 2011-06-18 10:55 ` Gilles Chanteperdrix 0 siblings, 0 replies; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-18 10:55 UTC (permalink / raw) To: gmane; +Cc: xenomai On 06/18/2011 09:25 AM, Robert Berger wrote: > Hi David, > > On 06/15/2011 07:41 AM, David Wiebe wrote: >> Hello, >> >> Thanks for reading this. I checked out the beagleboard version of >> xenomai. >> > > Can you please tell me where to check out the beagleboard version of > xenomai? > > Do you happen to know if this works on the beagle-xm rev c as well? Just to make something clear: Xenomai standard version should work on beagle. -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Xenomai-help] Problem accesing I2C without using Linux kernel
@ 2011-06-19 13:16 Andrey Nechypurenko
2011-06-19 13:20 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Andrey Nechypurenko @ 2011-06-19 13:16 UTC (permalink / raw)
To: xenomai
Hi,
I am working on real-time control application using BeagleBoard
and Xenomai. Some sensors are connected to the second i2c bus. It
is necessary to collect sensor data strictly periodically and
that is why I would prefer to query the sensors from xenomai
thread.
I can read sensor data from user space using kernel interface,
i.e. via /dev/i2c-2 file. However, as I understand, doing it from
the xenomai thread will lead to the context switch and degrade
the real-time performance (introduce unpredictable delays and all
other badnesses :-) ). That is why I decide to try to access
OMAP's i2c controller directly without using kernel driver and
/dev file system.
For this purposes, I simply poke the relevant parts from u-boot
sources and thought that it should work. Unfortunately it is
not. I am getting the "Bus error" message which is coming not
from my test program and then the program quits.
I am suspecting that there is some kind of conflict with
kernel. I am not experienced enough with kernel internals and
that is why the questions I would like to ask are: a) whether my
assumption about possible conflict with kernel is reasonable, b)
would it help to recompile the kernel with i2c support completely
disabled and c) if such kernel will work at all on BB? Please
note, that for this application I do not need any power
management and no display output.
Just for the sake of completeness, and if somebody is interested
in more details, here is the brief outline of what I did and how
it fails. I was doing the following steps:
1. Open /dev/mem and memory map the I2C 2 region at
0x48072000 (as defined in the TRM which is in meanwhile become
my most popular reading :-) ):
fd = open("/dev/mem", O_RDWR | O_SYNC);
i2c_base = mmap(NULL, sizeof(i2c_base),
PROT_READ | PROT_WRITE,
MAP_SHARED, fd, I2C_DEFAULT_BASE);
Where I2C_DEFAULT_BASE is 0x48072000 and i2c_base is the
structure with corresponding controller registers, i.e.:
struct i2c {
unsigned short rev; /* 0x00 */
unsigned short res1;
unsigned short ie; /* 0x04 */
unsigned short res2;
unsigned short stat; /* 0x08 */
. . .
2. Try to read the status of the i2c controller:
if(readw(&i2c_base->con) & I2C_CON_EN)
This is the very first attempt to read from the mapped memory
and this call fails resulting in the "Bus error" message printed
on the console and application seams to be killed. Here the
readw() function is just a define which simply returns the
content of the memory address passed as parameter. But just to
exclude possible mistakes here I was even trying to access the
memory directly:
if(i2c_base->con & I2C_CON_EN)
But even this line gives the same "Bus error" message. So it
seams like I can not access this memory at all.
I would really appreciate if someone can provide some
explanations and suggestions about possible reasons why my
approach fails and what I can do to fix it.
Thank you,
Andrey.
---------------------------------
http://veter-project.blogspot.com
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 13:16 [Xenomai-help] Problem accesing I2C without using Linux kernel Andrey Nechypurenko @ 2011-06-19 13:20 ` Gilles Chanteperdrix [not found] ` <BANLkTinVUd-R1cpD+40MGZZckzGhwrqRvw@domain.hid> 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-19 13:20 UTC (permalink / raw) To: Andrey Nechypurenko; +Cc: xenomai On 06/19/2011 03:16 PM, Andrey Nechypurenko wrote: > Hi, > > I am working on real-time control application using BeagleBoard > and Xenomai. Some sensors are connected to the second i2c bus. It > is necessary to collect sensor data strictly periodically and > that is why I would prefer to query the sensors from xenomai > thread. > > I can read sensor data from user space using kernel interface, > i.e. via /dev/i2c-2 file. However, as I understand, doing it from > the xenomai thread will lead to the context switch and degrade > the real-time performance (introduce unpredictable delays and all > other badnesses :-) ). That is why I decide to try to access > OMAP's i2c controller directly without using kernel driver and > /dev file system. > > For this purposes, I simply poke the relevant parts from u-boot > sources and thought that it should work. Unfortunately it is > not. I am getting the "Bus error" message which is coming not > from my test program and then the program quits. > > I am suspecting that there is some kind of conflict with > kernel. I am not experienced enough with kernel internals and > that is why the questions I would like to ask are: a) whether my > assumption about possible conflict with kernel is reasonable, b) > would it help to recompile the kernel with i2c support completely > disabled and c) if such kernel will work at all on BB? Please > note, that for this application I do not need any power > management and no display output. > > Just for the sake of completeness, and if somebody is interested > in more details, here is the brief outline of what I did and how > it fails. I was doing the following steps: > > 1. Open /dev/mem and memory map the I2C 2 region at > 0x48072000 (as defined in the TRM which is in meanwhile become > my most popular reading :-) ): > > fd = open("/dev/mem", O_RDWR | O_SYNC); > i2c_base = mmap(NULL, sizeof(i2c_base), > PROT_READ | PROT_WRITE, > MAP_SHARED, fd, I2C_DEFAULT_BASE); What is the value of i2c_base here? If it is MAP_FAILED, then mmap failed. And one reason for failing would be that sizeof(i2c_base) is not a multiple of the page size. -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <BANLkTinVUd-R1cpD+40MGZZckzGhwrqRvw@domain.hid>]
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel [not found] ` <BANLkTinVUd-R1cpD+40MGZZckzGhwrqRvw@domain.hid> @ 2011-06-19 13:44 ` Gilles Chanteperdrix 2011-06-19 14:06 ` Andrey Nechypurenko 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-19 13:44 UTC (permalink / raw) To: Andrey Nechypurenko; +Cc: Xenomai help On 06/19/2011 03:34 PM, Andrey Nechypurenko wrote: > Hi Gilles, > >>> fd = open("/dev/mem", O_RDWR | O_SYNC); >>> i2c_base = mmap(NULL, sizeof(i2c_base), >>> PROT_READ | PROT_WRITE, >>> MAP_SHARED, fd, I2C_DEFAULT_BASE); >> >> What is the value of i2c_base here? If it is MAP_FAILED, then mmap >> failed. And one reason for failing would be that sizeof(i2c_base) is not >> a multiple of the page size. > > In actual code I do check for the errors like below and it seams like > memory is mapped without errors: > > if(i2c_base == NULL) > { > fd = open("/dev/mem", O_RDWR | O_SYNC); > if(fd < 0) > { > fprintf(stderr, "Could not open memory\n"); > return; > } > > i2c_base = > (volatile struct i2c *)mmap(NULL, sizeof(i2c_base), > PROT_READ | PROT_WRITE, > MAP_SHARED, fd, I2C_DEFAULT_BASE); > if(i2c_base == MAP_FAILED) > { > fprintf(stderr, "Memory Mapping failed\n"); > close(fd); > return; > } > } > > Regarding the size of the memory mapped block - i2c_base is a pointer > and that is why, the mmap invocation above is incorrect. It should be > mmap(NULL, sizeof(struct i2c). This is a typo resulted by multiple > experiments I was doing. sizeof(struct i2c) is 64 and event with this > value, the same "Bus error" message is printed and the application > quits. Ok. I would pass the size of an entire page anyway, I do not think mapping anything not aligned on a page boundary makes sense. If it still fails, enable CONFIG_DEBUG_USER in kernel configuration, pass user_debug=29 on kernel command line, and post the user debug log upon failure, then the disassembly of the function where the SIGBUS happens. Note that this mailing list is probably not the best place to ask your question, since we mostly talk about Xenomai here, and your issue does not seem to have anything to do with Xenomai. Please keep the discussion public. -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 13:44 ` Gilles Chanteperdrix @ 2011-06-19 14:06 ` Andrey Nechypurenko 2011-06-19 14:11 ` Gilles Chanteperdrix 0 siblings, 1 reply; 6+ messages in thread From: Andrey Nechypurenko @ 2011-06-19 14:06 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: Xenomai help > Ok. I would pass the size of an entire page anyway, I do not think > mapping anything not aligned on a page boundary makes sense. > > If it still fails, enable CONFIG_DEBUG_USER in kernel configuration, > pass user_debug=29 on kernel command line, and post the user debug log > upon failure, then the disassembly of the function where the SIGBUS happens. Ok, Thank you for suggestions! I'll try it. > Note that this mailing list is probably not the best place to ask your > question, since we mostly talk about Xenomai here, and your issue does > not seem to have anything to do with Xenomai. I understand. Do you have an idea what list might be more appropriate for it? I did also post the same question to the BeagleBoard mail list. > Please keep the discussion public. Sorry, just hit "Reply" instead of "Reply to all" :-) . > Second stupid questions: are you sure all the clocks needed to get that > I2C module running are enabled? The module works. I think kernel configured it properly because I can use user space utility for example i2cdetect and see my sensors detected on the bus. At the moment where I was trying to read the status I did not made any reconfiguration before. So my assumption was that the module is already configured properly and at least an attempt to read the status should succede. Thank you, Andrey. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 14:06 ` Andrey Nechypurenko @ 2011-06-19 14:11 ` Gilles Chanteperdrix 2011-06-19 14:21 ` Andrey Nechypurenko 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-19 14:11 UTC (permalink / raw) To: Andrey Nechypurenko; +Cc: Xenomai help On 06/19/2011 04:06 PM, Andrey Nechypurenko wrote: >> Note that this mailing list is probably not the best place to ask your >> question, since we mostly talk about Xenomai here, and your issue does >> not seem to have anything to do with Xenomai. > > I understand. Do you have an idea what list might be more appropriate > for it? I did also post the same question to the BeagleBoard mail > list. Ok, maybe you will get better support there. There may also be some IRC channel somewhere, where you can get a more interactive help. >> Second stupid questions: are you sure all the clocks needed to get that >> I2C module running are enabled? > > The module works. I think kernel configured it properly because I can > use user space utility for example i2cdetect and see my sensors > detected on the bus. At the moment where I was trying to read the > status I did not made any reconfiguration before. So my assumption was > that the module is already configured properly and at least an attempt > to read the status should succede. To be sure of that, you would have to be sure that the clocks are not disabled when the device is not opened. To check this, either check the kernel sources, or try and open the i2c device, and keep it open before you mmap /dev/mem -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 14:11 ` Gilles Chanteperdrix @ 2011-06-19 14:21 ` Andrey Nechypurenko 2011-06-19 16:57 ` Gilles Chanteperdrix 0 siblings, 1 reply; 6+ messages in thread From: Andrey Nechypurenko @ 2011-06-19 14:21 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: Xenomai help >> The module works. I think kernel configured it properly because I can >> use user space utility for example i2cdetect and see my sensors >> detected on the bus. At the moment where I was trying to read the >> status I did not made any reconfiguration before. So my assumption was >> that the module is already configured properly and at least an attempt >> to read the status should succede. > > To be sure of that, you would have to be sure that the clocks are not > disabled when the device is not opened. To check this, either check the > kernel sources, or try and open the i2c device, and keep it open before > you mmap /dev/mem Just tried your suggestion but unfortunately it does not change enything. Thank you! Andrey. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 14:21 ` Andrey Nechypurenko @ 2011-06-19 16:57 ` Gilles Chanteperdrix 2011-06-19 20:24 ` Andrey Nechypurenko 0 siblings, 1 reply; 6+ messages in thread From: Gilles Chanteperdrix @ 2011-06-19 16:57 UTC (permalink / raw) To: Andrey Nechypurenko; +Cc: Xenomai help On 06/19/2011 04:21 PM, Andrey Nechypurenko wrote: >>> The module works. I think kernel configured it properly because I can >>> use user space utility for example i2cdetect and see my sensors >>> detected on the bus. At the moment where I was trying to read the >>> status I did not made any reconfiguration before. So my assumption was >>> that the module is already configured properly and at least an attempt >>> to read the status should succede. >> >> To be sure of that, you would have to be sure that the clocks are not >> disabled when the device is not opened. To check this, either check the >> kernel sources, or try and open the i2c device, and keep it open before >> you mmap /dev/mem > > Just tried your suggestion but unfortunately it does not change enything. > There may be (at least) two possible reasons: - the clocks are disabled, you need to check the kernel source to know if that is the case; - or the compiler generated a byte access to the 32 bits register, not knowing the alignment of mmap return value, you need to send the disassembly as I requested to know if that is the case. -- Gilles. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Problem accesing I2C without using Linux kernel 2011-06-19 16:57 ` Gilles Chanteperdrix @ 2011-06-19 20:24 ` Andrey Nechypurenko 2011-06-20 0:00 ` [Xenomai-help] Beagleboard Xenomai David Wiebe 0 siblings, 1 reply; 6+ messages in thread From: Andrey Nechypurenko @ 2011-06-19 20:24 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: Xenomai help The problem disapears when I run the custom patched kernel with removed i2c bus 2 initialization. In this case there is no "Bus error" message and my test program works just fine. So I conclude that it was indeed some kind of conflict between kernel and my code trying to talk directly to the i2c controller. Once again thank you Gilles for prompt response and suggestions! Regards, Andrey. On Sun, Jun 19, 2011 at 6:57 PM, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote: > On 06/19/2011 04:21 PM, Andrey Nechypurenko wrote: >>>> The module works. I think kernel configured it properly because I can >>>> use user space utility for example i2cdetect and see my sensors >>>> detected on the bus. At the moment where I was trying to read the >>>> status I did not made any reconfiguration before. So my assumption was >>>> that the module is already configured properly and at least an attempt >>>> to read the status should succede. >>> >>> To be sure of that, you would have to be sure that the clocks are not >>> disabled when the device is not opened. To check this, either check the >>> kernel sources, or try and open the i2c device, and keep it open before >>> you mmap /dev/mem >> >> Just tried your suggestion but unfortunately it does not change enything. >> > > There may be (at least) two possible reasons: > - the clocks are disabled, you need to check the kernel source to know > if that is the case; > - or the compiler generated a byte access to the 32 bits register, not > knowing the alignment of mmap return value, you need to send the > disassembly as I requested to know if that is the case. > > -- > Gilles. > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Xenomai-help] Beagleboard Xenomai 2011-06-19 20:24 ` Andrey Nechypurenko @ 2011-06-20 0:00 ` David Wiebe 0 siblings, 0 replies; 6+ messages in thread From: David Wiebe @ 2011-06-20 0:00 UTC (permalink / raw) To: xenomai Hello all, I compiled 2.6.35.9 with the Xenomai patch and am running it on my beagleboard C4. David ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-20 0:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 4:41 [Xenomai-help] Beagleboard xenomai David Wiebe
2011-06-15 5:06 ` Gilles Chanteperdrix
[not found] ` <4DF87266.5070703@domain.hid>
2011-06-15 10:35 ` Gilles Chanteperdrix
2011-06-18 7:25 ` Robert Berger
2011-06-18 10:55 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2011-06-19 13:16 [Xenomai-help] Problem accesing I2C without using Linux kernel Andrey Nechypurenko
2011-06-19 13:20 ` Gilles Chanteperdrix
[not found] ` <BANLkTinVUd-R1cpD+40MGZZckzGhwrqRvw@domain.hid>
2011-06-19 13:44 ` Gilles Chanteperdrix
2011-06-19 14:06 ` Andrey Nechypurenko
2011-06-19 14:11 ` Gilles Chanteperdrix
2011-06-19 14:21 ` Andrey Nechypurenko
2011-06-19 16:57 ` Gilles Chanteperdrix
2011-06-19 20:24 ` Andrey Nechypurenko
2011-06-20 0:00 ` [Xenomai-help] Beagleboard Xenomai David Wiebe
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.