Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

One Wire


  • Please log in to reply
5 replies to this topic

#1 jvetter

jvetter

    New Member

  • Members
  • Pip
  • 2 posts

Posted 08 August 2010 - 09:25 PM

I'm interested in getting one of those Dallas one wire temp sensors (DS18S20) working with my netduino, but I'm not sure where to start. Looking at the NETMF framework it doesn't seem possible to provide support for it in managed code due to its time constraints. Is this correct? If so how would you approach supporting these sensors? Could it be done if I wrote a un-managed library for it? If so can you point me in the right direction? Thanks.

#2 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 08 August 2010 - 09:30 PM

I'm interested in getting one of those Dallas one wire temp sensors (DS18S20) working with my netduino, but I'm not sure where to start.

Looking at the NETMF framework it doesn't seem possible to provide support for it in managed code due to its time constraints. Is this correct? If so how would you approach supporting these sensors? Could it be done if I wrote a un-managed library for it? If so can you point me in the right direction?

Thanks.



Although you can't do stuff like that in the managed language, you can do that in the device firmware. Ideally, there would be a One Wire driver developed that would bake into the firmware.

I don't know if such a drive exists for the Netduino just yet, or at least I didn't see one when I was looking through the source code.

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 09 August 2010 - 06:37 AM

Although you can't do stuff like that in the managed language

I have not had a chance to verify it yet on hardware, but it is possible to implement 1-Wire communication using a UART (see Maxim Application Note 214). As the SerialPort class allows setting BaudRate and Parity values and the ARM supports open drain mode for I/O pins (PIO_MDER register), it might work - but the current firmware does not seem to support setting open drain mode.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 August 2010 - 07:08 AM

Adding One Wire support to the Netduino firmware would be pretty awesome. At the very least, it would be simple to enable a managed code One Wire library to set the PIO_MDER registers, if a UART could indeed be used to implement One Wire... We have two UARTs exposed (D0...D3) and both are available by default. Chris

#5 jvetter

jvetter

    New Member

  • Members
  • Pip
  • 2 posts

Posted 12 August 2010 - 10:59 PM

Although you can't do stuff like that in the managed language, you can do that in the device firmware. Ideally, there would be a One Wire driver developed that would bake into the firmware.

I don't know if such a drive exists for the Netduino just yet, or at least I didn't see one when I was looking through the source code.


You would be able to do it in managed code if the timing controls were better (i.e. microsecond vs millisecond resolution). Granted the garbage collector may take over and screw up your timing, but you get my point.

I'm happy to write one in unmanaged code, just not sure what the micro edition equivalent is to delayMicroseconds when using the arduino. Anyone know?

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 August 2010 - 02:07 AM

You would be able to do it in managed code if the timing controls were better (i.e. microsecond vs millisecond resolution). Granted the garbage collector may take over and screw up your timing, but you get my point.

I'm happy to write one in unmanaged code, just not sure what the micro edition equivalent is to delayMicroseconds when using the arduino. Anyone know?


A driver like onewire (if you're doing it bitbang-style) should really be done in unmanaged (C++) code, possibly using interrupts.

There are some platform-agnostic sleep commands implemented in the firmware:
HAL_Time_Sleep_MicroSeconds
HAL_Time_Sleep_MicroSeconds_InterruptEnabled

Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.