UART4 not working after bootup - as configured through Systemctl

Hi all,

This is first time I am using Beaglebone black for a development.
I am using Beaglebone Black RevC with Debian Jessie image.

I want an application “shaft_cam” to run at bootup of BBB.
For that I created a .service file in /lib/systemd/system/ folder.

[Unit]
Description=Shaft Cam

[Service]
WorkingDirectory=/root/
ExecStart=/root/./start.sh
SyslogIdentifier=shaft_cam
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

And my start.sh contains the following

#!/bin/bash

#sudo su -c “echo BB-UART4 > /sys/devices/platform/bone_capemgr/slots”
#sudo sh -c “echo BB-I2C1 > /sys/devices/platform/bone_capemgr/slots”

echo 44 > /sys/class/gpio/export
echo 45 > /sys/class/gpio/export
echo 23 > /sys/class/gpio/export
echo 26 > /sys/class/gpio/export
echo 47 > /sys/class/gpio/export
echo 46 > /sys/class/gpio/export
echo 27 > /sys/class/gpio/export
echo 65 > /sys/class/gpio/export
echo 22 > /sys/class/gpio/export
echo 49 > /sys/class/gpio/export

/root/./shaft_cam

So in my start.sh, adding BB-UART4 overlay is done, before calling shaft_cam.

But after restart shaft_cam is executed, but UART4 is not working.

But at the same time when I examine the folder /sys/devices/platform/bone_capemgr/, slot-4 (for BB-UART4) and slot-5(BB-I2C1) exists there.
This is happening at every power up.

That is the shaft_cam which includes UART4 operation is running(as indicated by LEDs), but UART4 operation is not happening.

After booting is completed, if I kill shaft_cam, and run it in one terminal with the command ./shaft_cam, everything is working (without any other changes).
After restart only UART4 operations are not working. Stopping it and invoking from a terminal everything including UART4 operations are working.

When I captured bootup messages through Putty, I observed the following (the messages are given in the attached file BOOTUP MESSAGE.docx )

BB-UART4 capemgr is executed after shaft_cam (as seen in BOOTUP MESSAGE.docx)

Whether UART4 is not working at bootup because of this ?
If so how can I make capemgr executed before shaft_cam ?

Thanks & Regards,
Sajeevan.K

BOOTUP MESSAGE.docx (76.1 KB)