orgua / OneWireHub

OneWire slave device emulator
GNU General Public License v3.0
343 stars 86 forks source link

DS2431 emulation issue (possible timings) #94

Open giteafan opened 3 years ago

giteafan commented 3 years ago

I’m having problem with emulating ds2431 eeprom

tried two arduino boards (Mega, Uno)

#include <OneWireHub.h>
#include <DS2431.h>

auto hub = OneWireHub(8);
auto ds2431 = DS2431(DS2431::family_code, 0x0C, 0x38, 0x4F, 0x1E, 0x00, 0x00);

void setup() {
    hub.attach(ds2431);
    constexpr uint8_t mydata[] = {0x43, 0x00, 0x6B, 0x4D, 0x36, 0x5D, 0xE1, 0x06, 0xCD, 0x80, 0x41, 0x8C, 0xF9, 0x21, 0x62, 0x15, 0xBE, 0x10, 0x49, 0x5D, 0x0B, 0x62, 0xB1, 0xD3, 0x63, 0x6C, 0x7A, 0x3C, 0x35, 0xEB, 0x0E, 0x74, 0x49, 0x11, 0xA2, 0xC8, 0x98, 0x31, 0x3F, 0x3F, 0x6E, 0x5E, 0x53, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xC6, 0xD7, 0xD1, 0xE9, 0xCE, 0x36, 0x89, 0x7A, 0x15, 0x8F, 0x5E, 0x47, 0x02, 0xd9, 0x0C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

    ds2431.writeMemory(reinterpret_cast<const uint8_t *>(my data),sizeof(mydata),0x00);

    ds2431.setPageProtection(0x85);

    uint8_t flag = 0x55;
    ds2431.writeMemory(reinterpret_cast<const uint8_t *>(&flag), 1, 0x8F);
}

void loop(){
    hub.poll();
}

master device can’t read data properly (master is a closed device) getting error in OneWireHub::sendBit - RESET_IN_PROGRESS as far as I understand, the problem is in the timings I’ve tried to vary VALUE_IPL from 8 to 15 with no luck

two captures from logic analyzer are attached (one is real DS2431 chip, one is emulated version using OneWireHub)

any help would be greatly appreciated captures.zip