You don't want to use the registers directly. You should use the Atm128SpiC component, which provides an Init, Resource and SpiByte interface. Before using the SPI, you need to request the SPI resource through the Resource interface (the SPI subsystem is automatically configured after the resource request is granted). Once your app stops using the SPI resource, you need to release it, otherwise radio communication will not work. The radio is using the SPI bus, as well.
The SPI driver code is in tos\chips\atm128\spi. Take a look at the code in tos\platforms\micaz\chips\cc2420x on how to use it. Janos On Tue, Dec 11, 2012 at 12:27 PM, Philipe Dias <[email protected]> wrote: > Hello everybody, > > Since more than a month ago, I'm trying to communicate my IRIS XM2110 > (Atm1281) board with an ADC through SPI. And I can't find any example code > of it! > > Example applications 'BlinkToRadio' and 'BaseStation' worked fine for me, > so I was trying to change the BlinkToRadio application in some way that I > would be able to communicate through SPI. I tried to use the SPI example > for Atm128 chip, because, according to datasheets, the SPI pins are the > same of the Atm1281. > > The problem I'm facing now is that, even including "Atm128Spi.h" and/or > "atm128_sim.h", SPI registers (like SPSR, SPDR and others) are always with > the error "undeclared" (like SPSR undeclared). I'm quite lost trying to > include this SPI part. > > Please, can anyone send me a working code that communicates with a SPI > slave? Or at least give me an advice about the problem with SPI registers > declarations. > > I guess that, with a single example of this, I would be able to do what > I'm trying. > > Best regards from Brazil, > Philipe Dias > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
