5

As usual, this is a huge project and rather than have the entire thing on here, I'll try to keep it short but try to get all the pertinent information included.

I have a mobile robot chassis with outdated electronics so we've gutted it and are replacing the control systems with a Raspberry Pi and two Arduino Megas (don't ask why, please). The Pi acts as the brain, one Mega handles input sensors and the other Mega handles output to the motor H-bridges. One of the Megas also has a clock signal that syncs all three devices together. So, since the Megas startup in ~1 second and the Pi takes significantly longer, I've added this to the Megas: while(some_pin == low) {} and when the Pi is ready to start, it sets that pin to high.

This works fine except occasionally, maybe 1 in 6 times, that pin will go high and the Megas will start going before the Pi is ready.

So, the first question (and only question if there's a good answer) is simply: are there any GPIO pins on the Pi I can use that are guaranteed to stay low during the boot sequence?

1
  • No, There are no gpios guaranteed to be low.
    – joan
    May 29, 2014 at 21:20

2 Answers 2

3

No. You should use pulldown resistors. The value shouldn't be critical (10k - 100k say) unless there are some other constraints (eg power consumption - unlikely since you are using a raspberry as the controller).

5
  • The internal pull-up/downs are circa 50K. Probably best to use a stronger (lower value) external resistor.
    – joan
    May 29, 2014 at 22:56
  • 1
    @joan, The internal ones are not enabled at powerup. Given the floating pins even work most of the time in this application, it seems the pulldowns wouldn't need to sink much current. May 30, 2014 at 0:05
  • True, for the current firmware,
    – joan
    May 30, 2014 at 4:15
  • As to saving power. Once the megas have broken out of the while loop, you can just reset the GPIO pin to low (or input). So to save power you can just have the Pi set the GPIO to HIGH for just a second or so.
    – Gerben
    May 30, 2014 at 11:37
  • @Gerben Yeah, it's got that feature already so you can run the program multiple times (ie troubleshooting and it still isn't working exactly right... but that's another story) May 30, 2014 at 15:41
1

By default the pins are inputs and therefor floating (except the I2C and UART pins).

Why not flip the required value? You just enable the internal pull-up on the pin on the Mega, and have it wait till the pin goes low (while(some_pin==HIGH)...).

Once the Pi is booted, have it set the pin to output, and LOW. No extra resistors needed.

3
  • Hypothetically, let's pretend I have never enabled an internal pullup. How is that done? May 30, 2014 at 15:42
  • pinMode(pin, INPUT); digitalWrite(pin,HIGH) that is all.
    – Gerben
    May 30, 2014 at 20:53
  • Granted this question is seven years old, but.....I'm wondering why someone who doesn't know how to enable an internal pullup is attempting to control a robot with Arduinos and a Raspberry. Seems a bit ambitious for someone of this level of inexperience. Nov 10, 2021 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.