Nerves Project Circuits SPI Clock not initialised

我与影子孤独终老i 提交于 2021-01-05 07:23:07

问题


I cannot get the SPI to work. I am trying to interface an IC mcp2515. It is an SPI to CAN interface. I probed the CE pins (GPIO 8 and GPIO 7) and SCLK (GPIO 11) with the oscilloscope but got nothing.

these are deps

  defp deps do
[
  {:nerves, "~> 1.6.3", runtime: false},
  {:shoehorn, "~> 0.6.0"},
  {:ring_logger, "~> 0.8.1"},
  {:toolshed, "~> 0.2.13"},
  {:vintage_net_wizard, "~> 0.4.0"},
  {:circuits_uart, "~> 1.4"},
  {:circuits_gpio, "~> 0.4.6"},
  {:nerves_leds, "~> 0.8.1"},
  {:circuits_spi, "~> 0.1.5"},

  {:nerves_runtime, "~> 0.11.3", targets: @all_targets},
  {:nerves_pack, "~> 0.4.0", targets: @all_targets},
  {:nerves_runtime_shell, "~> 0.1.0", targets: @all_targets},
  {:nerves_system_rpi4, "~> 1.12", runtime: false, targets: :rpi4},
]
end

I get this log on startup

00:00:03.293 [error] spi-bcm2835 fe204000.spi: could not get clk: -517

I get one SPI bus instead of two

iex(2)> Circuits.SPI.bus_names
["spidev0.1"]

I have modified and added config.txt and fwup.conf in my config folder to fetch mcp2515-can0.dtbo and added the configuration in config.exs

fwup_conf: "config/fwup.conf"

this is the config.txt

# Default Nerves RPi 4 config.txt
#
# It's possible to override this file by using a custom fwup.conf
# configuration to pull in a replacement.
#
# Useful links:
# http://rpf.io/configtxt
# https://www.raspberrypi.org/documentation/configuration/device-tree.md
# https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

# Enable 64-bit support
arm_64bit=1

# We always use the same names, the real used variant is selected by
# BR2_PACKAGE_RPI_FIRMWARE_{DEFAULT,X,CD} choice
start_file=start.elf
fixup_file=fixup.dat

# Disable the boot rainbow
disable_splash=1

# This, along with the Raspberry Pi "x" firmware is needed for the camera
# to work. The Raspberry Pi "x" firmware is selected via the Buildroot
# configuration. See Target packages->Hardware handling->Firmware.
gpu_mem=192

# Enable I2C, SPI, and audio
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on

# Comment this in or modify to enable OneWire
# NOTE: check that the overlay that you specify is in the boot partition or
#       this won't work.
#dtoverlay=w1-gpio-pullup,gpiopin=4

# The ramoops overlay works with the pstore driver to preserve crash
# information across reboots in DRAM
dtoverlay=ramoops

# Enable the UART (/dev/ttyS0)
enable_uart=1

dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25

# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

来源:https://stackoverflow.com/questions/65436480/nerves-project-circuits-spi-clock-not-initialised

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!