[En-Nut-Discussion] Translation of \n to \r\n
Ajit Narayanan
ajitn at inventionlabs.in
Mon Dec 1 10:06:09 CET 2008
Thanks Ole, this indeed fixes the problem.
Ajit
> 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
>
More information about the En-Nut-Discussion
mailing list