Giter Club home page Giter Club logo

Comments (21)

FooDeas avatar FooDeas commented on July 29, 2024

Do we need it? If you look in the well commented /boot/config.txt you see the following:

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

Just uncomment and reboot. There's no need for rpi-config - but I added the basic compatibility, so you can use it if you want!

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

ah sorry missed that, thanks!

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

If you find missing parameters in config.txt - like the camera was - I'd definitely add it, too!

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

I enabled the following in config.txt:

dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

But when I reboot dmesg | grep spi is supposed to show up but the command doesn't return anything. Does this work for you @FooDeas?

I2C is enabled though:

$ dmesg | grep i2c
[    3.776209] bcm2708_i2c 3f804000.i2c: BSC1 Controller at 0x3f804000 (irq 83) (baudrate 100000)

Maybe this is related? raspberrypi/linux#1547

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

It definitely is. Do an apt-get update/upgrade to see, if that changes something. The package "raspberrypi-kernel" is required (latest version is from 2016-09-21).
If this doesn't work, try rpi-update to update these files from latest build repository because this issue is pretty new and the deb package is from 2 weeks ago.

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024
$ sudo apt-get install  rpi-update
$ sudo rpi-update

...

 *** If no errors appeared, your firmware was successfully updated to 667cfabe63bc663383559ef88317e86f9bd41e45
 *** A reboot is needed to activate the new firmware

After reboot still nothing..

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

Post lsmod.

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

@FooDeas

$ lsmod
Module                  Size  Used by
bnep                   10340  2 
hci_uart               17943  1 
btbcm                   5929  1 hci_uart
bluetooth             326105  22 bnep,btbcm,hci_uart
cpufreq_stats           3463  0 
brcmfmac              186339  0 
brcmutil                5661  1 brcmfmac
cfg80211              427855  1 brcmfmac
joydev                  9024  0 
snd_soc_bcm2835_i2s     6354  0 
rfkill                 16037  3 cfg80211,bluetooth
snd_soc_core          125885  1 snd_soc_bcm2835_i2s
snd_bcm2835            20447  0 
snd_pcm_dmaengine       3391  1 snd_soc_core
snd_pcm                75762  3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_timer              19288  1 snd_pcm
snd                    51908  4 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm
i2c_bcm2708             4834  0 
bcm2835_gpiomem         3040  0 
spi_bcm2835             6678  0 
bcm2835_wdt             3225  0 
evdev                  11396  0 
uio_pdrv_genirq         3164  0 
uio                     8000  1 uio_pdrv_genirq
ipv6                  347530  34
$ ls -1 /dev/spi*
/dev/spidev0.0
/dev/spidev0.1

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

The driver (spi_bcm2835) is loaded and the device is up. Looks like it's already working without a dmesg debug/info output.

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

I just tried it without rpi-update. It works as well.
Summary: Enabling in config.txt still suffices.

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

Hmm, alright. Does the loopback test listed here work for you?

Only output I see is:

$ ./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 

Fuck what a time waster :(

dmesg | grep spi should show something like:

dmesg | grep spi
[ 12.450507] bcm2708_spi bcm2708_spi.0: registered master spi0
[ 12.450574] spi spi0.0: setup: cd 0: 4000000 Hz, bpw 8, mode 0x0 -> CS=00000000 CDIV=0040
[ 12.450613] spi spi0.0: setup mode 0, 8 bits/w, 4000000 Hz max –> 0
[ 12.450747] bcm2708_spi bcm2708_spi.0: registered child spi0.0
[ 12.450796] spi spi0.1: setup: cd 1: 500000 Hz, bpw 8, mode 0x0 -> CS=00000001 CDIV=0200
[ 12.450822] spi spi0.1: setup mode 0, 8 bits/w, 500000 Hz max –> 0
[ 12.450945] bcm2708_spi bcm2708_spi.0: registered child spi0.1
[ 12.450972] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)

For what it's worth, I'm trying to talk to a MAX7219 device using https://github.com/rm-hull/max7219.

Using the spidev python library also doesn't show any errors:

$ python3.5
Python 3.5.2 (default, Oct  3 2016, 23:20:34) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spidev
>>> spi = spidev.SpiDev()
>>> bus = device = 0
>>> spi.open(bus, device)
>>> to_send = [0x01, 0x02, 0x03]
>>> spi.xfer(to_send)
[0, 0, 0]
>>> 

Here's another thread that mentions it broke recently (after switch from spi-bcm2708 to spi-bcm2835).

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

I've also tested this on a Raspberrypi model B + v1.2 with Raspbian wheezy:

$ uname -a
Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

and the loopback works fine there after adding dtparam=spi=on:

spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF 
40 00 00 00 00 95 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
DE AD BE EF BA AD 
F0 0D 

And the max7219 example now also works fine. Sigh. I suppose I'll also test it on a RPi2 with the latest and greatest to see if it's not a hardware issue with the Pi3 I was using before. I also haven't done a clean raspberrypi-ua-netinst installation yet with spi so maybe it'll work after a fresh start there.

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

On RPi 3:

root@pi:~# uname -a
Linux pi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux
root@pi:~# dmesg | grep spi
(no output)
root@pi:~# ./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D

Works as intended...
Make sure, you use GPIO 9 & GPIO 10

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

On that Raspberry B+:

$dmesg | grep spi
[ 5.817699] spi spi0.0: setting up native-CS0 as GPIO 8
[ 5.818605] spi spi0.1: setting up native-CS1 as GPIO 7

I used the same GPIOs you mentioned, on both Rpi3 and Rpi1B+, but only Rpi1B+ succeeded the loopback test.

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

RPi 3 and RPi B+ have the same Pin layout regarding SPI MISO/MOSI. Because the device exists on your RPi, it has to work.
I did nothing special: Fresh installed, uncommented the SPI in config.txt, rebooted, installed gcc and typed in the three lines for the loopback test. Nothing else!

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

Many people abused their Pis with 5V from Arduino hardware/shields. I hope, you accidentally didn't...

Always keep in mind:

GPIO voltage levels are 3.3 V and are not 5 V tolerant. There is no over-voltage protection on the board...

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

Yea f...!! hehe we'll see. But I did the same on the Rpi1B+ @FooDeas and it worked there ;)

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

I already noticed it above. But it doesn't seem to be a software issue if you didn't change more than you already wrote.

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

With a fresh system installation the RaspberryPi 3 SPI still doesn't work, but its not fried, the GPIO channels still work. I'll leave this rest for a week and take a look again later, perhaps try on a RPi2 in the meantime.

from raspberrypi-ua-netinst.

FooDeas avatar FooDeas commented on July 29, 2024

For debugging:
Try disabling the camera and/or I²C. From firmware documentation:

It is recommended to only enable those interfaces that are needed. Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.)

I don't think this applies here, but you could have a try.

from raspberrypi-ua-netinst.

thijstriemstra avatar thijstriemstra commented on July 29, 2024

It eventually started working on that particular machine, it probably was a broken package or kernel. Thanks for the suggestions though.

from raspberrypi-ua-netinst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.