From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Andrey Nechypurenko <andreynech@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Problem accesing I2C without using Linux kernel
Date: Sun, 19 Jun 2011 15:20:31 +0200 [thread overview]
Message-ID: <4DFDF79F.1090502@domain.hid> (raw)
In-Reply-To: <BANLkTikoPvhb1XmycYm=MROT7=BGA8cisg@domain.hid>
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.
next prev parent reply other threads:[~2011-06-19 13:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-19 13:16 [Xenomai-help] Problem accesing I2C without using Linux kernel Andrey Nechypurenko
2011-06-19 13:20 ` Gilles Chanteperdrix [this message]
[not found] ` <BANLkTinVUd-R1cpD+40MGZZckzGhwrqRvw@domain.hid>
2011-06-19 13:44 ` Gilles Chanteperdrix
2011-06-19 13:54 ` 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
2011-06-20 5:02 ` [Xenomai-help] Compiling program with xenomai support David Wiebe
2011-06-20 7:14 ` Gilles Chanteperdrix
2011-06-20 8:06 ` David Wiebe
2011-06-20 11:13 ` Gilles Chanteperdrix
2011-06-20 19:04 ` David Wiebe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DFDF79F.1090502@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=andreynech@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.