PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
579 stars 382 forks source link

Arduino Nano BLE Sense does not work with OneWire #92

Open srv-config opened 4 years ago

srv-config commented 4 years ago

Issue is related to Arduino Nano Sense BLE and DS18B20 sensor (waterproof version) are not working together.

What I tried so far. I performed a test on UNO to isolate possible powering and sensor fault. Test looked as follows:

Connection of DS18B20

Black > GDN Red > 3V Yellow > D2

Last two connected via 2k2 resistor (2k2 instead 4k7 as I use 3V).

Then, to exclude possible coding mistakes I used ready example:

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  // After we got the temperatures, we can print them here.
  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
  Serial.print("Temperature for the device 1 (index 0) is: ");
  Serial.println(sensors.getTempCByIndex(0));
  delay(1000);
}

Result? works perfectly fine.

Then I switched to Nano Sense BLE board. without disconnecting the sensor I just switched connection on board's end and attached GDN, 3.3V and D2.

Result, -127. When trying to find DS18B20 address the result is none.

I noticed there is few topics around internet regarding nano series and none are resolved. I found also IoT and Every has the same problem.

drdiesel commented 4 years ago

I can verify OneWire is broken on the IoT.

fbartsch95 commented 4 years ago

Just to draw some attention to this: I am encountering the same problem as srv_config. I'm quite sure it's also related to the missing support of the nrf52840 based boards in OneWire, as described in these posts: https://forum.arduino.cc/index.php?topic=673098.0 https://forum.arduino.cc/index.php?topic=643463.0

PaulStoffregen commented 4 years ago

I'm depending on the open source community to contribute these I/O register defines.

Please feel free to volunteer. Or at least keep following this issue. Sooner or later someone familiar enough with the I/O registers in this chip will do it. Then testing & confirmation by other people using this board will be needed.

uzi18 commented 4 years ago

@PaulStoffregen isn't it already covered by #33 ?

RedaBousbah commented 3 years ago

The library kinda works, but after a few reads makes the whole Arduino crash.

matevy commented 6 months ago

I tried library 2.3.7 on Nano BLE and it did not work at all. After creating a support for the board (actually NRF52840) it works good.

@PaulStoffregen Shall I contribute it / is this of any interest at all?