Raspberry Pi 2,如何禁用device_tree来启用SPI?

时间:2016-07-13 07:23:07

标签: linux raspberry-pi raspberry-pi2 spi device-tree

我有一个Raspberry Pi 2,型号B,我想使用SPI与另一个Pi通信(稍后将其用于更多SPI设备)。我还想用WiringPi对我的程序进行C编码。

我以为我会确保我拥有所需的一切,所以我进行了全面升级:

sudo apt-get update && sudo apt-get upgrade -y

我安装了WiringPi,并启用了从raspi-config加载SPI,但如果没有以下错误,我仍然无法执行gpio load SPI

gpio: Unable to load/unload modules as this Pi has the device tree enabled.
  You need to run the raspi-config program (as root) and select the
  modules (SPI or I2C) that you wish to load/unload there and reboot.
  There is more information here:
    https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97314

然后我尝试了the link suggested

  

...将“device_tree =”添加到您的config.txt并重新启动。

$ nano sudo /boot/config.txt
# Go to last line
# Add 'device_tree='
# Save, and exit
$ sudo reboot

然后我尝试gpio load spi,但我仍然遇到同样的错误。

/boot/config.txt中启用了SPI:

$ cat /boot/config.txt | grep spi
dtparam=spi=on

有任何建议,我可以尝试启用我的SPI吗?

1 个答案:

答案 0 :(得分:0)

根据this threada = a.reshape(1, -1) tf_x = tf.placeholder(tf.float32, [None, a.shape[-1]]) # now if you want the final array to have total 4 element, you can set it as number of output output = tf.layers.dense(tf_x, 4, tf.nn.relu) with tf.Session() as sess: sess.run(tf.global_variables_initializer()) pred = sess.run(output, {tf_x: a}) pred = pred.reshape(2, 2) 已被弃用。

相关问题