[ECOS] read from user port

Gary D. Thomas gary.thomas@mind.be
Tue Mar 11 01:05:00 GMT 2003


On Mon, 2003-03-10 at 17:40, Katerina Malatara wrote:
> 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.

Can you provide more of your program?  Theses two pieces seem
fine, by themselves, but we'd need to see the larger picture
to understand what's not working.

Also the details of how you configured eCos, etc, would be
most useful.

-- 
.--------------------------------------------------------.
|       Mind: Embedded Linux and eCos Development        |
|--------------------------------------------------------|
| Gary Thomas              email:  gary.thomas@mind.be   |
| Mind ( http://mind.be )  tel:    +1 (970) 229-1963     |
| gpg: http://www.chez-thomas.org/gary/gpg_key.asc       |
'--------------------------------------------------------'


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



More information about the Ecos-discuss mailing list