cancel
Showing results for 
Search instead for 
Did you mean: 

needing low speed SPI communication

abbas
Associate II
Posted on April 12, 2015 at 16:50

Hello everyone!

I am using STM32F103RET for my project. I need to communicate by SPI with a low speed digital device with the speed of at most 1KHz clock. At the same time, I need to have my own cpu clock as high as possible.

As I saw at the reference manual, I just can decrease SPI clock to APB2/256 which is too high ( at the best situation, CPU_clock/16/256 -> 72MHz/16/256 = 17KHz - by loosing APB2 speed to CPU_clock/16 )

have I hopefully, missed a point? Is there any way to have lower speed SPI with keeping system speed high?

#stm32f10x
4 REPLIES 4
Posted on April 12, 2015 at 22:57

Is there any way to have lower speed SPI with keeping system speed high?

Pretend to be a Slave on the bus, an supply the clock? I2S mode might afford more rates.

Other than that perhaps consider bit-banging the bus via GPIO pins in the 1ms ticker?

SPI is one of the areas where the STM32 is unduly inflexible.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Chris1
Senior III
Posted on April 13, 2015 at 15:44

You may be able to use a USART, which can be set to low baud rates.  For example, we have used USART3 on the F103 for SPI as a master driving MOSI. 

Depending on the needs of the attached device, you may have to reorder the bits sent.

abbas
Associate II
Posted on April 15, 2015 at 12:24

Thanks clive1

I reached to this same solution.

Here, the device was a shift register which the digital lines were passed through opto-couplers ( that limit the rate ) and I was about to clock the register by mcu.

By the way, it was weird to here this limitation in my favorite STM MCUs!

abbas
Associate II
Posted on April 15, 2015 at 12:30

Thanks Chris T

Your solution looks really smart! I may test it if the latter solution were in trouble. If I knew it, I would consider it in my PCB