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

How nodes reset should be accomplished when flashing (new PCB too)? #262

Closed
szafranski opened this issue Mar 6, 2020 · 25 comments
Closed
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@szafranski
Copy link
Contributor

szafranski commented Mar 6, 2020

So hello - especially to devs. I have a question according to nodes flashing "system" that I developed (big word, but what do you do). As you may know that approach was proven to be working on few platforms. In a nutshell: Raspberry sends "flashing data" via UART and Arduino that was recently reset is being programmed - because that's how bootloader works. Right now each node is being reset using Raspbery GPIO. So every Arduino has a reset pin connected to some of the GPIO pins of R-Pi. I even designed a new PCB with those changes in mind - and it can be achieved with proper cabling etc. So it just works. But I was thinking recently - are all those cables necessary? And I came up with an idea, that I2C bus can be utilized for reset purposes. (I performed some prototyping and it looks promising). I will paste my discussion with Michael (few messages):

My idea:
Arduinos may be reset via "themselves" by a command from a I2C bus. How?
If some command on I2C shows (may be anything, depends of the code on the Arduino as you know) it would perform digitalWrite D2 (or any other pin) LOW - and that would be connected to the reset pin of the NEXT Arduino. Why next and not to it's own reset pin? Redundancy. After some poweroloss or any error during programming, the "resetting" Arduino would still have ability to reset the "next" Arduino and Raspberry could program it again. That way only first Arduino would require connection between reset pin and Raspberry. So resetting would be "software based" but still safe.

Michael idea (good tbh) - Arduinos should be "paired", so Arduino 1 should perform a reset on Arduino 2 etc, 2 on 1, 3 on 4 and 4 on 3. Etc.
I agree.

Conclusion:
GPIO resetting:
Pros:

  • Simpler to understand
  • No changes in node code (besides disabling serial)
  • Already coded and tested
  • If 1 nodes totally fails 1 node can’t be flashed
  • Odd number of nodes is supported
    Cons:
  • Much more cables
  • Spare LED data pin to be solved

I2C:
Pros:

  • WAY less cables and “ports” required (especially important if someone won't use PCB with this feature implemented)
  • Easier PCB designing and implementing
    Cons:
  • Odd numbers aren’t supported
  • Arduino node code change required
  • If 1 node totally fails 2 nodes can’t be flashed

So, devs, what do you thinks?
Cheers

@szafranski szafranski changed the title How nodes reset should be accomplished (new PCB too)? How nodes reset should be accomplished when flashing (new PCB too)? Mar 6, 2020
@HazardCreative HazardCreative added the enhancement New feature or request label Mar 6, 2020
@szafranski
Copy link
Contributor Author

More like "enhancing question" :)

@HazardCreative HazardCreative added the question Further information is requested label Mar 6, 2020
@szafranski
Copy link
Contributor Author

I don’t know if I will have ability to perform much tests after a week or so for sometime. If you have any ideas/insights, even small - will be glad :)

Nice day!

@HazardCreative
Copy link
Member

The "pairing" strategy could make this easier to manage because it would be built into a PCB with no user intervention. However, such a strategy would not be effective should a timer be built with an even number of nodes.

The "chain" strategy allows any number of nodes to be used, but makes the system more complicated to wire up.

Either way, if a node goes down, you lose the ability to self-update two of them (the broken one and the one it signals).

@szafranski
Copy link
Contributor Author

Agree. Idk if you get that above I was comparing i2c resetting and gpio based resetting. Not i2c and “chain”. “Chain” has no benefits over i2c - I agree.

@HazardCreative
Copy link
Member

I think setting up resets via node commands makes a lot of sense, and pairing makes a lot of sense to me as well. Even with an odd number, you could still fall back to manual updating as the project has always been. I don't really like how much of the GPIO your current working implementation requires. New node command code should be pretty minimal.

Interested in thoughts from @ethomas997 and @pulquero on this.

@szafranski
Copy link
Contributor Author

szafranski commented Mar 9, 2020 via email

@HazardCreative
Copy link
Member

That's a really good idea, actually. I like it.

@szafranski
Copy link
Contributor Author

szafranski commented Mar 9, 2020

Meantime I will write what should be figured out:

  1. What pins should be used as reset ones
    (And if those pins should be same on both nodes in a pair or 1 should utilize D12 and second D2 due to physical placement etc)
    *** Answer is D12 on both - just figuread it out. Why? Cause it has another "input" on the ICSP header so it will be easy to access in "back-up"/"odd-number" case.
  2. What command should be send to make the node entered reset mode (just pulling 1 pin low for a sec - resetting another node)
  3. Who will provide that functionality to the code - few lines to send/receive some command via I2C.
  4. Be sure that this command won’t be sent any other time. During prototyping some byte value was sent via server start causing 1 node to reset etc - minor challenges.

