Go Down

Topic: [Custom ArduinoBT] Problem with communication (Read 1 time) previous topic - next topic


Hello !

First a few words about hardware:

We have redesigned an ArduinoBt that is smaller than the classical one. This new arduinoBT runs at 8 Mhz (8Mhz crystal oscillator).
The rest is mostly the same.

Send and receive characters from the pc to the card and to the pc from the card through bluetooth.

A few software tricks I did to make it work:
I had to change the initialization of Serial.begin(115200) to Serial.begin(230400) so that the data sent from the card to the pc is correct. (Else the characters are nonsense).
We first tried to change the f_cpu value in the file board.txt from 16Mhz to 8Mhz but it did not change anything; that is why we changed the baudrate in the serial.

What works

When I send characters from the card to the pc, everything works almost perfectly. (Sometimes a char error ... probably the 8% error due to the baudrate with a chip at 8Mhz)


When I send data from pc to the card, the first char is always correct, then the following are almost all incorrect.Note that if i send char after char with a delay betwee each, it works.(unfortunately I can't use that)
I know this is due to a baudrate problem ....

Note that I also have a normal ArduinoBT and that it works perfectly with it (when using 115200 baudrate of course, [oscillator is 16Mhz])

Anyone has a clue or a few hints ?

Thanks !


No clues or help. Just a question. Why not avoid the problem and use a 16Mhz crystal? Is size a factor?
The art of getting good answers lies in asking good questions.


Mar 04, 2010, 04:17 pm Last Edit: Mar 04, 2010, 04:19 pm by nomis Reason: 1
Hello !

Yeah size of the board is a factor. (We have reduced the size of the board by 2). And also reduced the power consumption of the card at the same time. As it is supposed to stay connected forever ... this was important.

But we solved the problem !

We changed the crystal to a 7.3728 Mhz one.
Changed the serial baudrate to 249418.

And taddaaaa ... it worked.

The probable reason is that there were errors due to the baudrate and crystal. With this baudrate we obtain 0% error (even better than with the 16Mhz crystal which error is 3.18 %)

But thanks for help !


Apr 28, 2010, 11:59 pm Last Edit: Apr 29, 2010, 12:09 am by userid3456789 Reason: 1
Hi nomis,
I want use a ATmega328 8MHz 3.3V with a big baud rate (230400).

On your 8MHz crystal what is the Capacitance in pico-Farad of this crystal?
And what kind of capacitor you use on your crystal?

On your 7.3728Mhz crystal what is the Capacitance in pico-Farad of this crystal?
And what kind of capacitor you use on your crystal?

what I must to do with arduino program for use a ATmega328 with 7.3728Mhz crystal?

I must put this in this file arduino-0018\hardware\arduino\boards.txt?

I see this for use a ATmega328 with a 12MHz crystal.

For the Arduino program is write you must put this in this file arduino-0018\hardware\arduino\boards.txt.

wiblocks_328.name=wiblocks 328 at 12MHz

And I must use this scale factor:
// If you program a 12MHz board after choosing a 16MHz board
// in the boards selection menu you need to adjust the baud
// rate.
// Compensating for the 12MHz XTAL
// 12800 = (16/12) * 9600
// 25600 = (16/12) * 19200

Serial.begin(12800); // 9600 BAUD

Do you can write what do you do for use a ATmega with a 7.3728Mhz crystal with the arduino program?
You must make a .hex file for the bootloader?
With your technique do you have a scale factor for your baud rate?

For use a ATmega+8MHz crystal you use this option on the arduino program menu Arduino Pro or Pro Mini(3.3V, 8MHz) w/ ATmega328?

Thank you

Go Up