Fastest Bluetooth Data transfers from Teensy to Host? Should I use SPI? What module?

Status
Not open for further replies.

CraigF

Well-known member
I am currently finishing a medical device that moves about 1.5 Mbps of data from a Teensy 3.2 to a host PC over the USB serial interface. The system runs for 8-10 hours at a time, and everything is working well.

Now I would like to move to a wireless link with the PC. I know that Bluetooth 2+ extended (and later versions) can move 2 - 3 Mbps using SPP, but I can't for the life of me figure out how anybody is pushing data to the bluetooth module that fast, because all the available breakout modules I can find rely on serial UART communications, with a maximum baud rate just a bit over 900 Kbps. Even that data rate seems unusable, because the Teensy documentation says that the hardware UART data rate will not have stable timing above 115200 baud.

A number of Bluetooth chips support SPI, which seems like an obvious solution, but I could not find a single breakout module that supports SPI for classic bluetooth.

I did find the Adafruit BlueFruit SPI breakout board. Unfortunately it is labeled as a BLE device and all the documentation addresses BLE, with a maximum data rate that is woefully inadequate. However, the chip on that board is a Nordic nRF51822, and the datasheet shows that the chip does support all three Bluetooth 4.0 modes, including a 3Mbps SPP data rate.

The Nordic site says that this chip supports both the Bluetooth Low Energy protocol stack and another protocol stack that's on-air compatible with their nRF24L series of full power high data rate chips.

Does anybody here know whether that Adafruit breakout board / chip will in fact work with high data rates, and if so, what would be needed to make such a thing happen?

Or has anybody got any ideas or answers about how to get high data rates (above 1.2 Mbps) from Teensy to host with any other existing Bluetooth module?

Here's the URL of the Adafruit board:
https://learn.adafruit.com/introducing-the-adafruit-bluefruit-spi-breakout/introduction

And here's the Nordic link
https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822

Thanks for any help or advice!!!

-- Craig
 
If the Bluetooth can handle it - The T_3.2 Serial1 or Serial2 can regularly run 2+ Mpbs.

You many need to expand the Rx/Tx buffers. If Bt supports Hardware flow control you might want to enable that on both if the Bt needs to slow you down.

I've posted - maybe a bing search on that or other will help you find them if you get stuck. I've tried it Teensy to Teensy and also Serial1 to Serial2 on the same Teensy.
 
Ardashsa, I'm live streaming.

I'm using Serial over USB to the host right now, while searching for a serial BT device that will talk to the Teensy at high data rates (they all handle sufficiently high data rates over the BT connection).

I found no real help in any of the Forum posts, except for somebody who gave a few clues about high-speed serial interfaces with a WiFi chip -- I have one on order for testing in case the bluetooth connectivity doesn't pan out.

What are you developing?
 
Hello,

I have a similar problem where I would like faster comms with a bluetooth module. I was wondering if Adarsha or CraigF has any luck with other modules. I have the cheap ZS-040 at the moment and it works OK up to 115200. At 230400 it seems the module just locks up after a bit. Once the module locks up I can't connect to the bluetooth until I cycle the power to it. Then I can send some more data and it freezes again. 3 modules all the same but they all probably have the same firmware as well. The amount of data I can push through it isn't consistent either. 5920 chars first test, 8786 the next.

Thanks, Jeff
 
I have some of the Adafruit breakouts on the way. I want to use them for MIDI communications to a pc host. I expect throughput will not be a challenge, but perhaps latency (I hear from another midi wireless list that latency can be an issue... I know not why).

I'll stay in touch with this post.
As with many things, I don't want to learn the details- I just want easy, fast, low-latency, plug-and-play wireless from the Teensy.
 
The Adafruit BlueFruit LE UART Friends arrived. https://www.adafruit.com/products/2479.
I'm wondering if this will be enough to create a MIDI over Bluetooth solution.
The demo code seems aimed at connecting to an iPhone app through direct serial comm.
That could be helpful for a wireless Teensy config app, but I'm thinking now it won't be seen as a MIDI device by the host,
Of course I want some things in my life to be plug and play.
Anyone with experience with these Bluetooth LE boards?
 
