I2CEncoderV2.1 icon indicating copy to clipboard operation
I2CEncoderV2.1 copied to clipboard

Dead time after resetting

Open therealprof opened this issue 6 years ago • 7 comments

I'm writing a driver in Rust for the I2CEncoderV2 and noticed that my initialisation sequence does not work because as a good citizen I would like to do a RESET followed by proper initialisation but when I set the reset bit the following I2C interaction automatically receives a NACK.

therealprof avatar Jan 06 '19 19:01 therealprof

Hello, I just did some tests. I have found that the board requires at least 400uS for RESET. Try to put a 400uS after issuing the RESET command. Sorry i never had measured it before, i will add in the datasheet. Thank you.

DuPPadotnet avatar Jan 06 '19 20:01 DuPPadotnet

Hm, no idea how to achieve that in a generic driver. Can I keep polling until it comes back?

therealprof avatar Jan 06 '19 20:01 therealprof

You can try, but i'm not sure that is the way. Remember that the I2C Encoder V2 is based on a MCU and not on FPGA or CPLD. So it's a bit slower on some operations.

DuPPadotnet avatar Jan 06 '19 21:01 DuPPadotnet

Yeah, but I2C is not super fast anyway. I'd totally expect that any MCU can handle the timing by setting I2C up early and stretching the clock until it is ready to handle additional data.

therealprof avatar Jan 06 '19 21:01 therealprof

Clock stretch is not enabled, check the other issue https://github.com/Fattoresaimon/I2CEncoderV2/issues/3

DuPPadotnet avatar Jan 06 '19 21:01 DuPPadotnet

The RESET command is a full reset of the MCU. So after that the MCU will restart from the beginning: initialize the peripherals, the variables, ecc..

DuPPadotnet avatar Jan 06 '19 21:01 DuPPadotnet

Sure. But maybe if you want to have a proper I2C slave you should try to prioritise the functionality required for an I2C slave first?

therealprof avatar Jan 06 '19 22:01 therealprof