From: Dave Hylands <dhylands@gm...> - 2008-01-14 16:07:23
> I am using Robostix UART0 as a serial interface to a device that runs at =
> baud rate of 38400 bps without flow control and 8N1 Configuration.
> My Hardware.h file as the follow UART settings:
> #define UART0_BAUD_RATE 38400
> #define UART1_BAUD_RATE 38400
> #define UART_DATA_BIT_8 (( 1 << UCSZ1 ) | ( 1 << UCSZ0 ))
> #define UART_PARITY_NONE (( 0 << UPM1 ) | ( 0 << UPM0 ))
> #define UART_STOP_BIT_1 ( 1 << USBS )
> #define UBRR0_INIT (( CFG_CPU_CLOCK / 16 / UART0_BAUD_RATE ) - 1 )
> #define UBRR1_INIT (( CFG_CPU_CLOCK / 16 / UART1_BAUD_RATE ) - 1 )
> #define UCSR0A_INIT 0
> #define UCSR0B_INIT (( 1 << RXCIE ) | ( 1 << RXEN ) | ( 1 << TXEN ))
> #define UCSR0C_INIT ( UART_DATA_BIT_8 | UART_PARITY_NONE | UART_STOP_BIT=
This the the 8N1 (for UART-0).
It requires that the UCSR0C_INIT value actually be stored in the
UCSR0C register, which is done by the InitHardware function inside
I think that it also requires that CFG_USE_UART0 be defined in the
> I wonder if they follow the 8N1 configuration and how i can set to withou=
> flow control ?
The AVR's don't have any flow control by default. In order to have
flow control, we'd have to commandeer a couple of GPIOs and use them,
shich the current code doesn't do.
It's also important that the AVR fuses be programmed properly, or you
won't get the correct baud rate generated.
Vancouver, BC, Canada