Main Site Documentation

Changing Baud rate via I2C


#1

Hi

I have an Alfat USB board connected to a system using a PIC with a 20MHz xtal.

I have been using I2C to communicate with the board. This is proving a bit slow for what I want. So I decided I would use the usart instead.

The problem is that my PIC can’t handle 115200 baud with a 20MHz Xtal - it would be difficult for me to run it any faster because of the application.

So I thought - no problem, I’ll use I2C to change the Baud rate for the Alfat board, then pull the reset pin low, reconfigure the interface pins and then restart the board. Then I would be able to communicate at a slower baud rate.

Seems good in theory but as soon as I change the baud rate (and get an acknowledgement from the board) I am no longer able to communicate with either I2c or the usart.

Can you offer any advice? I don’t want to have to configure the Alfat board ‘off board’ if I can help it.

Many thanks
Peter


#2

Can you change the crystal on the PIC? I have often used even small PIC’s at 115200 baud, but you usually need to use the correct crystal. Something like 18.xxx or 11.059 Mhz or something like that. A faster crystal does not necessarily mean higher baud rate. The data sheets of the PIC usually have a table that shows exactly the ideal crystal to use.


#3

We are looking into adding options for different baud rates to coming ALFAT 2.x firmware. Should be ready Q1 2014.


#4

Hi Kiwisaner (New Zealander by any chance?)

I was looking into that after I posted - from Gus’s reply sounds like that is my only option at least until Q1 2014 :wink:

Looking at my usart calculator 22.1184 gives 0% error at 115200 so I’ll see if I can find one of those in my parts bin (digi-key)

Cheers
Peter


#5

@ peter truman -

That will not work.

how fast is it if you toggle a IO pin per seconds on your PIC?

if you are going to change baudrate from 9600<= baudrate <=115200, i am not sure which faster is, between i2C and UART.
As I remember, at 400KHz, I2C can reach up to 27-28KB/s while uart 115200 was about 10KB/s for writing

What fastest I2C freq you can config on your PIC?