[En-Nut-Discussion] Translation of \n to \r\n

Ole Reinhardt ole.reinhardt at embedded-it.de
Sun Nov 30 23:14:42 CET 2008


Hi Ajit,

> I am running Ethernut on an AT91SAM7x256 board.
> 
> I find that the following statements:
> 	NutRegisterDevice(&DEV_UART, 0, 0);
> 	file = fopen(DEV_UART_NAME, "r+");
> 	fputc( '\n', file );
> 
> results in \r\n being sent over the UART, instead of just \n.
> 
> Is this the expected behavior? How can I send just a \n?

Seems you have enabled cooked mode. Try the following:

u_long cooked_mode = 0;
_ioctl(_fileno(file), UART_SETCOOKEDMODE, &cooked_mode);

Setting cooked_mode disables cooked mode for this uart and will result
in binary transmission.

Regards,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list