Skip to content

SPI broken? #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
0x6470 opened this issue Jun 8, 2019 · 8 comments
Closed

SPI broken? #17

0x6470 opened this issue Jun 8, 2019 · 8 comments

Comments

@0x6470
Copy link

0x6470 commented Jun 8, 2019

I tried to implement this library in order to read the data form this sensor.
Here's my code:

import sys, time
import board
import busio
import digitalio
import adafruit_bme680

cs = digitalio.DigitalInOut(board.D5)
spi = busio.SPI(board.SCLK, board.MOSI, board.MISO)

bme680 = adafruit_bme680.Adafruit_BME680_SPI(spi, cs)
...

I get the error "Failed to find BME680! Chip ID 0xff"
Changing the value in line 45 of adafruit_bme680.py didn't help me.
I checked my wiring many times and also got myself a second sensor, which didn't work (with SPI) either.
Strangely both of them work, when connected via I2C.

I'm running a Raspberry Pi Zero W (Yes, SPI and I2C are enabled via raspi-config) with openHABian, but I also tried it on a Raspberry Pi 3 B+ with Raspbian, just to get the same error.

@makermelissa
Copy link
Collaborator

Hi thanks for reporting this. I'm wondering if there's some difference between running it on a native CircuitPython board and on the Raspberry Pi that's causing the error.

@barbudor
Copy link

barbudor commented Jun 8, 2019

@0x6470 , Is it an original Adafruit breakout ?
It may looks like the SDO pin (=MISO) is stuck to VCC (read ID as 0xFF)
Connecting SDO to VCC is required to select the default I2C address of 0x77. Your module may have the SDO pin stuck to VCC.
Could you please check with a ohm meter what resistance you can read between SDO and VCC ?

@0x6470
Copy link
Author

0x6470 commented Jun 8, 2019

Yes, it's an official board, I bought it from an official distributor (Eckstein GmbH).
The resistance is around 10 kOhm, when running via I2C.

@barbudor
Copy link

barbudor commented Jun 8, 2019

@0x6470 I have no problems with a BME280 which driver is exactly build on the same structure.
May be you could join us on Adafruit Discord channel #help-with-raspberry-pi ?
Someone with a BME680 will be able to help there. I'm from Europe too and I'll be available tomorrow

@makermelissa
Copy link
Collaborator

The BME680 is a bit different than the BME280 in terms of SPI. See #16 (comment) from the last PR. I'll leave this open for when I get a chance to test on a RPi.

@caternuson
Copy link
Contributor

@0x6470 Post a photo of your setup showing how you are wiring everything together.

BME680 on RPi via SPI checks out OK.

  • 3.3V to VIN
  • GND to GND
  • SCLK to SCK
  • MISO to SDO
  • MOSI to SDI
  • BCM5 to CS

rpi_bme680

pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board, busio, digitalio
>>> import adafruit_bme680
>>> cs = digitalio.DigitalInOut(board.D5)
>>> spi = busio.SPI(board.SCLK, board.MOSI, board.MISO)
>>> bme680 = adafruit_bme680.Adafruit_BME680_SPI(spi, cs)
>>> bme680.temperature
23.73234375
>>> bme680.humidity
44.72550176005509
>>> bme680.pressure
1015.1474238206924
>>>

@makermelissa
Copy link
Collaborator

Thanks for testing this @caternuson

@0x6470
Copy link
Author

0x6470 commented Jun 10, 2019

I'm so sorry...
I firstly connected the sensor via female-female jumper wires,
then switched over to female-male ones to showcase my connections.
It turned out that one of the f-f wires (chip select) had a loose connection.
Sometimes it can be that easy...
Thanks anyway for taking your time.

@0x6470 0x6470 closed this as completed Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants