gloomyandy wrote:Out of interest, why do you want to do this? It is unlikely that you will be able to identify none Lego devices without having a pretty good idea of what device it is you are looking for...
skoehler wrote:you can simply issue a few reads and see to which reads the devices responds
Details about the address scanner macro are at the end of this post and around here in the source.
For I2C write addresses: the BP sends a start, the write address, looks for an ACK, then sends a stop.
For I2C read addresses: the BP sends a start, the read address, looks for an ACK. If there is an ACK, it reads a byte and NACKs it. Finally it sends a stop.
When the I2C chip responds to the read address, it outputs data and will miss a stop condition sent immediately after the read address (bus contention). If the I2C chip misses the stop condition, the address scanner will see ghost addresses until the read ends randomly. By reading a byte after any read address that ACKs, we have a chance to NACK the read and properly end the I2C transaction.
Users browsing this forum: No registered users and 0 guests