reading from uart causes transmit

QNX 6.4.1 on BeagleBoard

I’m trying to read from UART2 using the code below but every time it reads it transmit a character :confused:. Am I reading incorrectly?

int main(int argc, char *argv[]) {
	unsigned char readbuffer[80];

	fd = open ( "/dev/ser2", O_RDWR );

	while (1) {
        	read(fd, readbuffer, sizeof(readbuffer));
		printf("%s\n", readbuffer);
		sleep(3);
	}

	close (fd);
	return EXIT_SUCCESS;
}

what you are doing is basically correct, although the printf is dangerous because if the string does not end with a null or if no string is receveid at all the printf may go crasy.

I don’t see anything in there that I could use to explain why something would get transmitted.

It is strange…

qtalk -m /dev/ser2 “reads” fine without transmitting anything.

Here is what I’m using in the build file for the drivers:

devc-seromap -e -F -b115200 -c48000000/16 0x49020000^2,74
devc-seromap -u2 -e -F -b57600 -c48000000/16 0x4806C000^2,73

Use the debugger, go step by step and figure out which instruction cause transmission. Maybe that will give us a clue.

I tried using the debugger but it stops at a certain branch instruction. It’s definitely the driver that’s causing the transmissions.

The transmissions stop if I use raw mode instead.

bad:
devc-seromap -u2 -e -F -b57600 -c48000000/16 0x4806C000^2,73

good:
devc-seromap -u2 -F -b57600 -c48000000/16 0x4806C000^2,73 (default raw mode)

Thanks again mario.

What are the stty options before you put the line into raw mode?