Adding SPI specific documentation for Raspberry Pi#1197
Adding SPI specific documentation for Raspberry Pi#1197Ellerbach merged 4 commits intodotnet:masterfrom
Conversation
Documentation/raspi-spi.md
Outdated
| sudo reboot | ||
| ``` | ||
|
|
||
| This will enable SP0 where those are the pins which will be seleted, only Software Chip Select is activated with the default pins: |
There was a problem hiding this comment.
Thanks for adding this. Cost me a few hours to find out why hardware CS wasn't working...
Maybe add a sentence about the difference between hw and software cs? This isn't clear from this text.
There was a problem hiding this comment.
Seems that now there is no difference, once set it is by default activated. The hardware dtoverlay is depreciated.
There was a problem hiding this comment.
I mean "software" as in "do it yourself". I've seen quite a few examples (don't remember where, though), where the CS pin is manually controlled directly in the application.
There was a problem hiding this comment.
Actually, just using dtparam=spi=on will not activate any CS pin, you need to do it yourself (by manyually controlling the pin that is connected to the CS input line of the attached chip). My finding with adding dtoverlay=spi0-hw-cs will change the ALT setting to the one described in the manual and use that pin.
So with your suggestion, we have actually three different possibilities for the CS pin: None, hardware and "driver controlled gpio".
Can you check what "gpio readall" reports for i.e. pin 27 when your line dtoverlay=spi0-2cs,cs0_pin=27,cs1_pin=22 is used?
There was a problem hiding this comment.
My understanding is that now you choose the pins you want, reason why the dtoverlay)spi0-hw-cs is deprecated. Also gpio is not available anymore. See the note from the WiringPi author: http://wiringpi.com/wiringpi-deprecated/
It seems, reading the doc, that dtparam=spio=onwill activate both default pins as Chip Select. Reason why I linked to the latest doc. Now, for previous versions, it seems it was not the case.
If you have any working alternative for gpio readall, happy to try!
There was a problem hiding this comment.
Well, at least the spi0-hw-cs works... I'll need to redo my SPL tests when I find time - last time I tried (when I wrote that issue) dtparam=spi=on would definitelly not activate any CS pins.
The latest version of WiringPi, 2.52, does work on the Pi4 (and is very helpful in analyzing pin multiplexing behavior). However you need to download it from the website, it's not available via apt.
With #1128 in place, we would be able to extend the DeviceApiTester tool to completelly replace gpio.
| | SPI0 | CE1 | 26 | GPIO07 | SPI0_CE1_N | | ||
|
|
||
|
|
||
| If you want to change the default pins for Chip Select 0 to the GPIO pin 27 (hardware 13), and let's say GPIO pin 22 (hardware 15) for Chip Select 1, just add this line: |
There was a problem hiding this comment.
Are you sure you can use any pin for hardware CS? The "alternate pin mode" table suggests that these are fixed.
There was a problem hiding this comment.
The table is the default configuration. Advance configuration is what I describe. So seems it is not super clear. How would you rephrase then?
There was a problem hiding this comment.
See above - I think we're talking about three different ways here. I'll have to think about how to describe this in an understandable and clear way.
Documentation/raspi-spi.md
Outdated
| sudo reboot | ||
| ``` | ||
|
|
||
| This will enable SP0 where those are the pins which will be seleted, only Software Chip Select is activated with the default pins: |
There was a problem hiding this comment.
| This will enable SP0 where those are the pins which will be seleted, only Software Chip Select is activated with the default pins: | |
| This will enable SPI0 where those are the pins which will be selevted, only Software Chip Select is activated with the default pins: |
There was a problem hiding this comment.
"selected" is still spelled incorrectly ;-)
krwq
left a comment
There was a problem hiding this comment.
couple of typos but otherwise looks good to me, thank you!
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Adding SPI specific documentation for Raspberry Pi
Fixing a typo in the PWM documentation