onewireslave's People
onewireslave's Issues
Error in presence() ?!
Is this code working for someone at all?
I couldn't get my DS9490 to recognize my custom slave. Reading what happens shows me, that 'waitForRequest()' aborts when 'presence()' doesn't return TRUE. Looking at the code, it actually returns nothing... what's wrong?
Is there any working tiny 1-Wire Slave library for Arduino GUI around here?
sei() and cli() not recognised when compiling for Due
Seems it is necessary to use interrupts() instead of sei() and noInterrupts() instead of cli() in OneWireSlave.cpp. Then it will compile fine in ARM mode for Due with Arduino 1.5.7, otherwise cli) and sei() are not recognised.
Git
No presence every second request
I reduced DS18B20_Slave_Interrupt_T3 as much as possible:
void setup() { Serial.begin(115200); Serial.println("Start"); pinMode(tstpin, OUTPUT); ds.init(rom); ds.setScratchpad(scratchpad); ds.setPower(PARASITE); ds.setResolution(9); attachInterrupt(12, DS18B20p, CHANGE); } void loop() { ds.waitForRequest(true); } void DS18B20p() { previousmicros = micros(); difference = previousmicros - old_previousmicros; if (difference >= 380 && difference <= 800) { //on Leonardo // if (difference >= 325 && difference <= 500) { ds.waitForRequestInterrupt(false); } }
Exactly every second request results in NO PRESENCE:
Start packet transmitting RESET PRESENCE No address selected 33 (READ ROM) Packet transmitted successfully Reading byte(s) 28 48 A0 AE 08 00 00 60 Done Start packet transmitting RESET **NO PRESENCE** Start packet transmitting RESET PRESENCE No address selected 33 (READ ROM) Packet transmitted successfully Reading byte(s) 28 48 A0 AE 08 00 00 60 Done Start packet transmitting RESET **NO PRESENCE**
I also could see in oscillosope the absence of the presence pulse every second request.
Issues emulating
Project does not work for me
Two different programs do not recognize an emulated DS1990a:
- arduino onewire library (for master device emulation)
- a windows onebus reader software
My source code:
#include "OneWireSlave.h"
unsigned char rom[8] = {0x28, 0xAD, 0xDA, 0xCE, 0x0F, 0x00, 0x11, 0x00};
unsigned char scratchpad[10] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
//{0x01, 0xC8, 0x01, 0x4B, 0x46, 0x7F, 0xFF, 0x08, 0x10, 0x3F};
OneWireSlave ds(2); //+5V behind Resistor and connection on pin 2
void setup() {
Serial.begin(9600);
ds.init(rom);
}
void loop() {
Serial.println("loop");
ds.waitForRequest(false);
}
One of the readers looks like this and runs on a separate Arduino Uno. It was originally written for DS1992 so loops taking memory into account might not end soon enough, yet i did not even get to this point. Disabling if (presence) continue
seemed to not help much (see not yet proposed commit )
#include <OneWire.h>
OneWire ds(2); // 1-wire on pin 2
byte addr[8]; // Contains the eeprom unique ID
void setup(void)
{
Serial.begin(9600);
digitalWrite(2, HIGH);
}
void loop(void)
{
byte i;
byte actually_useful_data[16];
SearchAddress(addr);
ReadAllMem(); //print all mem content
Serial.print("Pause \n");
delay(5000);
}
void SearchAddress(byte* address) //Search for address and confirm it
{
int i;
if ( !ds.search(address))
{
Serial.print("No device found.\n");
ds.reset_search();
delay(250);
}
Serial.print("ADDR= ");
for ( i = 0; i < 8; i++)
{
Serial.print(address[i], HEX);
Serial.print(" ");
}
if ( OneWire::crc8( address, 7) != address[7])
{
Serial.print("CRC is not valid, address is corrupted\n");
return;
}
if ( address[0] != 0x08)
{
Serial.print("Device is not a 1-wire Eeprom.\n");
return;
}
Serial.println();
}
void ReadAllMem()
{
int i;
ds.reset();
ds.select(addr);
ds.write(0xF0, 1); // Read Memory
ds.write(0x00, 1); // Read Offset (xx): 00 xxh
ds.write(0x00, 1); // Read Offset (yy): yy 00h
for ( i = 1; i <= 128; i++) //whole mem is 144
{
Serial.print(ds.read(), HEX);
Serial.print(" ");
if ((i % 16) == 0){
Serial.println();
}
}
Serial.println();
}
Not responding to 1wire
Hi
Hav have tried to get this to work on an Arduino Nano and an ATtiny85 but with no luck.
I can compile to both and Pin 13 LED is flashing, but the onewire host cannot se the device.
I found a few other samles on the net that runs on either the Nano or the tiny.
I tried all of the examples (had to modify af few to be able to compile)
I use D2 for ow-signal on both Nano and Tiny.
What am I missing?
Any help is highly appreciated.
Erik
Code writes HIGH to bus, when it probably should not
Hello. I noticed DIRECT_WRITE_HIGH call in sendBit. Shoul not it be changed to DIRECT_MODE_INPUT to make bus float? The specs say that devices should not (and do not have to) pull the bus high. This issue will probably break my project where an raspberry master (with 3.3V) communicates with arduino slave (by pulling the bus to 5V arduino will probably damage rpi).
DS1990A example
The DS1990A example cannot be compiled:
"DS1990A:13: error: 'class OneWireSlave' has no member named 'setRom'"
Interrupt pin checking logic preprocessing may be wrong, cannot compile.
This is strange, I can't really see what is happening. I tried the new version on Due but could not get sensible values from the sensor. So I switched to Mega, changed the pin to suit, and immediately got this error :
In file included from E:\EDA\Arduino\libraries\OneWireSlave-master\OneWireSlave.cpp:60:0:
E:\EDA\Arduino\libraries\OneWireSlave-master\OneWireSlave.h:35:4: error: #error "Not an Interrupt Pin"
#error "Not an Interrupt Pin"
^
E:\EDA\Arduino\libraries\OneWireSlave-master\OneWireSlave.h:36:4: error: #error "Use 2, 3, 18, 19, 20 or 21"
#error "Use 2, 3, 18, 19, 20 or 21"
I have tried #define dsslavepin as 2, 3, 18, 19, 20 and 21 and I get the same error everytime I save then compile. I am using Mega2560 setting and Arduino Mega 2560 board.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.