0

Corrupt Bluetooth data
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Corrupt Bluetooth data

by jordanklaers on Sun Dec 09, 2018 1:38 pm

Hello I am using a feather Mo with the blueart_datamode example sketch. I have added into more code, Including using the neopixel library, and the I/O expander from sparkfun.

I believe the feather MO and the I/O expander are both using hardware serial. The I/O expander is using I2c serial. If I am sending a constant stream of bluetooth data, and sending parsed values to the I/O expander, sometimes the bluetooth data becomes corrupt.

Does the data get corrupted because the bluetooth and the I/O are using the same clock/timing stuff? Would attempting to use software serial for the I/O expander make a difference? There is an "Optional clock input, or programmable clock signal output" on the I/O expander, which im not sure how to use but might be an option.

I can provide the code if needed.

ps. ( I originally had an hm10 ble module and an arduino, and found that the pixel.show() method in the neo pixel library would cause corrupt bluetooth data, as the hm was connected over hardware serial. I changed to the feather MO and resolved that issue, but now the I/O expander causes a similar problem so thats what led me to questioning the timing and such)

jordanklaers
 
Posts: 2
Joined: Tue May 30, 2017 4:05 pm

Re: Corrupt Bluetooth data

by Mindkind on Sun Dec 09, 2018 5:36 pm

Hi,

I'm actually working on an app receiving temperature from the Feather 32u4 BLE with the MCP9808 temperature sensor.

I get the output perfect in the Arduino SerialMonitor:
Temp: 20.81*C 69.46*F
Temp: 20.81*C 69.46*F
Temp: 20.81*C 69.46*F
Temp: 20.81*C 69.46*F
Temp: 20.81*C 69.46*F
Temp: 20.81*C 69.46*F


Code:
Code: Select all | TOGGLE FULL SIZE
void loop(void)
{
  /*
   * Senseur de température
   */
  // Mettre int au lieu de float pour obtenir 23 et non pas 23.06
  float c = tempsensor.readTempC();
  float ff = c * 9.0 / 5.0 + 32;

  // debug
  Serial.print("Temp: "); Serial.print(c); Serial.print("*C\t");
  Serial.print(ff); Serial.println("*F");

  /*
   * ble.print envoie la valeur à RX 0003 (6E400003-B5A3-F393-E0A9-E50E24DCCA9E)
   */
  ble.print(c);
  delay(500);
}


But in Xcode, sometimes I have missing part of the output such as:
[...]
Temperature Sensor: 20.81°C
Temperature Sensor: 20.°C
Temperature Sensor: 81°C
Temperature Sensor: 20.75°C
[...]


It doesn't seems to be buffering.. I think it's a timing problem but I don't know how to solve it.

Let me know if you have any updates buddy. Same thing for me.

Mindkind
 
Posts: 8
Joined: Mon Sep 03, 2018 12:44 pm

Re: Corrupt Bluetooth data

by ktownsend on Fri Dec 14, 2018 12:14 pm

The source code for our Bluefruit LE Connect app is available here: https://github.com/adafruit/Bluefruit_LE_Connect_v2

One of the tests we do is a throughput sketch where we make sure no characters are dropped, so with the latest firmware (please make sure you update!), this /should/ be OK, but maybe there is something in the source code above that will help on the iOS side?

ktownsend
 
Posts: 1433
Joined: Thu Nov 05, 2009 2:18 am

Please be positive and constructive with your questions and comments.