I’m working on this project where I need BLE functionality. The Adafruit Bluefruit LE SPI does everything I need it to do (the Nordic UART service is pretty handy and has accompanying apps) and works flawlessly when I test it on an Arduino Nano. As soon as I hook it up to my Teensy 3.6 it starts being erratic. I’m running the example blueart_datamode.ino given with the Bluefruit with the shared SPI settings in BluefruitConfig.h changed to:
For the SPI pins I have MISO to pin 12, MOSI to pin 11 and SCK to pin 13 (LED), as per the pinout diagram for SPI0.
Running the same example program over and over again (by power cycling the system) yields different results. It seems that the inconsistencies are in the communications between the Teensy and the Bluefruit over SPI (since Serial prints just fine when it’s strings stored in program memory). Most times it fails to initialise and by failing at the factory reset command that’s sent in the example script:
I assume rubbish data is being read back, so it can’t check if it’s succeeded at factory reset. When it gets past this stage it reads back some of the data correctly, with the rest being �.
Another trial:
And another:
For reference, here’s what the output is from an Arduino Nano:
I’m assuming there’s some SPI issue, but not sure where to start debugging. Has anyone come across a similar problem before?
Code:
#define BLUEFRUIT_SPI_CS 10
#define BLUEFRUIT_SPI_IRQ 24
#define BLUEFRUIT_SPI_RST 25 // Optional but recommended, set to -1 if unused
For the SPI pins I have MISO to pin 12, MOSI to pin 11 and SCK to pin 13 (LED), as per the pinout diagram for SPI0.
Running the same example program over and over again (by power cycling the system) yields different results. It seems that the inconsistencies are in the communications between the Teensy and the Bluefruit over SPI (since Serial prints just fine when it’s strings stored in program memory). Most times it fails to initialise and by failing at the factory reset command that’s sent in the example script:
Code:
Adafruit Bluefruit Command <-> Data Mode Example
------------------------------------------------
Initialising the Bluefruit LE module: OK!
Performing a factory reset:
AT+FACTORYRESET
<- �����
Couldn't factory reset
I assume rubbish data is being read back, so it can’t check if it’s succeeded at factory reset. When it gets past this stage it reads back some of the data correctly, with the rest being �.
Code:
Adafruit Bluefruit Command <-> Data Mode Example
------------------------------------------------
Initialising the Bluefruit LE module: OK!
Performing a factory reset:
AT+FACTORYRESET
<- OK
ATE=0
<- ��
Requesting Bluefruit info:
----------------
��24539FC8B0������
0.7.7
0.�����0 8.0.0, 0.2����
�
----------------
Please use Adafruit Bluefruit LE app to connect in UART mode
Then Enter characters to send to Bluefruit
Another trial:
Code:
Adafruit Bluefruit Command <-> Data Mode Example
------------------------------------------------
Initialising the Bluefruit LE module: OK!
Performing a factory reset:
AT+FACTORYRESET
<- OK
ATE=0
<- ��
Requesting Bluefruit info:
----------------
��
0.7.7���������0 8.0.0���������
�
----------------
Please use Adafruit Bluefruit LE app to connect in UART mode
Then Enter characters to send to Bluefruit
And another:
Code:
Adafruit Bluefruit Command <-> Data Mode Example
------------------------------------------------
Initialising the Bluefruit LE module: OK!
Performing a factory reset:
AT+FACTORYRESET
<- OK
ATE=0
<- ��
Requesting Bluefruit info:
----------------
�24539FC8B0BF7A��
0.7.7
0.7.7�0 8.0.0, 0.������
----------------
Please use Adafruit Bluefruit LE app to connect in UART mode
Then Enter characters to send to Bluefruit
For reference, here’s what the output is from an Arduino Nano:
Code:
Adafruit Bluefruit Command <-> Data Mode Example
------------------------------------------------
Initialising the Bluefruit LE module: OK!
Performing a factory reset:
AT+FACTORYRESET
<- OK
ATE=0
<- OK
Requesting Bluefruit info:
----------------
BLESPIFRIEND
nRF51822 QFACA10
EDE7415FF4FB08E3
0.7.7
0.7.7
Dec 13 2016
S110 8.0.0, 0.2
----------------
Please use Adafruit Bluefruit LE app to connect in UART mode
Then Enter characters to send to Bluefruit
I’m assuming there’s some SPI issue, but not sure where to start debugging. Has anyone come across a similar problem before?