arduino and Bluetooth, some garbage bytes

Hi.

I wrote a simple program that reads bytes from BT (SoftSerial on pins 2,3) - based on BC417.
My PC is connected thru USB and it receives data that Arduino Uno received from BT.
BT modules is connected with my notebook - my java program (using rxtx lib, 115200, databits8, stopbits1, parity none)
and it mainly works. I can send bytes and i see them on my PC.

but, sometimes there are ‘bad bytes’ read from BT (i guess there is a problem). One bad byte per 20-30 proper bytes.
Is this some BT flaw? i used TeraTemp (windows terminal) and there were bad bytes too.

I saw that sending a few bytes (mainly chars - ASCII 32< <126) quickly, creates bad bytes - number of read bytes is correct (so there is no insertion or loss) but few bytes can be messed up.
Bytes sent in other direction (PC > Arduino > BT > notebook) are transferred correctly.

Is this a ‘known flaw ?’

my Arduino code is very simple

#define rxPin 2
#define txPin 3
SoftwareSerial mySerial(rxPin, txPin);

void setup()  
{
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  mySerial.begin(115200);
  Serial.begin(57600);
}

void loop() 
{
  if (mySerial.available())
  {
    byte ch=mySerial.read();
    Serial.write(ch);
  }

  if (Serial.available())
    mySerial.write(Serial.read());
}

Is this a 'known flaw ?'

The only known flaw is not reading the data fast enough. And, of course, not posting your code.

By the way, there is no SoftSerial class...

Java program sends thru BT chars to Arduino: " " + counter + " \n" and this is what Arduino sends to PC (i see it on serial monitor)

28 29 30 æ1 32 ? 33 3? 35 36 37 38 æ9 40 ? 41 4? ? 43 44 45 46 ?7 48 ? 49 5? 51 52

maybe its a specific behavior of this interface? that user is responsible for checking data errors (thru CRC) ?

maybe its a specific behavior of this interface? that user is responsible for checking data errors (thru CRC) ?

Still need to see your code to say for certain what the issue might be. How would you detect an error in general? In this case, you have an idea what the data should be, so you could determine if the data no longer fit the pattern, but, in general that is not the case.

I’ve never used bluetooth, and there certainly seem to be a large number of issues with it, but surely someone has gotten some blue tooth module to work, and can comment on your code. If you post it, that is.

I've already post it in the first post :)

I read that SoftwareSerial (it's a NewSoftSerial, as Arduino is 1.0) is not 100% accurare. maybe that's the problem ?

I've already post it in the first post

Why? You should not expect people to go scroll back up and re-read previous posts.

I read that SoftwareSerial (it's a NewSoftSerial, as Arduino is 1.0) is not 100% accurare. maybe that's the problem ?

I don't think it is fair to say that it is inaccurate. You are pushing software serial to it's limits at 115200. Any delay in processing an interrupt is going to cause missed/garbled data. That is simply the nature of serial communication.

If you really need to communicate with 2 serial devices at the same time, you really need to get an Arduino (or compatible) that has more than one hardware serial port. The Mega has 4.

well, application don't do anything else right now, so CPU is not loaded. and i think that it's not a nature of serial communication, it's a nature of 'SoftSerial' (without buffers etc) I just wanted second serial for testing/debugging application, anyway i need to learn 'how to use it (AVR)'

Thanks PaulS for looking anyway :) I've managed to connect and send data from notebook and android phone to arduino thru BT (BT connected to serial)

I was able to managed everything toghether this morning :) http://www.youtube.com/watch?v=38Gq1odxaPM&hd=1