Go Down

Topic: 1-Wire Slave (Read 34751 times) previous topic - next topic

Markus_L811


I am receiving the following errors when compiling

. . ./OneWireSlave.h:133:4: error: #error "Not an Interrupt Pin"
. . ./OneWireSlave.h:134:4: error: #error "Use 2 or 3"

Any ideas?

Ian

Oh I know, the  ATTiny85 is not part in the lib can you give me the pins in the IDE where the ATTiny85 has interrupts so I can adopt it for somethink like this.

Code: [Select]
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //Arduino Mega
  #if dsslavepin == 2
  #define dsslaveassignedint 0
  #elif dsslavepin == 3
  #define dsslaveassignedint 1
  #elif dsslavepin == 18
  #define dsslaveassignedint 5
  #elif dsslavepin == 19
  #define dsslaveassignedint 4
  #elif dsslavepin == 20
  #define dsslaveassignedint 3
  #elif dsslavepin == 21
  #define dsslaveassignedint 2
  #else
  #error "Not an Interrupt Pin"
  #error "Use 2, 3, 18, 19, 20 or 21"
  #define dsslaveassignedint -1
  #endif


so your uC can be supported.

PaulS

Quote
Any ideas?

Use pin 2 or pin 3.

#47
Nov 04, 2013, 08:41 pm Last Edit: Nov 04, 2013, 08:47 pm by ilevans Reason: 1
Hi  Again

Interrupts are available on pins 0, 1, 2, 3, 4 and 5.
The micro-controller details and datasheet are available at the following link http://www.atmel.com/devices/ATTINY85.aspx.

I have attached the pins_arduino.h for the ATTiny

Thank you for your assistance.

Ian

I added the following to OneWireSlave.h and removed a reference to "Serial" in OneWireSlave.cpp that was not commented out.

Code: [Select]
#elif defined(__AVR__) //ATTiny
  #if dsslavepin == 0
  #define dsslaveassignedint 0
  #elif dsslavepin == 1
  #define dsslaveassignedint 1
  #elif dsslavepin == 2
  #define dsslaveassignedint 2
  #elif dsslavepin == 3
  #define dsslaveassignedint 3
  #elif dsslavepin == 4
  #define dsslaveassignedint 5
  #elif dsslavepin == 5
  #else
  #error "Not an Interrupt Pin"
  #error "Use 0, 1, 2, 3, 4 or 5"
  #define dsslaveassignedint -1
  #endif


The 0x44 is working. The 0xBE is not.
After a short while running it no longer is detected by the master does not detect the 0x44.

My program that uses the library does not use any interrupts. Another chip does all the work and communicates using an interruptable shiftIn style communications to pass data to the OWSlave chip. An LED on the second chip informs me that the 0x44 was received and the userdefined function executed. Only 0xFFFF's are reported as being read from the scratchpad.

Ian



More testing today and the library is working as expected. Yeah!!

I still have a problem that it stops responding after awhile, That is a strange one but I have a starting point with working communications.

thanks

Markus_L811


More testing today and the library is working as expected. Yeah!!

I still have a problem that it stops responding after awhile, That is a strange one but I have a starting point with working communications.

thanks


How often did you poll your uC to get the informations? The Problem is if the uC is too often called he would get out of sync and can't responce anymore, at the moment I have no idea for it. How fast is the ATTiny?

My testing currently consists of 3 x DS18B20 Temperature Sensors and 1 ATTiny85. All slaves are running on external power.

1) All slaves are issued a Convert Temperature Command individually (0x44)
2) 750ms wait (minimum conversion time for DS18B20)
3) All slaves are Read. (0xBE)
4) 2000ms wait before polling again.

The ATTiny85 running at 8mhz, although the chip is capable of running at 20mhz with external clocking.

cheers

robtillaart

Quote
2) 750ms wait (minimum conversion time for DS18B20)

for 12 bits it is, for 9 bits it is substantially less...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Markus_L811


The ATTiny85 running at 8mhz, although the chip is capable of running at 20mhz with external clocking.


Crystal or internal RC?

At the moment I don't know if the Leonardo I tested it sometimes get out of step or it's a load problem, I have run it on two Teensy 3 for hours with one miss on temp conversions.

I know if I let run an Leonardo direct against an other, the on who pretends an DS18B20 can't response in time with 2 real DS18B20 in chain it works most the time, only a few "temp conversions" are dropped.

Th ATTiny85 can clock internally at either 1mhz or 8mhz or externally with a crystal at 20mhz.
I run it a 8mhz.

Markus_L811


Th ATTiny85 can clock internally at either 1mhz or 8mhz or externally with a crystal at 20mhz.
I run it a 8mhz.


May the internal RC is not accurate enough for it

Markus_L811


More testing today and the library is working as expected. Yeah!!

I still have a problem that it stops responding after awhile, That is a strange one but I have a starting point with working communications.

thanks

Btw. did you make some other changes anyway, may can you post you Sketch?

Markus_L811


I added the following to OneWireSlave.h and removed a reference to "Serial" in OneWireSlave.cpp that was not commented out.

Code: [Select]
#elif defined(__AVR__) //ATTiny
  #if dsslavepin == 0
  #define dsslaveassignedint 0
  #elif dsslavepin == 1
  #define dsslaveassignedint 1
  #elif dsslavepin == 2
  #define dsslaveassignedint 2
  #elif dsslavepin == 3
  #define dsslaveassignedint 3
  #elif dsslavepin == 4
  #define dsslaveassignedint 5
  #elif dsslavepin == 5
  #else
  #error "Not an Interrupt Pin"
  #error "Use 0, 1, 2, 3, 4 or 5"
  #define dsslaveassignedint -1
  #endif


The 0x44 is working. The 0xBE is not.
After a short while running it no longer is detected by the master does not detect the 0x44.

My program that uses the library does not use any interrupts. Another chip does all the work and communicates using an interruptable shiftIn style communications to pass data to the OWSlave chip. An LED on the second chip informs me that the 0x44 was received and the userdefined function executed. Only 0xFFFF's are reported as being read from the scratchpad.

Ian


Did someone know the rest of the "defined" for the other Arduino Modells so I can maybe complete it better

Hi,

I have attached the sketches I have been testing with for the chips on the slave side. I have kept as much vanilla as possible until debugged. (I am currently selling our house so am not getting time to debug at present)

Counter.ino - sketch to just count pulses on the counter pin and send the count to OWSerial.ino when the trigger pin goes high.
            LED flashes to indicate trigger and pulses.
OWSerial.ino - slave sketch. Acts as a DS18B20 returning the count rather than temperature ( 1 pulse = 1/16 degree)
OneWireSlave.cpp - Your library with mods identified previously
OneWireSlave.h - Your library with mods identified previously


yoyolb

Hello,

I own an Arduino Due and I am very interested in your project (for home automation).
I needed to replace 'cli()' and 'sei()' instructions by 'noInterrupts()' and 'interrupts()'.
Then, it seems to work fine (only few testings so far in front of my Raspberry PI).

I have several DS18B20 for temperature measurement, and was interested by DS2423 for water consumption measurement (to share the same wires between all probes and my Raspberry PI). Since DS2423 is discontinued, I plan to use software emulation for this device.

Do you plan to adapt your code to emulate this one ?

In any case, thank you for your contribution.

Lionel.

Go Up