The error was with the inital setting of the port.
By modifying the same, i am able to do the data transfer