Closed gstro closed 9 years ago
FINALLY GOT IT
So the chaining structure and algorithm are solid, but I had to make some adjustments to the actual handshake. The updated version looks pretty similar but requires the master to acknowledge the pin-switch by pulling the corresponding SELECT
low with DATA
low and then providing a CLOCK
pulse. This allows the other slave block to witness the handshake but not complete the sequence, thus returning to toggling its SELECT
lines. Ultimately, I had to allow a bit of extra time for that switch, as well as keep (better) track of the triggering lines.
A logic analyzer snapshot of two blocks receiving the vector (0, 1)
is shown below:
To Above Block
To Right Block
m_t_above
and m_t_right
lines (connected to slave blocks' from_below
and from_left
pins respectively)m_t_above
line, acting here initially as a master input and slave output, triggers the m_data
and m_clk
to go high, starting the handshake.m_t_above
line is triggered low, and the master m_data
and m_clk
follow.m_t_above
line high, waits for a brief period, then releases the pin as an output, and changes it into an input aka from_below
. m_t_above
from input to output, and then sinks the current to output a low.m_clk
with m_data
and m_t_above
held low. This completes the handshake and allows the master to send then its vector to the slave over traditional SPI w/ a select that idles low. m_t_right
line (its from_left
), allowing both blocks to receive the same vector and increment appropriately. Some features:
I will try cleaning up the code a bit and integrate with the global bus on the proto-blocks soon. The passed vector will simply replace the hardcoded address values so it shouldn't be a big task. Thanks @htylo and @Debrant for talking it through with me. And thanks again @profroyk for the logic analyzer, it was a big help.
Most everyone is familiar with the implementation of the daisy chain discovery but I wanted to provide more detail and solicit some feedback on the implementation.
Here is a diagram of 5 blocks to show their connections:
A gif animating a new block connection is shown below The steps are outlined here:
from_left
andfrom_below
are typically inputs for a slave block, they are initialized as outputs to signal whichever block supplied it power (master from left or below).from_left
andfrom_below
signals until a response is read on thes_clk
ands_di
lines.Finally, I've included a timing diagram of that custom handshake:
My first code for the daisy chain ran this whole process with a different handshake. It worked most of the time, but it wasn't very robust. I haven't yet implemented the new handshake but will be working on that soon. I suppose that will be the true test -- how well it works on hardware -- but I wanted to propose this updated handshake to the rest of the group, including @erebuslabs and @profroyk, to see if there were any glaring issues. Are there important notes to keep in mind when switching a pin like this, other than allow for plenty of time?