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.
Goal:
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)
Problem
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])
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 %)
// 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?