Based on my research, I believe you will be limited to BT "Classic" modules to achieve that sustain throughput. The LE modules claim data rates up to 1MPS, but that includes the overhead packets and is instantaneous. Sustained throughputs on those tend to be more like 40kbps and varies based on vendor/module. We are using the Bluegiga wt12, and while we don't have it working yet, it should be pretty close to what you need.

Hope this helps.
 
That matches what I found in my research as well, you want to stay to Classic modules and not LE modules if you want throughput. I moved to a RN-42 module at the moment communicating with Teensy @ 460800bps with CTS/RTC flow control though I have not tested actual throughput as of yet. It is definitely better than the ZS-040 boards I had.

But according to http://ww1.microchip.com/downloads/en/DeviceDoc/50002328A.pdf the RN-42 is only capable of

Sustained SPP data rates: 240 Kbps (Slave mode),300 Kbps (Master mode)
HCI data rates: 1.5 Mbps sustained, 3.0 Mbps burst in HCI mode

So I suspect I am getting 240Kbps +/-

Jeff
 
ive received and trying to use a RN-41, being the only one in the loop its running fine, at least the configuration mode, havnt tested the data through put yet
after moving it to my project, it seems to be loosing data, even by just reading the settings in the configuration settings of the chip
I send a "D" to show the status of some data fields, and about half the data returns, which I think is exceeding the 64byte uart buffer (im using Serial6 for BT)

Code:
void setup() {
  Serial.begin(9600);

  Serial6.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  Serial6.print("$");  // Print three times individually
  Serial6.print("$");
  Serial6.print("$");  // Enter command mode
  delay(100);
}

void loop() {
  if( Serial6.available() ) Serial.print((char)Serial6.read());  
  if( Serial.available()) Serial6.print((char)Serial.read());
}

this works fine without any other code, but data goes missing even for a configuration read with other code in sketch

best method to resolve this? CTS/RTC? SerialEvent6? Interrupts?
 
Hello,

I'm using Serial 1 & 2 vs 6 and also upped the buffer in the serial code from their default 64 but adding debug code I have not seen my serial buffer getting used beyond 64char (usually it's around 40-50 char after my sensor read cycle)

If all you are doing is effectively a serial pass-through like above there should be no reason to loose data. The Teensy shouldn't have any issues with keeping up with just that.

Jeff
 
its not the data, the config settings blast more than 128 characters, i kept upping the serial6 buffer until it settled, and using serialevent6, but yeah for data should be fine
 
other than getting the uart communication working with BT and can configure it fine, when i go to pair, it pairs fine, but the connection "locks up" and freezes the windows terminal

i tried it with and without RTC<->CTS jumper

Tony
 
Solution?

other than getting the uart communication working with BT and can configure it fine, when i go to pair, it pairs fine, but the connection "locks up" and freezes the windows terminal

i tried it with and without RTC<->CTS jumper

Tony

Did you every get this solved I am having the same issue? I am using hardware flow control and device connects and streams data using android but on windows the device crashes.
 
I want to connect teensy to android via ble. What breakout are you using. What connections from teensy to ble, what teensy software, what android software? Big questions I know but I would like to start from a known functioning point. Thanks, richard
 
So, I have a system up.
I have connected my Teensy 3.1 to an Adafruit bluefruit friend through Serial1 using hardware CTS/RTS.
I have compiled the code and have added this one change to Adafruit_BluefruitLE_UART.cpp to handle the Teensy's hardware port in the begin function:
if (hs) {
hs->begin(9600);
// FERRARO ADDITION FOR TEENSY
#if defined(__MK20DX256__)

#define TEENSY_CTS_PIN 18
#define TEENSY_RTS_PIN 19
Serial1.attachCts(TEENSY_CTS_PIN);
Serial1.attachRts(TEENSY_RTS_PIN);
#endif

I didn't feel like screwing with the library to make new constructors to pass in the pins - at this point.

I have connected the device as follows:
bluefruit Teensy
RTS 18 (cts)
CTS 19 (rts)
TX0 0 (rx1)
RX0 1 (tx1)
MOD 15

I followed the instructions to download the adafruit libraries as well as loading the Android Ap on my phone.
Everything is working so far including chatting, sending phone accel/gyro/gps data to teensy, and GATT.

sweet.
 
Status
Not open for further replies.
Back
Top