Bluefruit LE SPI Friend "Couldn't Factory Reset'

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RickIoTr
 
Posts: 2
Joined: Wed Jul 27, 2022 8:32 am

Bluefruit LE SPI Friend "Couldn't Factory Reset'

Post by RickIoTr »

Bluefruit LE SPI Friend is unable to Factory Reset. Device is connected to an Arduino Uno.
Followed the guide for the device https://learn.adafruit.com/introducing- ... out/wiring
Arduino sketch followed is the provided example 'factory reset' version 1.8.19
If I load the provided example sketch 'feathertester', requesting 'System Info' from the Bluefruit LE SPI Friend, it returns a series of reverse question marks.
I am able to connect to the Bluefruit using the iPhone app 'Bluefruit Connect' and update the firmware.
Photos of wiring attached. You can see both the blue and red led blinking on the Bluefruit LE SPI.
My assumption is the board is ok, it's either a config option with the s/w, or a bad connection between the Arduino and Bluefruit. I have checked the wiring connections using a multimeter and all the connections seems fine, e.g. 5v+ is going to the board and there appears no dry connections.
I see other forum entries on similar problems, so not a new topic.
Thank you for any thoughts.



Headerfile below:

// COMMON SETTINGS
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE 128 // Size of the read buffer for incoming data
#define VERBOSE_MODE true // If set to 'true' enables debug output


// SOFTWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins that will be used for 'SW' serial.
// You should use this option if you are connecting the UART Friend to an UNO
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SWUART_RXD_PIN 9 // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN 10 // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN 11 // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN -1 // Optional, set to -1 if unused


// HARDWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the HW serial port you are using. Uncomment
// this line if you are connecting the BLE to Leonardo/Micro or Flora
// ----------------------------------------------------------------------------------------------
#ifdef Serial1 // this makes it not complain on compilation if there's no Serial1
#define BLUEFRUIT_HWSERIAL_NAME Serial1
#endif


// SHARED UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following sets the optional Mode pin, its recommended but not required
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_UART_MODE_PIN -1 // was 12 Set to -1 if unused


// SHARED SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for HW and SW SPI communication.
// SCK, MISO and MOSI should be connected to the HW SPI pins on the Uno when
// using HW SPI. This should be used with nRF51822 based Bluefruit LE modules
// that use SPI (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_CS 8
#define BLUEFRUIT_SPI_IRQ 7
#define BLUEFRUIT_SPI_RST 4 // Optional but recommended, set to -1 if unused

// SOFTWARE SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for SW SPI communication.
// This should be used with nRF51822 based Bluefruit LE modules that use SPI
// (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_SCK 13
#define BLUEFRUIT_SPI_MISO 12
#define BLUEFRUIT_SPI_MOSI 11

Sketch below:


/*********************************************************************
This is an example for our nRF51822 based Bluefruit LE modules

Pick one up today in the adafruit shop!

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

MIT license, check LICENSE for more information
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/

#include <Arduino.h>
#include <SPI.h>
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"

#include "BluefruitConfig.h"

#if SOFTWARE_SERIAL_AVAILABLE
#include <SoftwareSerial.h>
#endif

// Create the bluefruit object, either software serial...uncomment these lines
/*
SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);

Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);
*/

/* ...or hardware serial, which does not need the RTS/CTS pins. Uncomment this line */
// Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);

/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

/* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */
//Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO,
// BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS,
// BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);


// A small helper
void error(const __FlashStringHelper*err) {
Serial.println(err);
while (1);
}

/**************************************************************************/
/*!
@brief Sets up the HW an the BLE module (this function is called
automatically on startup)
*/
/**************************************************************************/
void setup(void)
{
while (!Serial); // required for Flora & Micro
delay(500);

Serial.begin(115200);
Serial.println(F("Adafruit Factory Reset Example"));
Serial.println(F("------------------------------------------------"));

/* Initialise the module */
Serial.print(F("Initialising the Bluefruit LE module: "));

if ( !ble.begin(VERBOSE_MODE) )
{
error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
}
Serial.println( F("OK!") );

/* Perform a factory reset to make sure everything is in a known state */
Serial.println(F("Performing a factory reset: v1"));
if (! ble.factoryReset() ){
error(F("Couldn't factory reset"));
}

Serial.println("Requesting Bluefruit info:");
/* Print Bluefruit information */
ble.info();

Serial.println(F("DONE!"));
}

/**************************************************************************/
/*!
@brief Constantly poll for new command or response data
*/
/**************************************************************************/
void loop(void)
{
}
Attachments
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
image3.jpeg (111.08 KiB) Viewed 133 times
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
image2.jpeg (109.96 KiB) Viewed 133 times
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
Photo of the wiring CS=8 IRQ=7 RST=4 SCK=13 MISO=12 MOSI=11 5VtoVIN and GND to GND
image1.jpeg (109.96 KiB) Viewed 133 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Bluefruit LE SPI Friend "Couldn't Factory Reset'

Post by mikeysklar »

Thank you for providing the photos and code.

The soldering on the Bluefruit LE SPI headers looks like it needs to be gone over again. The soldering pointed have large blobs with incomplete melt around the header pins.

The backwards question marks you are seeing are often a baudrate mismatch. Are you setting the serial console to 115200? The code is using that speed and the Arduino IDE defaults to 9600 for its console.

User avatar
RickIoTr
 
Posts: 2
Joined: Wed Jul 27, 2022 8:32 am

Re: Bluefruit LE SPI Friend "Couldn't Factory Reset'

Post by RickIoTr »

Hello,
Thank you for your reply. As you can see, I have resoldered the joints. I checked each joint using a multi-meter Continuity tester to make sure that each pin is sound. I have checked that 5v is flowing to the Bluefruit.
The issue I believe was three-fold, including the DFU pin being grounded.
..... When grounded the Bluefruit is constantly blinking Red on power up. The sketch when run returns a series of reverse '?'. Interesting to note that once the Arduino sketch exits "Couldn't factory reset' the blue LED also flashes in opposite sync to the red LED.
..... When NOT grounded, the sketch resets the Bluefruit and correctly returns the requested information
I have attached photos as this may help someone else in the future. Please note, I tied the sketch and serial-console to 9600.
So the solution was as you identified, bad soldering on my part, not tying the sketch BAUD rate to the serial console and making sure the DFU wasn't tied to ground.
Thank you.
Attachments
Photo of Arduino board and Bluefruit.  DFU was the issue, should not be grounded
Photo of Arduino board and Bluefruit. DFU was the issue, should not be grounded
IMG_0832.JPG (106.62 KiB) Viewed 122 times
Screen shot showing the sketch and serial output.  Sketch shows serial comms set to 9600 and serial comms at 9600; but still reverse '?' being displayed
Screen shot showing the sketch and serial output. Sketch shows serial comms set to 9600 and serial comms at 9600; but still reverse '?' being displayed
IMG_0837.JPG (94.73 KiB) Viewed 122 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Bluefruit LE SPI Friend "Couldn't Factory Reset'

Post by mikeysklar »

Well done and thank you for the followup.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”