Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug report Onewire memory reads incorrectly
#1
Hello,

I have a DS2431-emulated slave that reads fine in the standard Micropython distro that will not properly read using the machine Onewire library in this port. It looks to me as if the timing is off, as data is coming through, but is incorrect and potentially offset.

Basically, all I do is 

Code:
owbus.reset();owbus.writebyte(0xcc);owbus.writebytes(bytearray([0xf0,0x00,0x00]));data_buf=owbus.readbytes(18);data_buf


This runs a reset, skip, and sends the read memory command, the two byte target address, and reads 18 bytes.

data comes back as something like:


Code:
'\x03c\x03,\x02\x02C\x02\x19\x02\x14\x03\x00\x03\x1f|'

This is obviously incorrect.

The following using the standard distro delivers the data perfectly:


Code:
owbus.reset();owbus.select_rom(this_rom);owbus.write(bytearray([0xF0,0x00,0x00]));owbus.readinto(data_buf);data_buf

data comes back as:

Code:
[3, 94, 3, 38, 2, 167, 2, 61, 2, 23, 2, 17, 3, 255, 3, 181, 31, 232]


I'd actually be happy to just use the original onewire module in the lobo port, as I really like the display drivers, and obviously the PSRAM support.

Thanks!
C

UPDATE: 

Avoiding readbytes() and using repeated readbyte() calls seems to do the trick.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)