AnsweredAssumed Answered

STM32F407VGT6 SPI1 receive problem.

Question asked by krefta.krzysztof on Mar 26, 2014
Latest reply on Mar 26, 2014 by Clive One
Hello,
For some time I've been developing system at my company, one of the features is SD card, interfaced via SPI (SPI1 to be more precise). 
However there is a problem with reception of data by MCU. 

When I map SPI1 to PB3/4/5 it works good, but when I map it to PA5/6/7 it messes up LSB of transmission. 

This is log from MCU uart (PC<=>Board), during good transmision via PB


[...]
>SD->       SD::1       -> Init::begun                                            
FF 01 FF FF FF FF FF FF 
FF 01 00 00 01 AA FF FF             
FF 01 FF FF FF FF FF FF            
FF 01 FF FF FF FF FF FF FF FF        
FF 01 FF FF FF FF FF FF  
FF 01 FF FF FF FF FF FF FF FF       
FF 01 FF FF FF FF FF FF  
FF 01 FF FF FF FF FF FF FF FF 
FF 01 FF FF FF FF FF FF  
FF 00 FF FF FF FF FF FF FF FF      
FF 00 C0 FF 80 00 FF FF                         
>SD->       >Block orientated card      
FF 00 FF FF FF FF FF FF 
SD->       SD::1       -> Init::Successful
FAT start            =  8192
AT Boot offset  =    11                    
>FAT->      FAT16       -> Init::Successful         
Fat reset
[...]

And after that system works good no problems whatsoever. HOWEVER if I map SPI1 to PA this is what I get:

>SD->       SD::1       -> Init::begun         
FF 01 FF FF FF FF FF FF  
FF 01 01 00 00 AB FE FF             
FF 01 FF FF FF FF FF FF            
FF 01 FF FF FF FF FF FF FF FF        
FF 01 FF FF FF FF FF FF  
FF 01 FF FF FF FF FF FF FF FF       
FF 01 FF FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF       
FF 01 FE FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF       
FF 01 FE FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF       
FF 01 FE FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF       
FF 01 FE FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF       
FF 01 FE FF FF FF FF FF  
FF 01 FE FF FF FF FF FF FF FF

Now if You compare bold in good/bad transmission You'll see that the bad one sort of delays LSB change, the good one is good because the standards says it should look like this and code was earlier implemented to AVR and gave the very same output as the good one. When checked with oscilloscope everything is good, also this not a problem with single piece of hardware, I've tested it on two separate boards  from different lots and they perform the same. Most likely this has also nothing to do with software as good and bad share the same code (except for two lines where I map pins, which is available here  ). This is also not a problem with SD card as I've tested this with 7 different cards (including SD/SDHC/SDXC and even microsd). The only thing I can think of is some sort of error of input transistor buffers on silicon connected to this line.

Any ideas? I'm clueless.



 

Outcomes