Hello,
I want to comunicate two STR910 micros via SPI. One of them will be the master, and other the slave. The code is very simple:
[b]MASTER:[/b]
/* CLK, MISO & MOSI configuration */ SCU->GPIOOUT[3] &= 0xC0FF; SCU->GPIOOUT[3] |= 0x2200; SCU->GPIOIN[3] |= 0x20;
/* SPI1 configuration */ SSP1->CR0 = 0x0007; /* CPHA=0, CPOL=0 */ SSP1->CR1 = 0x0002; /* Master mode & SSP Enable */ SSP1->PR = 0xFE;
/* Send data */ for(i=0;i<20;i++) { SSP1->DR = 0x41; }
[b]SLAVE:[/b]
/* CLK, MISO & MOSI configuration */ SCU->GPIOOUT[3] &= 0xC0FF; SCU->GPIOOUT[3] |= 0x0800; SCU->GPIOIN[3] |= 0x40; SCU->GPIOIN[3] |= 0x10;
/* SPI1 configuration */ SSP1->CR0 = 0x0007; SSP1->CR1 = 0x0006; /* Slave Mode & SSP Enable */ SSP1->PR = 0xFE;
/* Receive data --> Status Register */ while((SSP1->SR & 0x04)==0); for(i=0;i<20;i++) { buf[i] = SSP1->DR; }
But I donÂ't receive anything. Which is the problem?
Thanks in advance.