[beagleboard] Re: How to use GPIO as spi chipselect.

2019-03-20 Thread Dave
Thank you;

I should have thought of that. 

I probably did not because other systems I work with have linux drivers 
that allow configuring any GPIO as a chip select. 

I did think of bit-banging the SPI, This use is not especially high speed. 
Frankly I do not know why the device is SPI. 

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/551b9aa7-98f9-474c-a043-c62c129025bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[beagleboard] Re: How to use GPIO as spi chipselect.

2019-03-19 Thread graham
You can not have the SPI hardware manage one of the SPI chip select lines, 
and you bit-bang the other.
Either you let the SPI hardware manage both of them, which you can not do 
in this case, because of assignment conflict, or you must bit-bang both of 
the CS lines.
So, set it up as a single generic SPI driver, and pick any two GPIO pins 
for chip-select lines.
One of them could be the same pin as CS0, just configured as a GPIO pin.
You will need to write a little wrapper for the SPI call, that drops the 
appropriate CS line, before you write to the SPI hardware.
You will need to raise the appropriate CS line when the SPI hardware is 
done sending.
DO NOT send your last data to the SPI hardware and immediately raise the CS 
line.
The SPI hardware is a parallel to serial device, and will still be sending 
data for some time after the data is written to it to send.
--- Graham

==

On Saturday, March 16, 2019 at 11:18:57 PM UTC-5, Dave wrote:
>
> I am working on a board that is derived from a Pocket Beagle. 
>
> It has two max81355 SPI Thermocouples on SPI0. 
>
> The first uses spi0_cs0 as a chip select. 
>
> spi0_cs1 is used for mmc.cd so that can not be used for the second. 
>
> The hardware designer used spio_d1(MOSI) set as a GPIO for the 2nd chip 
> select. 
>
> I have no clue how to set the device tree entry for that.
>
> This is what I have - which I do not think can work.  
>
> fragment@1 {
> target = <_pinmux>;
> __overlay__ {
> pb_spi0_pins: pinmux_pb_spi0_pins {
> pinctrl-single,pins = <
> /* SPI0_SCLK STATUS:WORKS ??? */  
> AM33XX_IOPAD(0x0950, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE0 )  /* A13 
> P1.08  SPI0_SCLK 0x150 GPIO2 GPIO0_2 SCLK */
> /* SPI0_DO STATUS:WORKS ??? */  
> AM33XX_IOPAD(0x0954, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE0 )  /* B13 
> P1.10  SPI0_D0   0x154 GPIO3 GPIO0_3 MISO */
> /* SPI0_D1 STATUS:UNKNOWN */  
> AM33XX_IOPAD(0x0958, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE7 ) /* B14 
> P1.12  SPI0_D1   0x158 GPIO4 GPIO0_4 TC1 */
> /* SPI0_CS0 STATUS:WORKS ??? */  
> AM33XX_IOPAD(0x095c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE0 ) /* A14 
> P1.06  SPI0_CS   0x15c GPIO5 GPIO0_5 TC0 */
> >;
> };
> };
> };
> fragment@2 {
> target = <>;
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
>
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <_spi0_pins>;
> ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 
> bits... */
>
> channel@0 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "spidev";
> reg = <0>;
> spi-max-frequency = <430>;
> spi-cpha;
> };
>
> channel@1 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "spidev";
> reg = <1>;
> spi-max-frequency = <430>;
> };
> };
> };
>
>
>
>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/ce3cba45-0bf3-48fe-9fc7-ff2c0d41f61f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.