2013-10-24 01:19 AM
Hello
I've discovered something quite interesting and annoying at the same time, let me share this in case someone stumbles upon a same issue.I use SPI1 in STM32F103RC and STM32F4Discovery to communicate with ADIS16405 MEMS sensor and a SD card. A few weeks ago everything worked perfectly, but currently it's not and I wasn't sure why. The data I was receiving through SPI was corrupted or random.The solution I've discovered is to combine SPI1 prescalers with different APB2 Bus divisors, and so it goes as follows:MEMS sensor works only when I divide:APB2 by 2 and SPI1 by 256 APB2 by 4 and SPI1 by 128or APB by 8+ and SPI1 doesnt careThe only SD card issue with STM32F4 was that it worked with every APB2 divider and SPI1 prescaler except SPI1_Prescaler_4.SPI2/3 both work as intended.I've invested quite some time in finding this issue which on the first hand shouldn't exist at all but I'm glad it works now.Razr #stm32f1-f4-spi1-apb2-bus-speed