Please no need to apologise. The slave device I am using is a PLC. I dont know how to change the baud rate of the device. I have a document that just says supported baud rates are 1200,2400,4800,9600,38400,57600 and 115200. So i thought I dont need to change it. It automatically works on all these baud rates is what I thought. If I need to change the baud rate then I have to find out how.
Believe me, there is no such thing as an automatic baudrate on a serial port. Any serial interface can work with only one speed at a time.
So, go digging into the documentation to search how to change the speed on the PLC.