Hi Jesper, I have got one problem with VS1011. I have connected it as is write in datasheet, but it doesnt work. I have Atmega 32 at 8 MHz, so SPI freqency is about 4 MHz. Here is the code, I have written sine test.
#include <avr/io.h>
#define F_CPU 8000000UL
#include <util/delay.h>
#define MOSI PB5
#define SCK PB7
#define RST PB0
#define CS PB1
#define DCS PB2
int main (void)
{
DDRB = (1 << MOSI)|(1 << SCK)|(1 << RST)|(1 << CS)|(1 << DCS); // init pins
PORTB = (0 << RST)|(1 << CS)|(1 << CS)|(1 << DCS);
SPCR = (1 << SPE)|(1 << MSTR); // init spi
SPSR = (1 << SPI2X);
_delay_ms(100);
PORTB = (1 << RST);
_delay_ms(500);
PORTB = (0 << CS);
SPDR = 0x02;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x00;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x08;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x20;
while(!(SPSR & (1<<SPIF)));
PORTB = (1 << CS);
_delay_ms(100);
PORTB = (0 << DCS);
SPDR = 0x53;
while(!(SPSR & (1<<SPIF)));
SPDR = 0xef;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x6e;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x44;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x00;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x00;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x00;
while(!(SPSR & (1<<SPIF)));
SPDR = 0x00;
while(!(SPSR & (1<<SPIF)));
PORTB = (1 << DCS);
for(;;)
{}
}Can you help me, please ? (I´m sorry, my English is not good)