Open lutzha opened 9 years ago
Hi! Nice info! I am freeing some time here to finish the lib enhancements...
That reset transmit logic always troubled me. Thanks for the help! Nice code! Are you using it that way?
Is This code solve colision packet problem?
Thank you for your contribution! Renato Aloi
i take it from microchip forum, it works after little changes. now stable since 4h ;)
// Reset the transmit logic problem. See Rev. B7 Silicon Errata issues 12 and 13 writeOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST); writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST); writeOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF | EIR_TXIF); // send the contents of the transmit buffer onto the network writeOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRTS); // wait for transmission to complete or fail { unsigned long timer = millis(); while (((eir = readReg(EIR)) & (EIR_TXIF | EIRTXERIF)) == 0) { if (millis() - timer > 1000) { /* Transmit hardware probably hung, try again later. / /_ Shouldn't happen according to errata 12 and 13. */ writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRTS); return false; } } } writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRTS);