Skip to content
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

Add preliminary SPI support for BeagleBone Black #46

Merged
merged 3 commits into from
Nov 22, 2018
Merged

Add preliminary SPI support for BeagleBone Black #46

merged 3 commits into from
Nov 22, 2018

Commits on Nov 21, 2018

  1. Add SPI pins for BeagleBone Black

    Refer to header default pin modes
    http://beagleboard.org/static/images/cape-headers.png
    
    P9_17 (SPI0_CSO => CE0) enables peripheral device
    P9_18 (SPI0_D1 => MOSI) outputs data to peripheral device
    P9_21 (SPIO_DO => MISO) receives data from peripheral device
    P9_22 (SPI0_SCLK => SCLK) outputs clock signal
    
    Use config-pin to set pin mode for SPI pins
    https://github.com/beagleboard/bb.org-overlays/tree/master/tools/beaglebone-universal-io
    
    config-pin p9.17 spi_cs
    config-pin p9.18 spi
    config-pin p9.21 spi
    config-pin p9.22 spi_sclk
    pdp7 committed Nov 21, 2018
    Configuration menu
    Copy the full SHA
    ff59972 View commit details
    Browse the repository at this point in the history
  2. add more plumbing for SPI on BeagleBone

    reuse the Raspberry Pi SPI class as both are
    Linux boards using spidev.  The main difference
    is the pins numbers are different.
    
    Testing with Adafruit_CircuitPython_BME280 in SPI mode.
    
    TODO: wire up the board to the BeagleBone Black
    
    Current output:
    
    debian@beaglebone:~/Adafruit_CircuitPython_BME280$ sudo python3 examples/bme280_simpletest.py
    SPI(): __init()
    SPI(): beaglebone_black: from adafruit_blinka.microcontroller.raspi_23.spi import SPI as _SPI
    spiPorts: ((0, P9_22, P9_18, P9_21), (1, P9_22, P9_18, P9_21))
    for:
    0 P9_22 P9_18 P9_21
    Line 91
    <class 'adafruit_blinka.microcontroller.raspi_23.spi.SPI'>
    <adafruit_blinka.microcontroller.raspi_23.spi.SPI object at 0xb6b3c890>
    Traceback (most recent call last):
      File "examples/bme280_simpletest.py", line 15, in <module>
        bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
      File "/usr/local/lib/python3.5/dist-packages/adafruit_circuitpython_bme280-2.1.1.dev3+g1416d93-py3.5.egg/adafruit_bme280.py", line 247, in __init__
      File "/usr/local/lib/python3.5/dist-packages/adafruit_circuitpython_bme280-2.1.1.dev3+g1416d93-py3.5.egg/adafruit_bme280.py", line 78, in __init__
    RuntimeError: Failed to find BME280! Chip ID 0x0
    pdp7 committed Nov 21, 2018
    Configuration menu
    Copy the full SHA
    3488ad2 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2018

  1. add SPI1 pins for BeagleBone Black

    Refer to:
    http://beagleboard.org/static/images/cape-headers-spi.png
    
    CE1 P9.28 SPI1_CS0
    MISO_1 P9.29 SPI1_D0
    MOSI_1 P9.30 SPI1_D1
    SCLK_1 P9.31 SPI_SCLK
    
    SPI1 conflicts with HDMI Audio (McASP)
    
    Refer to:
    https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
    
    To Disable HDMI AUDIO, uncomment this line in /boot/uEnv.txt:
    disable_uboot_overlay_audio=1
    
    Set pin modes for SPI1 with:
    
    config-pin p9.28 spi_cs
    config-pin p9.29 spi
    config-pin p9.30 spi
    config-pin p9.31 spi_sclk
    pdp7 committed Nov 22, 2018
    Configuration menu
    Copy the full SHA
    9eeec4d View commit details
    Browse the repository at this point in the history