FTDI/ATmega328 @ >115200 baud

I recently purchased a FTDI FT232RL (sku: DEV-08772) and ATmega328 (sku: DEV-09220). But, I cannot get them to work at baud rate faster than 115200 (using Mac OS 10.5.8 or Ubuntu 8.10).

The FT232RL datasheet says it supports data transfer rates from 300 baud to 3 Megabaud (RS422 / RS485 and at TTL levels) and 300 baud to 1 Megabaud (RS232).

The ATmega328 datasheet says the max speed (UBRRn = 0) for Asynchronous Double Speed mode (U2Xn = 1) @ 8 MHz = 1,000,000 baud.

I have done several google searches for the maximum baud rate supported by the Arduino software, but haven’t found any answers. I’ve also searched the SparkFun forums, but also didn’t find anything.

I have tried a Processing Sketch, several terminal programs and stty & ‘cat’ on linux, but I just get gibberish above 115200 baud.

Any Ideas?

thanks,

glenn

Have you calculated the baud rate error for the baud rate you’ve chosen and the crystal’s frequency? Need to be less than about 1.5%.

Also, if you go to RS232 voltage levels, some of those level shifters have bandwidth limitations.

If the UART is interrupt driven, you can run in to limitations for devices that lack a hardware FIFO.

Generally speaking, UARTs at 115Kbps and up are arguably a misapplicaiton.

I’m using TTL levels on the FTDI. On the suggestion of Jim @ SparkFun, I did a hardware loopback test on the FTDI and it works fine up to 1 Mbps. At 3 Mbps, I had some data loss, but this was likely b/c of the old USB controller I was using.

The product page for the Arduino Pro Mini 328 - 3.3V/8MHz ( http://www.sparkfun.com/commerce/produc … ts_id=9220 ) says the external resonator has a 0.5% tolerance. I don’t know how to calculate the baud rate error based on that.

On the Atmega328, the same UART (USART0) can do either “traditional” serial or SPI at up to 10 Mbps @ 5v/20 Mhz (Fosc/2). So, I don’t think it should be having problems at 230,400 bps.

I’m going to replace the resonator with an oscillator and try again.

thanks,

glenn

glennpowers:
On the Atmega328, the same UART (USART0) can do either “traditional” serial or SPI at up to 10 Mbps @ 5v/20 Mhz (Fosc/2). So, I don’t think it should be having problems at 230,400 bps.

SPI is a little different. It’s a synchronous serial protocol: there’s a master that drives the bus and provides clock pulses that are used to tell the slave when to read data from or write data to the bus. The problem you’re experiencing with your asynchronous serial connection is that the serial data speed is so high that minor timing differences between the FTDI chip and the ATMega are causing the receiver’s bit sampling to fall out of sync with the sender’s bit stuffing. There’s no clock line on an asynchronous serial link, so the two ends of the connection need to use good-quality time sources to ensure the data rates at each end of the link match up.

ceramic resonators are not so stable.

Even with an 8.000000 MHz crystal, the UART baud rate error fot 115K in a mega chip is 8.5% - whereas the goal should be 2% or less. That’s why people use 14.7456MHz crystals for high baud rates.

stevech: how do you calculate the baud rate error?

thanks,

glenn

It’s in the data sheet, under the USART0 section. Look at Table 17-9. “Examples of UBRRn Settings for Commonly Used Oscillator Frequencies”

/mike