Which should be powered on first (raspberry pi or 3d printer)?

I would like to know which should be powered on first (raspberry pi or 3d printer) and how long should I wait to power the second device?

The reason for this question is because I noticed that the rpi would not always connect to the 3d printer (via USB) so I think the order that the devices are powered on has something to do with it and also the wait time before connecting to the 3d printer.

I would randomly get this error

Error: Failed to autodetect serial port, please set it manually.

Currently it is set as
Serial Port = AUTO
Baudrate = 115200

I personally don't think it matters. In my case, I use the printer power supply to power the Pi (using a buck converter), therefore they both power up simultaneously. I sometimes get an error when trying to connect to the printer but a retry one time usually is all that is needed.
In my system for some reason, I must use auto detect the baud rate or it will not connect at all if I pre define it.

Country Bubba

What are you pre-defining it as?
I know octoprint likes to default to 250000.
I manually set mine to 115200 and it connects every time

I have tried manually setting it to 115200 (which I know works from previous experience with other software) and it will not connect even though I have tried it multiple times. Setting it to auto will connect most of the time, but sometimes takes two tries.

I power up both at the same time.
For the printer boots faster than the RasPi with OctoPrint, OctoPrint can establish the serial connection to the printer when it is ready.

Assume for a moment that you're OctoPrint and the printer's controller board isn't ready yet. You're set to auto-connect. You then try walking through the different baudrates and such (once) and then give up if it wasn't ready when you tried. But of course, the user can always press the Connect button to try again.

Obviously, the printer's control board should be ready when OctoPrint attempts to connect for the easiest setup. As suggested the code is usually smaller and boots faster than OctoPrint. Just power them both on at the same time. (I power my Raspberry Pi from a 5V line from my printer's controller board.)

I always power the Raspberry Pi first, because I have a relay board that controls the printer power, and it only works if the pi is running. If the pi is not running, I can´t power-on the printer.

To avoid too much noise, my printer powers on automatically when it starts printing, and powers off after the printing finish.