I have write some codes to use SPI of 6747. I use SPI0 as the master and SPI1 as the slaver. now I find when SPI0 send a data to SPI1 at the speed of 50MHZ. that'OK.
but when I try to use SPI1 send a data to SPI0 at 50MHZ.. the data is error... I slow the speed at 37.5MHZ. data bocome right...
I want to know the 6747's speed of SPI is linmited or not.. and why case this problom thanks!!
my code is very simple.
Uint16 SPI0_RW_word(Uint16 data){
Uint16 i;
while( SPI0_SPIBUF & 0x20000000 );
SPI0_SPIDAT1 = spidat1 | data;
while ( SPI0_SPIBUF & ( 0x80000000 ) );
i=SPI0_SPIBUF;
return i;
}
void SPI1_send_char(char data){
while( SPI1_SPIBUF & 0x20000000 );
SPI1_SPIDAT1 = data;
}
void main( void )
{
Uint32 i;
Uint16 j;
/*初始化6747核*/
C6747_init();
SPI0_Configtion();
SPI1_Configtion();
for(;;){
SPI1_send_char('a');
j= SPI0_RW_word(0xff);
if(j=='a'){
printf("yes spi is ok");
for(i=0;i<0xffff;i++);
}
else{
printf("error!!!");
for(i=0;i<0xffff;i++);
}
}