AnsweredAssumed Answered

stm32f407vg spi1 data register stay 0xff

Question asked by Jalal Sadigli on May 2, 2017
Latest reply on May 7, 2017 by Andrei Chichak

hi, i am new to community.....



i have a stm32f4 discovery board with sym32f407cg microcontroller i tried to test spi communucation of the microcontroller with onboard accelerometer


but there is one or more problem that i can not hande


the problem is whatever i write on data register of spi1 , the register only shows 0xff when i read it with the help of pointer


how can i solve this problem

thats what i did as settings of spi1..


spi_cr1 |= 0x30; // select speed
spi_cr1 |= 0x03; // select cpha and cpol
spi_cr1 |= 0x00; // select dff
spi_cr1 |= 0x00; // select msbfirst


spi_cr2 |= 0x10; // select frf
spi_cr2 |= 0x04; // set ssoe


spi_cr1 |= 0x04; // set mstr
spi_cr1 |= 0x40; // enable spi