Home > other >  Write using Linux with a serial port function to send data to lower place machine failure?
Write using Linux with a serial port function to send data to lower place machine failure?

Time:09-30

The younger brother to lower place machine using Linux in the write function to send data code below
String s_command="$CFGMSG, 4, 1";
Char * command=new char [s_command length () + 1);
for(int i=0; I & lt; S_command. Length (); I++)
{
The command=s_command [I] [I];
}
The command [s_command length ()]='\ 0';
Int n=write (fd, command, s_command. The length () + 1);
Cout & lt; <"N" & lt; S_command this string is I want to send to the next bit machine orders, he put in command of the dynamic array, and then to write this command using the write function into the fd device, the return value n is normal, but the machine seems to be no response, I don't know how to get? There are under the guidance of the eldest brother?

CodePudding user response:

A serial port parameters are consistent?
With another serial port + serial debugging assistant to see if normal?

CodePudding user response:

PC normally receives the data of the board, but write data using the write function is not successful

CodePudding user response:

reference 1st floor zgl7903 response:
serial port parameters are consistent?
With another serial port + serial debugging assistant to see if normal?


PC normally receives the data of the board, but write data using the write function is not successful

CodePudding user response:

Have you solved? I also appear similar problems, under Windows using a serial port assistant debug: no problem, but under LINUX will exist problems, to write the data of a machine to receive less than, I suspect that the data is sent directly to the next bit machine, not a byte of that kind of, but I don't know how to solve the

CodePudding user response:

Measure the interface signals, first segmented debugging
  • Related