Electronic – Help with device identification in a chain

identificationprotocol

I'm working on a new project where I'm trying to identify devices on a closed protocol "network" of sorts.

I'm trying to determine how many devices are out there and the unique IDs of each device. I'll probably have an EPROM or something similar to store the unique identifier.

The question I would have for the forum would be: is a daisy chain the best way to identify the devices? (as shown below)

alt text

I was thinking I could try to also route individual control lines to the devices but I won't necessarily know how many total devices are out there. I will be able to connect the final device back to a return line (physically using a jumper and identified here by the blue dot.)

So again, my question is: is there a better way to do this?

Best Answer

It would help to know what phy layer you're using. But, here's some general information:

If you're using I2C, your bus should look something like this:

(taken from societyofrobots.com)

At runtime, you can detect the I2C addresses by scanning the bus by sending a START condition to every address and checking for an ACK.

If you're using SPI, you'll need a chip select line per device. If you run out of pins, you could use some kind of multiplexer. You may be able to scan the bus by asserting each chip select line in turn and attempting to communicate.

http://kkamagui.springnote.com/pages/422905/attachments/177111