cancel
Showing results for 
Search instead for 
Did you mean: 

Using TIM1 for SPI CLK

stegu
Associate
Posted on November 05, 2014 at 20:30

I need to have 2xSPI synchronized and also synchronized with some timers.

Unusual use of TIM1. (STM32F401VC, discovery board)

I use TIM1 in repeat and one pulse mode to generate 8 CLK for 1 byte of SPI

I have a working 10MHz 8 clock pulses on pin PE9.

0690X00000604iRQAQ.png

I would like to set SPI1 (PB4->MISO and PB3->SCK) in slave mode and output with CLK generated by TIM1

Are there any obsticles I am unaware? Vpp voltage drops from 3,3V to about 2V when I connect PE9 to PB3. :\

Thank you!

More info:

I have a working SPI1 and SPI2 synchronization (one master, second slave, just about 10ns delay), and triggering on timer interrupts. SLEEPONEXIT enable. Disabled SYSTICK timer. But (input) capture interrupts ruin everything. I would like this TIM1 as CLK to work as I can set DMA earlier and then SPI can do its job on time!

#spi1 #tim1
2 REPLIES 2
Posted on November 05, 2014 at 20:47

Vpp voltage drops from 3,3V to about 2V when I connect PE9 to PB3.

Yes, that doesn't sound good. What else is going on there?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
stegu
Associate
Posted on November 05, 2014 at 22:11

Good question! I need to focus focus.

MY BAD I had wrong setting for SPI (master instead of slave). :\

Back to work now 🙂 I think it is doable.

CPOL=0, CPHA=1, 0x7a on picture:

0690X00000602ylQAA.jpg

Thank you clive1, for this and other answer you left on forum. (Use it all the time)