Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hacker's question #88

Open
alto777 opened this issue Nov 5, 2018 · 6 comments
Open

hacker's question #88

alto777 opened this issue Nov 5, 2018 · 6 comments

Comments

@alto777
Copy link

alto777 commented Nov 5, 2018

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

@scottgchin
Copy link
Owner

Not sure I understand what you're asking.

@alto777
Copy link
Author

alto777 commented Nov 13, 2018

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?

@ntgussoni
Copy link

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.

@alto777
Copy link
Author

alto777 commented Dec 11, 2018

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

@ntgussoni
Copy link

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.

i2c_addrs = [8, 10, 12, 14, 16, 18, 20, 22] # Software limited to 8 nodes

@alto777
Copy link
Author

alto777 commented Dec 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants