Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kutil.Bill

Pages: [1]
1
Hardware / Re: Problem with VS1011e Piggyback
« on: 15.01.2011 at 11:02:11 »
I have got 24.576 MHz xtal and in datasheet is the SPI frequency is 24.576MHz/6 = 4.096 MHz. And if i try to write some code, which tells me through uart, if the bytes were transmitted, so it takes a very long time (transmitting bytes).

2
Hardware / Re: Problem with VS1011e Piggyback
« on: 13.01.2011 at 20:34:55 »
Ok, so I rewrite the code to this code, but it still doesn't work. I measure that the data to registers are transmitting very long, but to DPS (dcs) is it done quickly.

Code: [Select]
#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 = (1 << CS)|(1 << CS)|(1 << DCS);
  PORTB &= ~(1 << RST);
 
  SPCR = (1 << SPE)|(1 << MSTR);                                 // init spi
  SPSR = (1 << SPI2X);
 
  _delay_ms(100);
 
  PORTB |= (1 << RST);
 
  _delay_ms(500);
 
  PORTB &= ~(1 << 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 &= ~(1 << 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(;;)
  {}
 
}

3
Hardware / Re: Problem with VS1011e Piggyback
« on: 08.01.2011 at 12:11:36 »
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.

Code: [Select]
#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) :)

Pages: [1]