delta5_race_timer
delta5_race_timer copied to clipboard
hacker's question
I am delighted to find this excellent project.
In delta5node.ino it looks like there is a hard-coded i2cSlaveAddress. This is used for wire initialization, it is also printed for our convenience.
But there is also a mechanism for the master controller to interrogate the slave nodes for that address… but to do this, the address would already be known.
Car 54, what is your car number?
Or I am missing something probably. Is there a kind of master broadcast that is used to find all slaves?
alto777
Not sure I understand what you're asking.
Why is there a command to interrogate the slave for its address
when
in order to interrogate a slave, its address must already be known?
I guess it's because you can add N number of nodes with different IDs , and you don't need to change the main code if you do so. That's why it's "searching" for nodes in the BUS.
Then I must not understand I2C.
Can an I2C slave respond to packets that do not know its address? I find "general call" googling, but don't see how it could be employed in any scanning process.
If you need to know the adderss of a slave to talk to it, why would one of the things you can ask it be its address?
I anticipate again being not understood, so another anaolgy: call 1-800-555-1212 and ask then what number you dialed. You already know!
a7
Then I must not understand I2C.
Can an I2C slave respond to packets that do not know its address? I find "general call" googling, but don't see how it could be employed in any scanning process.
If you need to know the adderss of a slave to talk to it, why would one of the things you can ask it be its address?
I anticipate again being not understood, so another anaolgy: call 1-800-555-1212 and ask then what number you dialed. You already know!
a7
Here's an interesting reading. https://howtomechatronics.com/tutorials/arduino/how-i2c-communication-works-and-how-to-use-it-with-arduino/
But long story short, you need to know the address of the device in order to comunicate with it.
Imagine you add N numbers of nodes, each an everyone with a different address, if you don't have a way of finding them automatically then you'd have to enter each an everyone by hand so that the software recognizes them. But instead you can scan a range of addresses (max of 8 in this case), and store them them whenever you get an ACK. You don't know if the user is going to have 2, 4 , 8 or maybe just one. Plus, if we decide to support more, we can just go and add new addresses to the array.
https://github.com/scottgchin/delta5_race_timer/blob/47a35739f8de409c27af11655828dc35512c076c/src/delta5interface/Delta5Interface.py#L78
Thank you. The READ_ADDRESS command appears to only be used to see if the device is there. Any other command would have sufficed. By either succeeding or failing the presence of a node can be determined.
Or I am still missing something - is there anything about READ_ADDRESS that makes it uniquely work for detecting?
The "report your own address" feature of a device that must be addressed to get a report seems odd.
a7