master-student - 2022-08-19

I am using Beagle Bone Black as device(similar to raspberry pi), I created a ST program to read one-wire temperature file and make a string value out of it and it works fine when I try it in codesys. but once I made the boot application and when I restart the beagle bone the application it is not working. I tried changing the file location and then restarted the beagle bone and the application seems to be working. Does anyone have any Idea why exactly this file is not compatible?. Thank you in advance.
I included the code bellow~~~

code
~~~PROGRAM FIlE_OP
VAR

sFileName : FILE.CAA.FILENAME;
FileOpen : File.Open;
FileClose : File.Close;
FileRead : File.Read;
iState : UINT;
hfile : FILE.CAA.HANDLE;

END_VAR
VAR_INPUT
xInit : BOOL;

END_VAR
VAR_OUTPUT
xError : BOOL;
xDone : BOOL:=true;
sReadLine : STRING(1024);

END_VAR
CASE iState OF
0:
sFileName := '/sys/bus/w1/devices/28-44260f1e64ff/w1_slave';
xDone := FALSE;
xError := FALSE;
iState:= 3;
3: // Open the file with read access.
FileOpen(xExecute:= TRUE, sFileName:= sFileName, xExclusive:= FALSE, eFileMode:= File.MODE.MREAD);
IF FileOpen.xDone = TRUE THEN
hfile := FileOpen.hFile;
FileOpen(xExecute:= FALSE);
iState := 4;
ELSIF FileOpen.xError = TRUE THEN
iState:= 32767;
FileOpen(xExecute:= FALSE);
END_IF

4: // Read the string from the file.
FileRead(xExecute:= TRUE, hFile:= hfile, pBuffer:= ADR(sReadLine), szBuffer:= SIZEOF(sReadLine));
IF FileRead.xDone = TRUE THEN
iState := 5;
// Cut off the unused characters.
//sReadLine := MID(sReadLine, ANY_TO_INT(FileRead.szSize), 1);
FileRead(xExecute:= FALSE);
ELSIF FileRead.xError = TRUE THEN
iState:= 32767;
FileRead(xExecute:= FALSE);
END_IF

5: // Close that file.
FileClose(xExecute:= TRUE, hFile:= hfile);
IF FileClose.xDone = TRUE THEN
iState:= 0;
FileClose(xExecute:= FALSE);
ELSIF FileClose.xError = TRUE THEN
iState:= 32767;
FileClose(xExecute:= FALSE);
END_IF

END_CASE