Electronics > Projects, Designs, and Technical Stuff
Confused about how this I2C read works
AndreasF:
Well, the first byte that's being sent (by the slave) seems to indicate the number of bytes that are available to read (from the slave), so all the master needs to do is send the slave address in read mode, wait for the first byte from the slave, and continue to read according to this first byte.
Chet T16:
Having looked into the library I think i see where I've gotten mixed up. With the arduino you start a read specifying the address and number of bytes. These are then read from the buffer. I was mistaken in thinking the master sent the number of bytes to the slave.
Yes the first byte returned will give me an indication of whether I have a button press to read.
free_electron:
if they use 3 wire it could be C-Bus... that is almost i2c...
ve7xen:
Is this maybe an (ab)use of I2C clock stretching? The master could be initiating the read immediately after having received some data, with the slave stretching the clock until an event happens, when it sends the requested data to the master. This feature is designed to allow the slave to throttle commands if the master is sending them too quickly for it to handle, but I suppose it could be used as a crude form of interrupt as well.
I'm not sure if the AVR TWI peripheral supports clock stretching (check the manual, this is an oft-omitted feature), but I'd bet the Arduino bit-banged library does not. I believe Peter Fleury's bitbanged I2C library does, however.
amyk:
--- Quote from: Chet T16 on February 25, 2013, 04:23:26 pm ---Inside the slave is some Sagem ic (AFRHEUT0200 HD6433834822H) that isn't throwing up any results on google and a few other bits - voltage reg, inverter, discretes etc
--- End quote ---
I think you misread the part# as that is probably the HD6433834S - Hitachi (now Renesas) H8 microcontroller. The datasheet does not explicitly mention CAN or I2C but there is a UART peripheral capable of different transfer modes. Or they could be bit-banging I2C/CAN...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version