Am 02.02.2012 22:58, schrieb Roberto Spadim:
> well must check source code and see if it´s a time problem on
> communications, im a bit busy here, with time i can check, if anyone can
> check what changed in this versions that worked and that don´t work
> could be nice
>  i will be out for 1 month +- with a big work

I'll try to find as much as possible, because to be honest I think there
more than one thing wrong using DS9490, it also isn't perfect with 2.8p2..

Short conclusion: If my assumptions are right, reading a DS18B20
(parasite OR powered doesnt matter) switches the DS2490 from flexible to
regular-speed and disables Strong pullup..


-> As a first step I added some more debugging, to see whats going on;
patch attached
It's all inside OW_SHOW_TRAFFIC enabled with configure ...
--enable-owtraffic so it shouldnt hurt..

Though I'm not sure it's right, I used the DS2490 datasheet and while
typing it I found some discrepancies to at least existing comments in
the source..


My findings so far:
- One thing I came across reading sources and datasheets: recommended
for longer buses is a Pulldown Slew Rate of 1V/us (0x4), default and
used is 0.83V/us (0x5)

- Speed goes from initial flexible to regular (0x0) after reading a
DS18B20 sensor? And Strong Pullup is disabled then?


Started:
  DEBUG: ow_usb_msg.c:(212) USB status registers EFlags:7->SPU:1
Dspeed:1,Speed:1,SPUdur:0, PDslew:5, W1lowtime:4, W0rectime:4,
DevState:32, CC1:253, CC2:72, CCState:0, DataOutState:0, DataInState:8
(same after reading a DS2438)

After first read of a DS18B20:
  DEBUG: ow_usb_msg.c:(212) USB status registers EFlags:0->SPU:0
Dspeed:0,Speed:0,SPUdur:32, PDslew:5, W1lowtime:4, W0rectime:4,
DevState:32, CC1:117, CC2:8, CCState:0, DataOutState:0, DataInState:9


best regards

Michael
--- owfs-2.8p14/module/owlib/src/c/ow_usb_msg.c	2011-11-20 22:39:51.000000000 +0100
+++ module/owlib/src/c/ow_usb_msg.c	2012-02-04 14:59:14.556483753 +0100
@@ -196,6 +196,46 @@
 		if (buffer[8] & STATUSFLAGS_IDLE) {
 #if OW_SHOW_TRAFFIC
 			_Debug_Bytes("USB status registers ---- idle ----", buffer, ret) ; // debugging
+			//FIXME: if the line below really works we dont nee the line above ;)
+			LEVEL_DEBUG("USB status registers EFlags:%u->SPU:%u Dspeed:%u,Speed:%u,SPUdur:%u, PDslew:%u, W1lowtime:%u, W0rectime:%u, DevState:%u, CC1:%u, CC2:%u, CCState:%u, DataOutState:%u, DataInState:%u", 
+			    buffer[0], (buffer[0]&0x01), (buffer[0]&0x04 ? 1 : 0), 
+			    buffer[1],
+			    buffer[2], 
+			    buffer[4],
+			    buffer[5],
+			    buffer[6],
+			    buffer[8],
+			    buffer[9],
+			    buffer[10],
+			    buffer[11],
+			    buffer[12],
+			    buffer[13]			    );
+		/*
+        Datasheet DS2490 page 29 table 16
+        0: Enable Flags: SPUE=1(bit0) If set to 1, the strong pullup to 5V is enabled, if set to 0, it is disabled. 
+        bit1 should be 0 but is 1 ?! SPCE = 4(bit2) If set to 1, a dynamic 1-Wire bus speed change through a Communication command is enabled, if set to 0, it is disabled.
+        1: 1-Wire Speed
+        2: Strong Pullup Duration
+        3: (Reserved)
+        4: Pulldown Slew Rate
+        5: Write-1 Low Time
+        6: Data Sample Offset / Write-0 Recovery Time
+        7: reserved
+        8: Device Status Flags: bit0: SPUA if set to 1, the strong pullup to 5V is currently active, if set to 0, it is inactive.
+            bit3(8): PMOD if set to 1, the DS2490 is powered from USB and external sources, if set to 0, all DS2490 power is provided from USB. FIXME: expose this to clients to check!
+            bit4(16): HALT if set to 1, the DS2490 is currently halted, if set to 0, the device is not halted.
+            bit5(32): IDLE if set to 1, the DS2490 is currently idle, if set to 0, the device is not idle.
+            bit5(64): EPOF: Endpoint 0 FIFO status, see: If EP0F is set to 1, the Endpoint 0 FIFO was full when a new control transfer setup packet was
+                received. This is an error condition in that the setup packet received is discarded due to the full
+                condition. To recover from this state the USB host must send a CTL_RESET_DEVICE command; the
+                device will also recover with a power on reset cycle. Note that the DS2490 will accept and process a
+                CTL_RESET_DEVICE command if the EP0F = 1 state occurs. If EP0F = 0, no FIFO error condition exists.
+        9: Communication Command, Byte 1
+        10: Communication Command, Byte 2
+        11: Communication Command Buffer Status
+        12: 1-Wire Data Out Buffer Status
+        13: 1-Wire Data In Buffer Status
+		 */
 #endif /* OW_SHOW_TRAFFIC */
 			if (*readlen > 0) {
 				// we have enough bytes to read now!
@@ -210,6 +250,20 @@
 		} else {
 #if OW_SHOW_TRAFFIC
 			_Debug_Bytes("USB status registers ---- Not idle -----", buffer, ret) ; // debugging
+			//FIXME: if the line below really works we dont nee the line above ;)
+			LEVEL_DEBUG("USB status registers EFlags:%u->SPU:%u Dspeed:%u,Speed:%u,SPUdur:%u, PDslew:%u, W1lowtime:%u, W0rectime:%u, DevState:%u, CC1:%u, CC2:%u, CCState:%u, DataOutState:%u, DataInState:%u", 
+			    buffer[0], (buffer[0]&0x01), (buffer[0]&0x04 ? 1 : 0), 
+			    buffer[1],
+			    buffer[2], 
+			    buffer[4],
+			    buffer[5],
+			    buffer[6],
+			    buffer[8],
+			    buffer[9],
+			    buffer[10],
+			    buffer[11],
+			    buffer[12],
+			    buffer[13]			    );
 #endif /* OW_SHOW_TRAFFIC */
 		}
 		// this value might be decreased later...
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to