So I have a python script that is using the raspberry pi serial RX,TX to communicate with a 4D System Display. It is working just as I want it to work, BUT, when I modify the /etc/rc.local to let this script run automatically at startup, and apply a reboot, the screen which uses the serial interface is not working. Knowing that all other tasks are working correctly, just the serial interface didn't work. So the problem might be that my script is running before serial interface is booting completely. so is there any workaround for such situation?
I found the solution just in case someone else faced the same issue, the solution is to use crontab instead of rc.local file:
sudo crontab -e
Scroll to the buttom and add this line:
@reboot python /home/pi/MyScript.py &
In the Python file, import time and add a time.sleep(seconds) in the beginning of the code. Also in the /etc/rc.local file, add a "&" sign together with the line starting the python script.
This will allow the pi to boot completely while still starting the python file automatically, this should work :)