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
SPI not available #47
Comments
It might well be that our kernel config just doesn’t contain the required modules. |
i've checked the config here: https://github.com/gokrazy/kernel/blob/master/cmd/gokr-build-kernel/build.go#L22 perhaps CONFIG_SPI_SPIDEV=y is missing, i'll try building a kernel with that |
i've now tried different config combinations with no avail. CONFIG_SPI_SPIDEV=y any advice? |
Not off the top of my head. I might be able to get a chance to look at this tomorrow. |
thank you, and also thanks for the incredible quick response :) |
Try setting |
Just realized that we already set that option. Nevermind. |
See spidev.c: https://github.com/torvalds/linux/blob/d7a02fa0a8f9ec1b81d57628ca9834563208ef33/drivers/spi/spidev.c#L47-L51 From that, I’m thinking you might just need to create the device node yourself. In gokrazy, we don’t have udev or similar and just rely on devtmpfs instead. It sounds like spidev device nodes are not created in devtmpfs. I’m not too familiar with SPI, but perhaps these commands do the trick?
If that doesn’t do the trick, can you check whether |
thank you. i'll try it with mknod.
|
i'v just created the device nodes but access seg faults |
With what message/backtrace specifically? |
|
Ok then it definitely sounds like a bug in periph. I wanted to test it for years but never took the time to do so. @schubter can you take a deeper look? |
yeah i will, most likely later today. i wanted to try accessing the spi device without periph to see if the device node is actually working. |
Looking at https://github.com/google/periph/blob/v3.5.0/host/sysfs/spi.go#L148 I suspect you are calling CLK() on a nil pointer. Are you checking for errors? |
i do, currently i have this block in there: https://github.com/google/periph/blob/ac8d5328f2b147b7ca36d6c37415f944560d5ec5/conn/spi/spireg/example_test.go#L58 before doing anything else, which access CLK |
The bug is here: https://github.com/google/periph/blob/ac8d5328f2b147b7ca36d6c37415f944560d5ec5/conn/spi/spireg/example_test.go#L70 It's missing a break. |
i've just noticed the line in the other log: Failed to open: sysfs-spi: open /dev/spidev0.0: no such device or address
|
seems like the driver for bcm2835 is still missing
|
The driver for bcm2835 should be built-in. See also |
In my last comment, I meant |
indeed it is, anything else that needs to be enabled? |
good news, after hacking around in the kernel a bit more i've now got the spi devices working
i need to run some more tests and disable some configs again and see what affects what and should be able to provide a patch at the end of the week. |
@maruel is it ok to contact you, about some things i've noticed in periph and had to change to get the things running, to discuss a few things quickly or do you want me to open an issue in the periph repository? |
Sure, either over gopher slack or via email. |
Hi, you are discussing using Reference: Example PR adding another dtparam: raspberrypi/linux@f16e91d But in gokrazy, dumping fdtdump bcm2710-rpi-3-b-plus.dtb | grep __overrides__
# no hits.. So I think this means /tmp/breakglass514323355 # echo -n 1 > /sys/firmware/devicetree/base/soc/spi@7e2150c0/status
sh: can't create /sys/firmware/devicetree/base/soc/spi@7e2150c0/status: Permission denied |
This issue can be closed once the PR on the kernel repo is merged. I have fixed it there and it’s working for me perfectly fine since then. |
resolved with gokrazy/kernel@f686f39 |
Platform
I’m using:
Observed behavior
i've added to the config.txt in gokrazy/kernel the following lines
dtparam=spi=on
dtoverlay=spi-bcm2835
also tried with dtoverlay=spi-bcm2708
no spi devices are available
/tmp/breakglass156884305 # ls -al /dev/sp*
ls: /dev/sp*: No such file or directory
also nothing in the kernel log
/tmp/breakglass156884305 # dmesg | grep spi
Expected behavior
something along the lines like this in dmesg
[ 4.813403] bcm2708_spi 20204000.spi: SPI Controller at 0x20204000 (irq 80)
and the corresponding devices in /dev
The text was updated successfully, but these errors were encountered: