Pin Reading

5 views
Skip to first unread message

Binkowski, Cassio

unread,
Apr 1, 2012, 3:19:04 PM4/1/12
to rtems...@rtems.org
Dear all,

Forgive my ignorance, but I just want to know how to read pins with RTEMS.
For example, if I want to read a pin in an Arduino I just code it like: analogRead(pinNumber).

Is this covered in RTEMS or do I have to read the datasheet and make my own code?

Regards
Cassio

Sebastian Huber

unread,
Apr 2, 2012, 3:16:23 AM4/2/12
to rtems...@rtems.org

Every BSP handles this differently. Even if we add a rtems_read_pin(X), then
what means X on BSP 1, 2, or 3?

--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebasti...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-users mailing list
rtems...@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-users

Binkowski, Cassio

unread,
Apr 2, 2012, 8:09:01 AM4/2/12
to Sebastian Huber, rtems...@rtems.org
Thanks Sebastian.

However, where do I find such information for the specified BSP?

Cassio

On Mon, Apr 2, 2012 at 4:16 AM, Sebastian Huber <sebasti...@embedded-brains.de> wrote:
On 04/01/2012 09:19 PM, Binkowski, Cassio wrote:
Dear all,

Forgive my ignorance, but I just want to know how to read pins with RTEMS.
For example, if I want to read a pin in an Arduino I just code it like:
analogRead(pinNumber).

Is this covered in RTEMS or do I have to read the datasheet and make my own code?

Every BSP handles this differently.  Even if we add a rtems_read_pin(X), then what means X on BSP 1, 2, or 3?

--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9

Sebastian Huber

unread,
Apr 2, 2012, 8:58:47 AM4/2/12
to Binkowski, Cassio, RTEMS
On 04/02/2012 02:45 PM, Binkowski, Cassio wrote:
> Hi Sebastian,
>
> I'm interested in three of them: ARM, AVR and SPARC.
>
> But if I want any other board, is there a way of looking for this information?

You have to look in the BSP source code, e.g. the header files. The lpc24xx
ARM BSP has for example this API:

http://git.rtems.org/rtems/tree/c/src/lib/libbsp/arm/lpc24xx/include/io.h

--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9

E-Mail : sebasti...@embedded-brains.de

Joel Sherrill

unread,
Apr 2, 2012, 9:17:55 AM4/2/12
to Binkowski, Cassio, rtems...@rtems.org
On 04/02/2012 07:09 AM, Binkowski, Cassio wrote:
Thanks Sebastian.

However, where do I find such information for the specified BSP?

There is a proposed set of methods in the http://git.rtems.org/multiio/
package. It has been used on a few projects and the API is growing
organically. Functionality is not being added unless there is a project
requiring it and we can define a solution.  But for Discrete I/O, I know
there is board independent infrastructure to support waiting for
a pin state change interrupt forever or with timeout. You can poll
discrete in, ADCs, or write DACs.

It includes drivers for a couple of PC-104 multi I/O boards. I am interested
in seeing more feedback so we can have more confidence that it is
offering the right services.

Sebastian is completely correct in that the numbering of discrete I/O
pins, DAC, and ADCs is arbitrary. But if RTEMS provides a standard API
for these capabilities, then you can hide the pin numbers with macros.

--joel
Cassio

On Mon, Apr 2, 2012 at 4:16 AM, Sebastian Huber <sebasti...@embedded-brains.de> wrote:
On 04/01/2012 09:19 PM, Binkowski, Cassio wrote:
Dear all,

Forgive my ignorance, but I just want to know how to read pins with RTEMS.
For example, if I want to read a pin in an Arduino I just code it like:
analogRead(pinNumber).

Is this covered in RTEMS or do I have to read the datasheet and make my own code?

Every BSP handles this differently.  Even if we add a rtems_read_pin(X), then what means X on BSP 1, 2, or 3?

--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9

PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-users mailing list
rtems...@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-users



-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.s...@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

Binkowski, Cassio

unread,
Apr 2, 2012, 9:34:45 AM4/2/12
to Sebastian Huber, RTEMS
On Mon, Apr 2, 2012 at 9:58 AM, Sebastian Huber <sebasti...@embedded-brains.de> wrote:
On 04/02/2012 02:45 PM, Binkowski, Cassio wrote:
Hi Sebastian,

I'm interested in three of them: ARM, AVR and SPARC.

But if I want any other board, is there a way of looking for this information?

You have to look in the BSP source code, e.g. the header files.  The lpc24xx ARM BSP has for example this API:

http://git.rtems.org/rtems/tree/c/src/lib/libbsp/arm/lpc24xx/include/io.h

I'm afraid I didn't find any READ method.
I found just a GET, and it returns a boolean:


static inline bool lpc24xx_gpio_get(unsigned index)
{
  if (index <= LPC24XX_IO_INDEX_MAX) {
    unsigned port = LPC24XX_IO_PORT(index);
    unsigned bit = LPC24XX_IO_PORT_BIT(index);

    return (LPC24XX_FIO [port].pin & (1U << bit)) != 0;
  } else {
    return false;
  } 
} 

Can you advise?

Thanks


--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
Reply all
Reply to author
Forward
0 new messages