2020-10-09 03:56 AM
i used stm32f031 as master & slave, NSS is alwasy low, connect MOSI and MISO. the master transmit datas successfull then changing the master direction to receive data( SPI->CR &=~SPI_CR1_BIDIOE), at the same time slave recv and try to transmit datas.
here is the master code:
for(i = 0; i < 256; i++)
{
while((SPI1->SR & SPI_SR_TXE) != SPI_SR_TXE);
SPI1->DR = i;
delay_us(10);
}
delay_ms(2);
SPI1->CR1 &= ~SPI_CR1_BIDIOE;
delay_ms(3);
for(i = 0; i < 256; i++)
{
while((SPI1->SR& SPI_SR_RXNE) != SPI_SR_RXNE);
master_rx_16[i] = SPI1->DR;
}
delay_ms(2);
i find no data in master_rx_16[].