Pages: [1]   Go Down
Author Topic: [Custom ArduinoBT] Problem with communication  (Read 622 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


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])

Anyone has a clue or a few hints ?

Thanks !
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No clues or help. Just a question. Why not avoid the problem and use a 16Mhz crystal? Is size a factor?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 !

« Last Edit: March 04, 2010, 10:19:43 am by nomis » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 274
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Quote
build.f_cpu=7372800L



I see this for use a ATmega328 with a 12MHz crystal.
http://wiblocks.luciani.org/NB1/NB1A-index.html
http://wiblocks.luciani.org/docs/app-notes/boards-txt.html

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

wiblocks_328.name=wiblocks 328 at 12MHz
wiblocks_328.upload.protocol=stk500
wiblocks_328.upload.maximum_size=30720
wiblocks_328.upload.speed=19200
wiblocks_328.bootloader.low_fuses=0xff
wiblocks_328.bootloader.high_fuses=0xdd
wiblocks_328.bootloader.extended_fuses=0x00
wiblocks_328.bootloader.path=atmega328
wiblocks_328.bootloader.file=ATmegaBOOT_328_zb1.hex
wiblocks_328.bootloader.unlock_bits=0x3F
wiblocks_328.bootloader.lock_bits=0x0F
wiblocks_328.build.mcu=atmega328p
wiblocks_328.build.f_cpu=12000000L
wiblocks_328.build.core=arduino
And I must use this scale factor:
Quote
// 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
« Last Edit: April 28, 2010, 05:09:47 pm by userid3456789 » Logged

Pages: [1]   Go Up
Jump to: