You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Marco <oc...@gmail.com> on 2021/04/03 13:12:12 UTC

1wire subsystem

Hi

I currently working on a sensor driver for a temperature sensor DS18B20
connected on a 1wire bus.

It seems to be that logic exists under drivers/1wire/1wire.c that provides
a common mechanism to select a sensor on the bus by their unique rom code.
I'm not quite sure if that procedure is specific for sensors from vendor
maxim integrated or if it's 1wire specific. But the interface for that
implementation is under drivers/1wire/1wire_internal.h at the moment.
When this implementation is 1wire specific, I would ask if we can move the
interface specification to include/nuttx/1wire/1wire_master.h
I would expect something similar to the i2c interface.
Currently, I can't use the logic because of restricted access to that
interface from the sensors subdirectory.

Marco

Re: 1wire subsystem

Posted by Marco <oc...@gmail.com>.
Hi Juha,

thx for your response. I will be carefully moving the interface to the
include directory and hopefully do not breaking the existing implementation
(ds28e17).
I'm not so happy with the semaphore handling around the master interface
that requires that each driver must know about that.
I would like to have something like the i2c interface. Just simple
write/read/transfer calls taking necessary operations (lock/reset/select)
hidden from the caller. It seems to be the same procedure before reading or
writing from/to the bus and is not sensor-specific.

I'm also not a 1wire expert. It's my first time using this bus. So I also
don't know if something is missing. I need a driver for my temperature
sensor only.
But what I see your work looks good and complete so far.

Am Di., 6. Apr. 2021 um 08:34 Uhr schrieb Juha Niskanen (Haltian) <
juha.niskanen@haltian.com>:

> Hi,
>
> Adding that subsystem was my first experience with 1-wire. I don't like
> tinkering with buses like I2C/SPI/1-wire, especially about 1-wire I have
> forgotten nearly all details already. Feel free to re-organize this any way
> you like.
>
> -Juha
>
> ------------------------------
> *From:* Marco <oc...@gmail.com>
> *Sent:* Saturday, April 3, 2021 5:03 PM
> *To:* dev@nuttx.apache.org <de...@nuttx.apache.org>
> *Cc:* Juha Niskanen (Haltian) <ju...@haltian.com>
> *Subject:* Re: 1wire subsystem
>
> Hi Alan,
> yes of course, moving to include/nuttx/1wire/1wire_master.h also means
> splitting into different header files 1wire_master.h 1wire_slave.h and so
> on.
> Maybe juha doesn't knew if this is 1wire specific. I think the fact that
> only maxim integrated/or dallas provides chips for the 1wire bus it is a
> quasi-standard. ;)
> At least I didn't found 1wire chips from other vendors.
>
> Marco
>
> Am Sa., 3. Apr. 2021 um 15:47 Uhr schrieb Alan Carvalho de Assis <
> acassis@gmail.com>:
>
> Hi Marco,
>
> This code was submitted by Juha, maybe he has some rational why it was
> put there.
>
> In fact the structures and functions definition seam to be generic and
> should be at include/
>
> But, including that file inside 1wire_master.h is not correct, because
> it was has slaves definition.
>
> BR,
>
> Alan
>
> On 4/3/21, Marco <oc...@gmail.com> wrote:
> > Hi
> >
> > I currently working on a sensor driver for a temperature sensor DS18B20
> > connected on a 1wire bus.
> >
> > It seems to be that logic exists under drivers/1wire/1wire.c that
> provides
> > a common mechanism to select a sensor on the bus by their unique rom
> code.
> > I'm not quite sure if that procedure is specific for sensors from vendor
> > maxim integrated or if it's 1wire specific. But the interface for that
> > implementation is under drivers/1wire/1wire_internal.h at the moment.
> > When this implementation is 1wire specific, I would ask if we can move
> the
> > interface specification to include/nuttx/1wire/1wire_master.h
> > I would expect something similar to the i2c interface.
> > Currently, I can't use the logic because of restricted access to that
> > interface from the sensors subdirectory.
> >
> > Marco
> >
>
>

Re: 1wire subsystem

Posted by "Juha Niskanen (Haltian)" <ju...@haltian.com>.
Hi,

Adding that subsystem was my first experience with 1-wire. I don't like tinkering with buses like I2C/SPI/1-wire, especially about 1-wire I have forgotten nearly all details already. Feel free to re-organize this any way you like.

-Juha

________________________________
From: Marco <oc...@gmail.com>
Sent: Saturday, April 3, 2021 5:03 PM
To: dev@nuttx.apache.org <de...@nuttx.apache.org>
Cc: Juha Niskanen (Haltian) <ju...@haltian.com>
Subject: Re: 1wire subsystem

