1

I'm trying to get the nRF8001 BLE Breakout polling properly on Flora but Adafruit's tutorial and everything I've read and hunted around but I'm new to Arduino and not really sure how the Adafruit_BLE_UART library is handling I/O on the various pins. I'd appreciate it if anyone knows the proper pin configuration to get this working. I'm not in a position where I can easily change out to a better BLE device for my Flora.

So it's clear I have

  • SCK connected to SCK.
  • MISO to MISO, I've also tried it in D12 with the same outcome.
  • MOSI in MOSI, there's no D11 on this board so I couldn't try that.
  • REQ in D10.
  • RDY in SDA, which is supposed to correspond to D2 (besides SCL I don't think there are any other interrupt pins).
  • RST in D9, also tried it in the Reset SPI, doesn't seem to make any difference.

In short I'm using all the appropriate SPI pins and two of the data pins mentioned in the BLE tutorial, and I've tried a couple other configurations without much success.

And it appears to be powered properly.

using echoDemo, getState always returns the disconnected opcode. Polling apparently does nothing, setDeviceName does not set a name. I think either MISO or MOSI or both are the problem here. I can blink the LED, and other peripherals are working okay. (Crossposted to Adafruit forums.)

Some code:

#include <SPI.h>
#include "Adafruit_BLE_UART.h"

// Connect CLK/MISO/MOSI to hardware SPI
// e.g. On UNO & compatible: CLK = 13, MISO = 12, MOSI = 11
#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 2
#define ADAFRUITBLE_RST 9

Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

void setup(void) {
  Serial.begin(9600);
  while(!Serial); // Leonardo/Micro should wait for serial init
  Serial.println(F("Adafruit Bluefruit Low Energy nRF8001 Print echo demo"));
  BTLEserial.setDeviceName("NEWNAME"); /* 7 characters max! */
  BTLEserial.begin();
}
aci_evt_opcode_t laststatus = {5};

void loop() {
  // Tell the nRF8001 to do whatever it should be working on.
  BTLEserial.pollACI();
  // Ask what is our current status
  aci_evt_opcode_t status = BTLEserial.getState();
  Serial.println(laststatus);
  Serial.println(status);
  Serial.println(ACI_EVT_DEVICE_STARTED);
  Serial.println(ACI_EVT_CONNECTED);
  Serial.println(ACI_EVT_DISCONNECTED);
  delay(1000);
  // If the status changed....
  if (status != laststatus) {
    // print it out!
    if (status == ACI_EVT_DEVICE_STARTED) {
        Serial.println(F("* Advertising started"));
    }
    if (status == ACI_EVT_CONNECTED) {
        Serial.println(F("* Connected!"));
    }
    if (status == ACI_EVT_DISCONNECTED) {
        Serial.println(F("* Disconnected or advertising timed out"));
    }
    // OK set the last status change to this one
    laststatus = status;
  }
}
1

The SPI bus can be accessed using a 6 pin header located next to the embedded processor. Look at the embedded image below. Locate the 6 pin header just to the right of the processor. Note the white dot indicating pin1 of the header. Now look at the bottom of the embedded image to see the definitions of the 6 pins. MISO, MOSI and several other SPI signals are listed.

enter image description here

  • I'm not sure what you're trying to get at. I mentioned in the post that I'm using the SPI bus pins, do you mean to say that I should be modifying the BLE library to (somewhere) reference different pin numbers for MISO, MOSI, SCK? On the SPI bus the datasheet marks them 1, 4, and 3, but I don't see anything else indicating a pin number. The image you talked about doesn't seem to be in your reply, so I can't really tell what document you're referencing. – user1576628 Oct 15 '16 at 17:29
  • The image is embedded in the stackexchange answer. In your question you associated MISO with D12 and MOSI with D11. On this page Adafruit says the SPI is on the 6 pin header on pin 1 (MISO) and 4 (MOSI). I do not think you should modify the library. – st2000 Oct 16 '16 at 5:26
  • I do see that I did not read the flora key correctly off the embedded image. I will remove the pin suggestions from the answer. Adafruit might have done a better job at documenting their product as it does not appear Adafruit consistently used Arduino Uno pin names on the Flora. – st2000 Oct 16 '16 at 5:32
  • The image thing turned out just to be in my browser, I can see it just fine using a different one. I'll see what I can do using this sheet for reference. – user1576628 Oct 17 '16 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.