This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

read from user port


hi,
i work with a e7t board and i try to read from user port. I have connect the user port with com2 of my PC.
The PC read some data from a file store them in a buffer and then it send them through serial port to the board. The board must receive the data and response by sending some other data.


I use baudrate 38400.

The PC use this function in a loop in order to send all the data in the buffer
void outbyte(int fd, char c)
{
int n;


	n = write(fd, &c, 1);
	if (n < 1) {
		printf("Error %d: Can't write to serial port\n",n);
		return;
	}
}

And board use the function
char inbyte(cyg_io_handle_t handle)
{
	char temp[1];
	Cyg_ErrNo n;
	cyg_uint32 len = 1;

	n = cyg_io_read(handle, temp, &len);
	if(n != ENOERR) {
		diag_printf("Error %d: Can't write to serial port\n",n);
		exit();
	}
	return (temp[0]);
}

but receive only the last character.

I can't understand where is the problem.

Please help me.



_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



-- Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]