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]

Re: read from user port


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 dot thomas at mind dot 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


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