8 Replies Latest reply on Jun 25, 2019 7:45 AM by shabaz

    PI race condition prevents startup

    colporteur

      G'Day,

      I have a Pi 3B+ connected to an interface board developed in this RoadTest Review New Year's Grab Bag RoadTest - Review The interface board has its own 3VDC and 5VDC power supplies. If the interface board is powered up before the Pi, the Pi will refuse to start. It starts but I never get network capabilities.  If the Pi is powered up first, bothe the Pi and the interface board operate as designed.

       

      The caveat is, I have one Pi that works without the needed the power sequence and another that will only function if the power is applied in the sequence. I have another half dozen Pi's I can try to see what happens but before that I thought it be nice to white board the issue.

       

      I am "napkin developing" a strategy for investigating and was hoping for some community insight and experiences. COmmentary in the past has enabled me to solve other problems I have posted relatively fast.  I'm thinking this might be a power issue. The Pi power supply is being loaded by the interface board on power up causing it to fail boot. How could I see this on the Pi?  I'm in the infancy of testing at the moment so what to look for and where to look would be of value.

       

      Mother's Day supper is starting so I will have to sign-off. I'm hoping I provided sufficient information to start the discussion.

      Sean

        • Re: PI race condition prevents startup
          shabaz

          Hi Sean,

           

          This kind of behavior sometimes happens if some (say) GPIO pin is accidentally being fed with a voltage when the processor card (Pi in this case) is unpowered. What happens is that there could be a couple of protection diodes on the I/O pad inside the chip, for some small bit of ESD or overload protection, and one diode goes to the positive supply for the chip, and the other goes to ground. Ordinarily the diodes do not conduct, but if the processor is unpowered so that the supply rail is at a low voltage, then the diode will conduct if there is a positive voltage on the I/O pin, causing the supply rail to be pulled up and either fully starting the processor, or causing awkwardness with its reset or partial startup. I can't be sure if this is occurring with the Pi (I don't know what the I/O pins look like internally), but other processors do have such diodes, and would do this.

          So, it is worth checking, with the Pi disconnected, are any of the pins high when just the interface board is powered up? And if so, can that pin source any significant current? (use something like a 100 ohm resistor on that pin to ground, and see if the voltage remains high). If that's the case, then that part of the interface board circuit needs examining (it could be some chip-enable or direction pin to a chip is not pulled via a resistor to the disabled or input state).

          If this is the thing causing the issue, then the explanation why one Pi works, is that either the chip-enable or direction pin happens to float in the right direction, or the protection diode could be damaged.

           

          Another thing that sometimes causes such weird behavior, (again not sure with the Pi, since I'm not so familiar with this hardware in detail) is if some pins on the header serve a double-purpose as boot selection pins. In that case, the processor wants those pins in a certain level to boot correctly. Any different logic levels there during startup could cause the processor not to start up. This too can be resolved in the same way as mentioned above, i.e. scan for any pins high with the Pi disconnected.

          4 of 4 people found this helpful
            • Re: PI race condition prevents startup
              colporteur

              G'Day,

              Much appreciate you sharing your insight.

               

              I'm not sure if my circuit design suffers from the weakness you suggest. I haven't done field samples only napkin research. The GPIO outputs are each connected to a Bi-directional level converter. I have included a schematic but I am not sure if this is the actual silicon or not. I purchased 8 channel modules from a distributor. https://www.banggood.com/8-Channel-Logic-Level-Translator-Converter-Bi-Directional-Module-p-1023173.html?gmcCountry=CA&c…   No schematic provided so I culled this from the internet. Examining the PCB's the circuit looks very similar.

              level converter

              The DC power for the module does not come from the Pi but rather from buck boost boards connected to a 12VDC source.  If I follow your train of thinking, yes the pin (TX_LV) connected to a GPIO point would be high as soon as the buck boost modules provide power to the interface board.

               

              Do you have any suggestions on how to isolate the interface power from the Pi? I'm thinking maybe my design is flawed and the LV supply should actually come from the Pi? I had rather hoped to not use any Pi resources to enable the interface board.

               

              Sean

                • Re: PI race condition prevents startup
                  shabaz

                  Hi Sean,

                   

                  It could be those, although each TX_LV (assuming it is connected that way around, and not accidentally the TX_HV pin) in theory would only be providing a fraction of a milliamp perhaps, there are lots of them, so it all adds up.

                  It could be easy to test, by unplugging all of those modules, and trying to start up the Pi. If that works, slowly add the modules and see if it fails on a particular one, or on a particular quantity.

                  Once that is determined, if it is the case, then yes powering from the Pi's 3.3V supply would solve it.

                  It may be something else though, so it's worth temporarily unplugging them and trying adding them one at a time or  swapping them, to see if the problem goes away at some quantity or some particular module or some position of the module on the board.

                  Regarding isolation, currently it is level conversion that is still only separated by the pins of the MOSFET. For true isolation, then that needs a separate supply (could be derived from an isolated DC-DC converter) but also something like a digital isolator IC (several manufacturers make these). There's nothing wrong with level conversion, it depends on the use-case if that is sufficient. Regarding isolated interface power, if you do want it isolated (although as mentioned this is only partial, since the I/O pins are not isolated, just level translated) then the easiest way is to use an isolated DC-DC converter module.

                  I've just been working on an isolated circuit, I used a DC-DC converter. In my case it was REE-0505SREE-0505S, which gives me an isolated 5V supply (I didn't need 3.3V for my use-case), it internally has a transformer.

                  3 of 3 people found this helpful
              • Re: PI race condition prevents startup
                Jan Cumps

                There’s a term for that symptom: latch-up.

                • Re: PI race condition prevents startup
                  colporteur

                  G'Day,

                  I thought I would give this discussion the tag of being answered. I found this information recently and thought I would share it and get your feedback.

                   

                  I find my mind is like a fridge with post-it notes attached. The notes contain details for unanswered questions. I hope in my daily travels I might run across something that might answer the nagging post-it question, so I can remove it from my mind and make room for other questions that seem to follow.

                   

                  block diagram of bi-directional level shifter

                   

                  Attached is a drawing I found for bi-directional level shifter. My Pi project is still experiencing the race condition. I moved into vacation mode (if such a thing exist for us retired folks) and didn't get back to completing some additional testing to isolate the problem. I am curious if the circuit shown on the bottom would eliminate my problem. The Pi 3.3VDC would provide the low voltage and the high voltage would be externally sourced.

                   

                  I am two months away from being able to do any testing. This seems like a solution to me. Care to comment.

                   

                  Sean

                    • Re: PI race condition prevents startup
                      shabaz

                      Hi Sean,

                       

                      Such a design probably needs testing, and at different voltage scenarios. It's hard to tell, because it's a non-standard layout and there's a lot of combinations to go through. Also I couldn't tell what VDD3 is connected to. I'm wary about such designs, because something could get missed. For example, in that lower design, there's no current-limiting resistor at the gate, it just goes directly to the supply rail. (often a small resistor at the gate terminal is helpful, to protect the gate (e.g. at power-on if whatever supply is connected at the VDD1 or VDD2 end has low impedance). I can see how it might work with 3 MOSFETs per line, by appending a standard layout dual back-to-back MOSFETs to first earlier level shifter circuit, but that lower circuit is trying to do it all in 2 MOSFETs, I guess it is feasible, but just not a scheme I've encountered before, and so would need testing (just a personal opinion.. others may be more familiar with that circuit and what to expect).

                       

                      Also, just to check, is it essential that this design should be self-aware about logic direction, and handle the power sequencing requirement? It gives me warning signals, because it makes the design more temperamental I feel, since now the logic levels are more vague compared to using logic ICs and a fixed direction. In other words one direction logic level translators, restricting the design to have certain connections input-only, and certain connections output-only, or explicitly switched under control of the Pi. Then the solution is easy, the inputs can have logic-controlled enable pin using (say) a tristate buffer. As an example, M74CHC1G125 is really nice, a single component the same size as a MOSFET, with enable pin, and logic level translation, all-in-one. There are various octal offerings too (don't know the part number for one with level translation capability and tristate off-hand, but I'm sure it exists).

                      It's a less universal solution compared to one that is self-aware about logic direction, but it would be rare for anyone to run out of I/O on the Pi if half were allocated for input only, and half for output only. Jumpers could be used too, although personally I find too many jumpers an awkward solution sometimes.

                      Anyway, all the above is all just a subjective opinion from me, which may not meet your requirements. I just thought I'd mention it, just in case it rules in or rules out some more ideas.

                      2 of 2 people found this helpful
                        • Re: PI race condition prevents startup
                          colporteur

                          Dudley Nelson  description regarding the java script issue has hamstring me from replying. The fact this post now works is credit to the EL14 team resolving the issue.

                           

                          I have to taken some time to chew on your replies before I respond. I'm not much for off the cuff comments, unless we were doing white boarding exercise or napkin planning during coffee break.

                           

                          The second circuit (bottom) isolates (a bit better than the first) the low and high PS. Using the top circuit, the Pi must be started first before the interface is powered or it fails to start. In the bottom circuit the low side power could come from with the P supplying the voltage and the high side would be an external 5V power supply.

                           

                          I have included the technical paper that I https://cdn-shop.adafruit.com/datasheets/an97055.pdf

                          Bi-directional level shifter for I²C-bus and other systems. - Adafruit

                           

                          Once I am able to get to the lab (i.e. my basement) I will start some testing.

                           

                          Do you have a drawing of the the three mosfet circuit you describe? The two circuits I have shown are commercially available at less than $4 CA for eight inputs.

                           

                          I did purchase two Pi interface boards from a go fund me project but they cost just as much as a Pi, not making them practical for projects.

                           

                          I find it odd that there hasn't been an Pi interface board developed. A board that has all the GPIO would be exposed, shifted to a higher voltage and protected.

                           

                          My Pi's are in a model railroad environment. I call the user community sparkies, for their ability to generate sparks after hooking stuff up. I am trying to develop an inexpensive board, that can be deployed with sparkies in mind.

                           

                          Sean

                            • Re: PI race condition prevents startup
                              shabaz

                              Hi Sean,

                               

                              The topology below (it's two MOSFETs - the lower third one isn't counted because it can be shared across multiple of these pairs) blocks current in left-to-right and right-to-left direction when the lower MOSFET is off. When the lower MOSFET is on, then current can pass. So, these two MOSFETs could be appended to your existing single MOSFET level converter, to make a 3-MOSFET design.

                              The lower MOSFET needs a series current limiting resistor on the gate, it's not shown in the snippet below.

                               

                              However, for a simpler single-IC design, there are lots of options here: Voltage Level Translation | Overview | Logic Circuit | TI.com 

                              I've not used these auto-direction-switching options apart from PCA9306 which could work, per two pins. It's a TSSOP package but that is hand-solderable. But there are octal chips at that link, which would be more suited for large amounts of I/O.

                              All of these options provide auto-direction-switching with no configuration, but the pullup is weaker.

                              I'm not sure it is a good general purpose solution, for partly this reason. People like driving LEDs (or doing other such slightly higher current things which perhaps they shouldn't) directly from GPIO, and the pullup resistors shown in the original circuit (10k) would make them dim. The TI options are better in this respect.

                              For pull-ups as strong as normal logic, with high current capability, it is not possible without configuration to determine direction I think. It depends on your needs.

                               

                              If you allocate some pins permanently for input, and some permanently for output, then you don't have that issue. There are logic chips with direction control, perhaps with logic translation too.

                              But a design could have complete isolation. For an example of that, see the circuit here:

                              VIKI (Versatile Intelligent Controller for Industry) Schematic, Bill of Materials and Component Placement Diagrams

                              It's open source, so you could copy any of that. It has the advantage of electrical isolation with separated ground, see the section in the schematic marked

                              "isolated sensor interface". There are several chips in the Si864x series see the Si864x Digital Isolator PDF datasheet for this.