cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 spi

yyurikedd
Associate II
Posted on November 10, 2015 at 11:26

Hi.

I am tying to connect my STM32F4 (or F1) with external ADC. 

Data from ADC can be received by SPI after ADC set ''ready'' flag.

So the task for controller is to read by SPI 16 bit data on external event.

The easiest way I've tried is:

- enable SPI in ''external event'' handler,

- disable SPI in ''16 bits recieved'' after reading data.

The problem is that on the high enough SPI clock frequency, SPI has time to start generating more 16  clock pulses before SPI diasbling command occurs. So I have two ''16 bits recieved '' exeptions instead of the correct one.

I've got some ideas how to solve the problem, but they are little rough.

Can somebody please tell me the way to solve the problem. 

I particularly appreciate the hardware solution of the problem. 

#stm32-spi
1 REPLY 1
Posted on November 10, 2015 at 11:41

>  disable SPI in ''16 bits recieved'' after reading data.

What???

If you set SPI to transfer 16-bit, it's one single write to the data register, wait until receiver ready, then a read from data register.

Read the fine manual.

JW