We issue the command 'Q' but there is no answer back

We issue the command ‘Q’ but there is no answer back by the serial port. However, when we issue “SS” or “VER” commands then the answer from “Q” command does appear for instance “.” and afterwards the start up string or the firmware version. It is like the answer was stored in the registers instead was transmitted through the serial port. Any suggestion??

Thanks.

What are you using to communicate with the SSC-32? LynxTerm? Your own program? Need a more accurate problem description.

We are using our own program implemented in C. The “read” function is designed as follows:

[code]int ReadAdrPort(char* psResponse, int iMax)
{
int iIn;
char buffer[254];

printf("in ReadAdrPort iMax=%d\n", iMax);

if (fd < 1)
{
    printf(" port is not open\n");
    return -1;
} // end if

strncpy (psResponse, "N/A", iMax<4?iMax:4);
iIn = read(fd, buffer, iMax-1);
strcpy(psResponse,buffer);
printf("psResponse/nbytes: %s/%d\n",buffer,iIn);

if (iIn < 0)
{
	if (errno == EAGAIN)
	{
		return 0; // assume that command generated no response
	}
	else
	{
		printf("read error %d %s\n", errno, strerror(errno));
	} // end if
}
else
{
	psResponse[iIn<iMax?iIn:iMax] = '\0';
    printf("read %d chars: %s\n", iIn, psResponse);
} // end if

return iIn;

} // end ReadAdrPort[/code]

Hope help u.

Have you tried testing the commands using LynxTerm?

Again it would be good to have additional information. Like what platform is this on? Which version of C are you using. How does your read work? Are there timeouts? If so what is it set for? Some implementations may be such that it does not return the data until it receives a complete line of text, which is why the command “VER” would work fine as it returns a complete line of text.

Kurt

The program is running under Linux Debian 5 and the it is designed in ANSI C and compiled with a gcc version 4.3.2. As you can see in the read function there isn’t any timeout. When we issue a ‘Q’ or even an ‘A’ command the result from the read method is -1 so it 's like it wasn’t any reading, however it goes fine with “VER”,“SS” commands retrieving the at the same time the answer from Q and A, previous commands. Do you know what’s going on?

Sorry, but I am not a Linux expert. I am suspecting that the Linux serial port driver buffers data up and only passes it up when it receives something like a CR or potentially some timeout. I would look at what options I had when I opened the logical file associated with the port…

Also I would look into timings of your program. That is if you quickly issue the “Q” and then do the read. It could be possible that the data has not had enough time to propagate up to the buffer… You might try putting a slightly delay in and see if it does come through.

Good Luck
Kurt