I'm using an atmel128L and I tried to use the SPI bus. I made a stupid software just to see if it seems to work :
DDRB=0x07; //MOSI SCK /SS are output
PORTB=0xFC; // put /cs at 0
SPDR=0x21; //juste try to put this value
while(!(SPSR & (1<<SPIF)));
PORTB=0xFB; // put /cs at 1
I used the avrstudio 4.06 debugger to see if the registers have the values expected and if fact :
- SPCR has the good value (0x51) so this one is ok
BUT SPDR never has the value asked (0x21). He's always at 0x00.why? why? why?
Why one of the SPI registers works and not the other. I tried also to put to 1 the bit SPI2X in the SPSR register and it doesn't work.
Please help a poor trainee who doesn't know what to do!!! :-(