[Tinyos-devel] SPI slave select on atm128

Miklos Maroti mmaroti at math.u-szeged.hu
Tue Apr 22 11:53:32 PDT 2008


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.

Miklos


More information about the Tinyos-devel mailing list