cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 SPI Slave wrong behaviour

sebastien23
Associate II
Posted on January 08, 2016 at 15:28

Hi

I'm stuck in my project by this spi problem. What i do is simple, i send a data from a stm32f0 (master) to another one (slave) but here is the problem: while i see on the scope the good frame, the slave device doesn't. More precisely, it sees the data divided by 2. Plus i have to send the data twice to make the slave device understand something other  than 0x00..

In the case of the slave, i handle the communication by interrupt whereas the reference manual says that it is preferable to use DMA.

Do anybody found this problem someday?? I really need to work this out
3 REPLIES 3
re.wolff9
Senior
Posted on January 09, 2016 at 20:42

I suspect that you have a ''mode'' problem. There are 4 modes with SPI, specifying the clock polarity and resting state. If you get things wrong, the slave will recieve dat one bit-clock a too late and give you data that  you call ''divided by two''. 

sebastien23
Associate II
Posted on January 11, 2016 at 09:53

But i've already check  the CPOL and CPHA, they are the same for master and slave. I've also tried to change them but still the same problem..

sebastien23
Associate II
Posted on January 12, 2016 at 16:35

Finally i got it working perfectly well with DMA..