cancel
Showing results for 
Search instead for 
Did you mean: 

Fast gpio read with sync

linas2
Associate II
Posted on February 05, 2013 at 09:46

Hello, I have 16b parallel bus, 8MHz adc, and I need to read as fast as I can data to memory array which is 128 point long. So far I overclocked stm32f4 to 250MHz so I could do it faster. Original code is :

while(i<128)

{

         array[i]=GPIOC->IDR;

         i++;

         while((GPIOA-IDR & GPIO_Pin15)==GPIO_Pin15)

         while((GPIOA-IDR & GPIO_Pin15)! =GPIO_Pin15)

}

Can I do it faster with fsmc or dma ? A15 is clk from adc, sync should be done on rising edge

4 REPLIES 4
Posted on February 05, 2013 at 17:10

The STM32's are not well architected to handle such interfaces, can you mitigate the interface through a buffer, FIFO, or FPGA?

Say a FIFO with a half-full line that can generate an EXTI interrupt and you can burst read half the words in the FIFO?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
linas2
Associate II
Posted on February 05, 2013 at 19:02

i tried to use clk as interrupt signal, it didn't helped.

it looks like it reads data bit by bit to memory, not all 16b at once.

Compiler looks like efficient, it can toggle gpio bit at 1/2 cpu speed (prescaler = 2 )

Does any FSMC mode use CLK, so it could be moved to memory by dma ?

Posted on February 05, 2013 at 19:48

The FSMC doesn't provide for an inbound interface like you are describing, it can fetch data very quickly but via the outbound signals from the STM32, and you would need some external logic to mitigate the differences in the interfaces.

Interrupts probably won't work/help because of the latency and speed. A buffer/latch may permit you to tolerate this, but might not give you the bandwidth required.

You need a hardware REQ/ACK type interface, the STM32 does not have one. You might be able to fashion something with a TIM input, and a DMA request, but it would require a bunch of time to investigate and test.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on February 06, 2013 at 18:29

Not REQ/ACK, but the camera interface present in some models is a form of  parallel slave interface. It *may* fit the OP's purpose.

I has its specifics, though.

JW