[Tinyos-devel] SPI slave select on atm128

Philip Levis pal at cs.stanford.edu
Wed Apr 23 07:40:39 PDT 2008


On Apr 22, 2008, at 11:53 AM, Miklos Maroti wrote:
> Hi All,
>
> I have noticed that the HplAtm128Spi component updates the SS (slave
> select) line, while it clearly shouldn't. If more than one chip is
> connected to the SPI bus then the user of the SpiResource should
> select the slave when access is granted. This is the extract from
> HplAtm128SpiC.nc and HplAtm128SpiP.nc files:
>
> HplSpi.SS   -> IO.PortB0;  // Slave set line
>
>  async command void SPI.initMaster() {
>    call MOSI.makeOutput();
>    call MISO.makeInput();
>    call SCK.makeOutput();
>    call SS.makeOutput();
>    call SPI.setMasterBit(TRUE);
>    call SS.clr();
>  }
>
>  async command void SPI.initSlave() {
>    call MISO.makeOutput();
>    call MOSI.makeInput();
>    call SCK.makeInput();
>    call SS.makeInput();
>    call SPI.setMasterBit(FALSE);
>  }
>
>  async command void SPI.sleep() {
>    call SS.set();
>  }
>
> This does not cause any bug on current platforms where the SPI is bus
> is connected to a single device, but should be corrected like it is
> done for the Msp430. The authors of these files are  Philip Levis and
> Martin Turon. Do you guys want to fix this or should I go ahead and do
> it? I will hunt down the users of this component and toggle the SS
> line there as needed.

Sounds good.

My guess is that this crept in because the micaZ and mica2 only have a  
single peripheral on the SPI bus. The only users of this component  
should be the CC1000 and CC2420.

Phil


More information about the Tinyos-devel mailing list