Hi All!

I have a Micaz mote and Mib520 programming board.
And I use assembly language to program the mote.
To control the cc2240 I use the SPI interface. I configure the SPI interface
of the mC according to the datasheet of the CPU.
SPI_MasterInit:
     ; Set MOSI and SCK output, all others input
     ldi r17,(1<<PB2)|(1<<PB1)
     out DDRB,r17
    ; Enable SPI, Master, set clock rate fck/16
     ldi r17,(1<<SPE)|(1<<MSTR)|(1<<SPR0)
    out SPCR,r17
    ret

The first command I give the SXOSCON --> turn on the crystal oscillator.
This has to be the first!
ldi r17, 0x01
call SPI_MasterInit

 out SPDR,r17
 call Wait_Transmit
 call SPI_Receive

SPI_Receive:
       ; Wait for reception complete
       sbis SPSR,SPIF
       rjmp SPI_Receive
      ; Read received data and return
       in r16,SPDR
       ret
SPI_MasterInit:
      ; Set MOSI and SCK output, all others input
      ldi r17,(1<<PB2)|(1<<PB1)
      out DDRB,r17
      ; Enable SPI, Master, set clock rate fck/16
      ldi r17,(1<<SPE)|(1<<MSTR)|(1<<SPR0)
      out SPCR,r17
      ret

And after I give this command strobe the radio should have send back the
Status Byte. But it didn't happened.
At the end the status byte should be in the register 16, but this register
is empty.
I don't understand why.
If somebody can help me, I will be so grateful!
Thx!

Kokai
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to