SPI chip on RPi3, need to configure CS and IRQ

Hello,

I'm running 14.2 on an RPi3 (BCM2837), I'd like to interface with a custom board via SPI wired to SPI0 (/dev/spigen0.0).
The board uses GPIO8 for CS and can generate an IRQ on GPIO17. The IRQ could be used to trigger data transfer.

How do I get spigen to use GPIO8 for CS?

I'd like to service this board from userland with a high priority RT handler thread waiting on IRQ. How can I do this in FreeBSD?

Thanks,
 
You cant really force a certain pin to be SPI it has to be one of the pins that is muxed for SPI-CS


FreeBSD complies these for you so all you need to do is copy them from /usr/local/share/rpi-firmware/ to /boot/dtb/overlays and declare them in config.txt
Note that everything from this repository is compiled yet not all dtb will work on FreeBSD. You need to have a corresponding driver for some of these overlays.
 
Thank you. I see, the selection of CS0 vs CS1 for SPI0 is encoded with the device name (/dev/spigen0.0 for CE0). This is perfect, CS0 is GPIO8.

The remaining question is how do I configure GPIO17 to generate an interrupt (level triggered) and how do I configure a pthread to wait on it? If a kmod is required, what's the best (lightest overhead) mechanism to wake/notify a waiting pthread? I've seen gpioctl but it doesn't support interrupts.
 
Here is a post I was looking for when I posted the above references. obsigna is really on point here:


 
Back
Top