We know the yun has a soft spi interface, of which SCLK, MISO and MOSI are AFAIK on the ICSP header.
Its SS is going directly to the avr's ss.
I want to control an SPI-based shield(infact, a gameduino 1(infact, its olimex clone)) directly from the yun`s linux cpu, instead of the crappy avr mcu(last time i checked, the gameduino examples wouldnt even fit in its flash, also it can't execute stuff from ram).
As the only other MIPS gpio thats on some form of pin is HANDSHAKE on digital pin 7, i would like to change the spi to use that as SS(its a software one anyways).
Then i would wire the SPI signals from the icsp header to thier usual location, and connect pin 7 to whatever pin the shields SS is(10 i believe).
So how to change the spi driver to use HANDSHAKE as SS?
Unless you are using the AR3391's SPI in slave mode, you don't really need to change the driver. While most microprocessor SPI hardware interfaces can control a CS line while in master mode, it's very often just a single CS pin. With a SPI bus, it's very common to have more than one save on the bus, meaning you need more than one CS output.
Since it's unusual for the SPI hardware to have more than one CS pin,the common solution is to use any available GPIO pin. The idea is that your calling code sets the GPIO line low at the beginning of the transfer, makes the call to the driver to do the actual transfer, and the desserts the GPIO line. The only trick is if you are using an asynchronous SPI driver, you need to make sure the transfer has actually finished before asserting CS. This is a very common scenario. (I've done a lot of SPI over the years, and I think the only time I've used the hardware's dedicated CS pin is as an input when the processor is an SPI slave.)
Well, seeing that all the Yun spi lines are just gpio abused to do spi (the actual hardware spi goes to the flash and sdcard), i dont know if the driver selects anything. If then, it will only select the atmega, which at that time will have already booted, so it hopefully doesn't get randomly reprogrammed with stuff i send to the shield)
More of a problem is, i dont know if the driver is async...
Hmm, i dont seem to get an tty for SPI, also i think the ss is hardcoded into the kernal... has anyone the tools at hand to compile a image with SPI support and SS/CS on pin7/gpio19?
EDIT: Also, i tried directly writing values to gpios from the shell, and i sometimes get a single byte transferred, but it works only sometimes.
i guess i cant get round it...
Yay, found out how to do it!
Still doesnt quite work...
Will make a new thread about that...