Look out! It's me again
I'm trying to use the UART for SPI.
DO is Port D 1
DI is Port D 0
XCK is PORT D 2
But I don't think my uart init is right as I don't get any clock signal when I try to write 0xAA repetedly.
void SpiSetup() { DDRD |= (1<<1); // as output (DO) DDRD |= (1<<2); // as output (USISCK) DDRD &= ~(1<<0); // as input (DI) UCSRB = (1<<RXEN)|(1<<TXEN); UCSRC = (1<<UCSZ1)|(1<<UCSZ0); UBRRL = 0; // go fast on 1MHz clock UBRRH = 0; } uint8_t SpiTransfer( uint8_t B) { while( (UCSRA & (1<<UDRE)) == 0) ; UDR = B ; while( (UCSRA & (1<<RXC)) == 0) ; return UDR ; }
(I've always used the SPI peripheral before.)