Hi Alan,
yes of course, moving to include/nuttx/1wire/1wire_master.h also means splitting into different header files 1wire_master.h 1wire_slave.h and so on.
Maybe juha doesn't knew if this is 1wire specific. I think the fact that only maxim integrated/or dallas provides chips for the 1wire bus it is a quasi-standard. ;)
At least I didn't found 1wire chips from other vendors.

Marco

Am Sa., 3. Apr. 2021 um 15:47 Uhr schrieb Alan Carvalho de Assis <ac...@gmail.com>>:
Hi Marco,

This code was submitted by Juha, maybe he has some rational why it was
put there.

In fact the structures and functions definition seam to be generic and
should be at include/

But, including that file inside 1wire_master.h is not correct, because
it was has slaves definition.

BR,

Alan

On 4/3/21, Marco <oc...@gmail.com>> wrote:
> Hi
>
> I currently working on a sensor driver for a temperature sensor DS18B20
> connected on a 1wire bus.
>
> It seems to be that logic exists under drivers/1wire/1wire.c that provides
> a common mechanism to select a sensor on the bus by their unique rom code.
> I'm not quite sure if that procedure is specific for sensors from vendor
> maxim integrated or if it's 1wire specific. But the interface for that
> implementation is under drivers/1wire/1wire_internal.h at the moment.
> When this implementation is 1wire specific, I would ask if we can move the
> interface specification to include/nuttx/1wire/1wire_master.h
> I would expect something similar to the i2c interface.
> Currently, I can't use the logic because of restricted access to that
> interface from the sensors subdirectory.
>
> Marco
>

Re: 1wire subsystem

Posted by Marco <oc...@gmail.com>.
Hi Alan,
yes of course, moving to include/nuttx/1wire/1wire_master.h also means
splitting into different header files 1wire_master.h 1wire_slave.h and so
on.
Maybe juha doesn't knew if this is 1wire specific. I think the fact that
only maxim integrated/or dallas provides chips for the 1wire bus it is a
quasi-standard. ;)
At least I didn't found 1wire chips from other vendors.

Marco

Am Sa., 3. Apr. 2021 um 15:47 Uhr schrieb Alan Carvalho de Assis <
acassis@gmail.com>:

> Hi Marco,
>
> This code was submitted by Juha, maybe he has some rational why it was
> put there.
>
> In fact the structures and functions definition seam to be generic and
> should be at include/
>
> But, including that file inside 1wire_master.h is not correct, because
> it was has slaves definition.
>
> BR,
>
> Alan
>
> On 4/3/21, Marco <oc...@gmail.com> wrote:
> > Hi
> >
> > I currently working on a sensor driver for a temperature sensor DS18B20
> > connected on a 1wire bus.
> >
> > It seems to be that logic exists under drivers/1wire/1wire.c that
> provides
> > a common mechanism to select a sensor on the bus by their unique rom
> code.
> > I'm not quite sure if that procedure is specific for sensors from vendor
> > maxim integrated or if it's 1wire specific. But the interface for that
> > implementation is under drivers/1wire/1wire_internal.h at the moment.
> > When this implementation is 1wire specific, I would ask if we can move
> the
> > interface specification to include/nuttx/1wire/1wire_master.h
> > I would expect something similar to the i2c interface.
> > Currently, I can't use the logic because of restricted access to that
> > interface from the sensors subdirectory.
> >
> > Marco
> >
>

Re: 1wire subsystem

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Marco,

This code was submitted by Juha, maybe he has some rational why it was
put there.

In fact the structures and functions definition seam to be generic and
should be at include/

But, including that file inside 1wire_master.h is not correct, because
it was has slaves definition.

BR,

Alan

On 4/3/21, Marco <oc...@gmail.com> wrote:
> Hi
>
> I currently working on a sensor driver for a temperature sensor DS18B20
> connected on a 1wire bus.
>
> It seems to be that logic exists under drivers/1wire/1wire.c that provides
> a common mechanism to select a sensor on the bus by their unique rom code.
> I'm not quite sure if that procedure is specific for sensors from vendor
> maxim integrated or if it's 1wire specific. But the interface for that
> implementation is under drivers/1wire/1wire_internal.h at the moment.
> When this implementation is 1wire specific, I would ask if we can move the
> interface specification to include/nuttx/1wire/1wire_master.h
> I would expect something similar to the i2c interface.
> Currently, I can't use the logic because of restricted access to that
> interface from the sensors subdirectory.
>
> Marco
>