Hi all, I am successfully able to write and read data thru serial port using this program but , when I tried with no cable ( or no input, not connecting to any other system or device) at all the program is reading junk characters which is output by the write function ans below is output of the program [root@FriendlyARM /test]# ./p1 /dev/ttySAC2: Success valus of Fd 9 Serial Port reached len of bytes received =1 0 1st read 1 4 0 0 0 c f0 f 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1st write len of bytes received =11 0 c f0 f 0 0 0 0 0 0 0 2nd read [root@FriendlyARM /test]# well what is the solution to avoid junk characters , ( one thing I know is using handshake hardware wise) other solution is controlling through software but I tried almost all different flags but I'm not sure how to do it thanks in advance, armtry.
Serial Port prorgamming
Hi Bill Zimmerly, The source is attached and the p1 is executable which I got by command arm-linux-gcc -o p1 source.c and u get the executable p1 Regards, armtry.
hi all, Please check the modified code in the attachements, I think it is working now important thing to note is the Delay value what we are using in the usleep function thats where the Rx delays are varied arm-linux-gcc -o p1latest serial.c and the result is below with a serial cable connected [root@FriendlyARM /test]# ./p1latest /dev/ttySAC2: Success valus of Fd 9 Serial Port reached len of bytes received =32 62 79 65 35 43 56 56 46 75 46 75 46 75 67 46 45 67 45 75 46 74 56 74 57 45 67 45 67 54 67 54 67 1 4 0 0 0 c f0 f len of bytes received =32 62 79 65 35 43 56 56 46 75 46 75 46 75 67 46 45 67 45 75 46 74 56 74 57 45 67 45 67 54 67 54 67 ///////////////////////xxxxxxxxxxxxxxxx////////////////////// for no serial cable connected the result is below ( try changing the delay value to lowest and maximum the result varies accordingly) [root@FriendlyARM /test]# ./p1latest /dev/ttySAC2: Success valus of Fd 9 Serial Port reached len of bytes received =0 1 4 0 0 0 c f0 f len of bytes received =0 //////////////////////////////////////////// for serial cable connected with loop back condition the result is below ( try changing the delay value to lowest) [root@FriendlyARM /test]# ./p1latest /dev/ttySAC2: Success valus of Fd 9 Serial Port reached len of bytes received =0 1 4 0 0 0 c f0 f len of bytes received =8 1 4 0 0 0 c f0 f ///////////////////// well I think my code needs to be modified , but I need some hand for that as to where it can be tuned more. thanks in advance, armtry.