0

nRF52 Feather and LIS3DH
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

nRF52 Feather and LIS3DH

by RRB on Wed Aug 21, 2019 4:51 pm

Hi, I am trying to run an LIS3DH accelerometer example program (Acceldemo) using the nRF52 Bluefruit feather. I have been successful running the same program using I2C or SPI with an ESP32 feather but not with the Bluefruit. I have been successful running a number BLE example programs on the nRF52. After the Acceldemo program is loaded to the nRF52 the LEDs go dark and not even the first Serial.println in Setup executes. I am assuming there must be a lot of things missing in the nRF52 but wanted to check if Adafruit believes this should work and that therefore there is something wrong in my use of the board either in pin assignments, wiring, or something else. I really appreciate your support and direction.

RRB
 
Posts: 3
Joined: Wed Aug 21, 2019 4:27 pm

Re: nRF52 Feather and LIS3DH

by adafruit_support_mike on Thu Aug 22, 2019 2:26 am

Post a photo showing your hardware and connections, and post the code you're having trouble with between CODE tags please.

800x600 images usually work best.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: nRF52 Feather and LIS3DH

by RRB on Sat Aug 24, 2019 4:24 pm

IMG_6298.jpg
Wiring of Adafruit BlueFruit 52 and LIS3DH
IMG_6298.jpg (676.13 KiB) Viewed 80 times
Code: Select all | TOGGLE FULL SIZE
// Basic demo for accelerometer readings from Adafruit LIS3DH

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>

// Used for software SPI
//#define LIS3DH_CLK 13
//#define LIS3DH_MISO 12
//#define LIS3DH_MOSI 11
// Used for hardware & software SPI
// #define LIS3DH_CS 7

// software SPI
//Adafruit_LIS3DH lis = Adafruit_LIS3DH(LIS3DH_CS, LIS3DH_MOSI, LIS3DH_MISO, LIS3DH_CLK);
// hardware SPI
// Adafruit_LIS3DH lis = Adafruit_LIS3DH(LIS3DH_CS);
// I2C
Adafruit_LIS3DH lis = Adafruit_LIS3DH();

void setup() {
#ifndef ESP8266
  while (!Serial);     // will pause Zero, Leonardo, etc until serial console opens
#endif

  Serial.begin(115200);
  Serial.println("LIS3DH test!");
 
  if (! lis.begin(0x18)) {   // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("LIS3DH found!");
 
  lis.setRange(LIS3DH_RANGE_8_G);   // 2, 4, 8 or 16 G!
 
  Serial.print("Range = "); Serial.print(2 << lis.getRange()); 
  Serial.println("G");
}

void loop() {
  lis.read();      // get X Y and Z data at once
  // Then print out the raw data
  Serial.print("X:  "); Serial.print(lis.x);
  Serial.print("  \tY:  "); Serial.print(lis.y);
  Serial.print("  \tZ:  "); Serial.print(lis.z);

  /* Or....get a new sensor event, normalized */
  sensors_event_t event;
  lis.getEvent(&event);
 
  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("\t\tX: "); Serial.print(event.acceleration.x);
  Serial.print(" \tY: "); Serial.print(event.acceleration.y);
  Serial.print(" \tZ: "); Serial.print(event.acceleration.z);
  Serial.println(" m/s^2 ");

  Serial.println();
 
  delay(200);
}

Posted the picture of wiring and the example acceldemo program, configured for I2C. The same code worked on ESP32 breakout board when compiled with ESB32 as target. When compiling for the Bluefruit the setup is shown attached file.
Attachments
Screen Shot 2019-08-24 at 4.16.22 PM.png
Arduino IDE configuration when compiling for Bluefruit52
Screen Shot 2019-08-24 at 4.16.22 PM.png (128.32 KiB) Viewed 80 times

RRB
 
Posts: 3
Joined: Wed Aug 21, 2019 4:27 pm

Re: nRF52 Feather and LIS3DH

by jps2000 on Sun Aug 25, 2019 2:09 am

That sounds like my observations:
viewtopic.php?f=57&t=155536

Try software version 0.11.0
Then probably it runs. Newer versions don´t work at the moment I think
Also burn the older bootloader. Not sure if there is backwards compatibility

jps2000
 
Posts: 449
Joined: Fri Jun 02, 2017 4:12 pm

Re: nRF52 Feather and LIS3DH

by jps2000 on Sat Aug 31, 2019 4:04 am

Arduino IDE 1.8.9 seems to work

jps2000
 
Posts: 449
Joined: Fri Jun 02, 2017 4:12 pm

Re: nRF52 Feather and LIS3DH

by RRB on Sat Aug 31, 2019 9:35 am

Thanks. Are you saying that IDE 1.8.9 works without having to fallback to an earlier board code? If not, while I can load an earlier board level, I do not know how to go back on the boot loader or which boot loader goes with which software level if that matters. I would like some help there unless 1.8.9 solves the entire problem.

RRB
 
Posts: 3
Joined: Wed Aug 21, 2019 4:27 pm

Re: nRF52 Feather and LIS3DH

by jps2000 on Sat Aug 31, 2019 10:07 am

In the arduino IDE just go to tools and click burn bootloader ( last entry)
this is always recommended because bootloader in a board may not be up to date even if you just have bought a new board.
So it is good practice to re- burn boot loader in case you take a fresh board or you have changed the version . This you do with the board manager.
The appropriate boot loader comes always when loading a new version. The bootloader version you also see in the tool menu.

jps2000
 
Posts: 449
Joined: Fri Jun 02, 2017 4:12 pm

Please be positive and constructive with your questions and comments.