Anything else?

@szafranski
Copy link
Contributor Author

I have found only one downside of this “new” way of resetting. Nodes should be flashed just once via PC before inserting in the timer. Nothing life changing - just to be aware of.

@HazardCreative
Copy link
Member

They could be done one at a time through the single GPIO reset (or at least one per pair). I expect the board would have jumpers for each nano to be temporarily connected to the GPIO reset. The user would move the jumper across one at a time during initial setup, and then leave it on the odd-numbered node if appropriate afterward.

Let's avoid D12, otherwise we would need to set up an alternate when ARDUVIDRX wiring is used. (Rare but occasionally useful for some developers). Could D8 be used? Boards using this system should not be designed to the legacy hardware address selection spec, but I'm not sure if this would mess with the initial detection of pin grounding. If not, perhaps A1.

At this point I'm pretty comfortable with this and ready to move it forward as a spec to be integrated into PCB and nano code.

Give me a bit of Arduino code that accomplishes the task and I'll make sure it gets into the current nano code in the right place. The command sent to the node could be 0x73. Obviously a different method is used for the GPIO reset, but the existing work here can be used as a guide.

@szafranski
Copy link
Contributor Author

szafranski commented Mar 10, 2020 via email

@szafranski
Copy link
Contributor Author

Why board with this system could not utilize legacy numbering system? No idea why that’s might be the case.

@szafranski
Copy link
Contributor Author

szafranski commented Mar 10, 2020

And yet another thought - I am not editing previous messages so you can reply via email:
Do I get it right, that right now serial won’t have to be disabled permanently? If code would look like:

if Arduino got the resetting message (
Disables serial as for a 2 minutes or till next boot

If arduino got resetting message dedicated for it (
It resets another node in a pair
) )

So effectively 2 messages would be sent - general reset and specific reset.

@szafranski
Copy link
Contributor Author

I was writing from mobile - sorry for edits

@HazardCreative
Copy link
Member

Why board with this system could not utilize legacy numbering system? No idea why that’s might be the case.

Because no boards should be designed to the legacy spec in the first place.

@szafranski
Copy link
Contributor Author

Ok. So it is not related to this from hardware point. I get it though. Is there any new recommended way to make auto selection? Any definitive conclusions?
And what do you think about those D12 pin pros?

@HazardCreative
Copy link
Member

Refer to #252 for the auto-numbering discussion, which seems to be narrowing in.

I haven't had the time to fully understand the implications of using D12.

@HazardCreative
Copy link
Member

HazardCreative commented Mar 12, 2020

To clarify, the proposed spec is this:

image

  • One GPIO is connected to all nodes' reset lines, but each has a normally-open jumper in the line
  • Only ONE jumper is allowed to be closed at a time
  • Node pairs connect an output pin the the paired node's reset line
  • On a PCB, the jumpers should be standard header pins and not solder bridges.
  • For timers with an odd number of nodes, the jumper is left in place on the last node (the one without a mate in the pairing)

For the Arduino pin, D12 can be the default if we require the alternate ArduVidRx wiring to move this assignment as well. I think this is reasonable.
For the Pi pin, GPIO 17 (pin 11) has been suggested.

I propose the above as the official spec for this.

Any final objections?

@szafranski
Copy link
Contributor Author

Sounds reasonable.

@sl33pydog
Copy link

No objections from me

@szafranski
Copy link
Contributor Author

szafranski commented Mar 13, 2020

Idea: connecting RXes VCC line (usually about 3V3) to the AREF pins of Arduinos + enabling AREF as external based.

Advantages - readings "scaled" better and higher resolution of readings - if I get it right?
Also readings will be independent of Arduinos supply voltage.

Disadvantages - 4 more PCB traces

What do you think?

@HazardCreative
Copy link
Member

Unrelated to node reset spec.

@HazardCreative
Copy link
Member

Specification is final and published here. https://github.com/RotorHazard/RotorHazard/wiki/Specification:-Node-hardware-reset

@szafranski
Copy link
Contributor Author

Unrelated to node reset spec.

Right, will open new issue

@HazardCreative
Copy link
Member

#277 contains I2C write command with function stub only. Requires code to perform reset of other node and testing.

HazardCreative added a commit that referenced this issue Apr 12, 2020
Node hardware addressing and ISP reset command. Implements specs in #252 and #262 .
@HazardCreative HazardCreative added this to the v2.2 milestone May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants