cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H745 input fast read

EsKi
Visitor

Hi, I have problem. I have idea: my STM32H745 must read GPIO state as quickly as possible. FCPU = ~400MHz

I wrote the program in assembler for M7

LED_ON()

ldr r2, [r3, #IDR]

ldr r2, [r3, #IDR]

... ~650x

LED_OFF()

...

only read, IDR, no write (no record yet)

And when I measure with an oscilloscope the led output is on for 25us -> one LDR 15 cycles clock CPU. When I read from RAM it takes about 12us, but GPIO 25us.

 

This is too slow for me. I tried all the tricks and combinations of LDR; STR ... LDR LDR STR STR ... LDR AND LDR STR AND ... Minimum is 25us.

 

LDR gpio and STR ram are without comment at all. Some astronomical values ​​come out that can be obtained from AVR or DSPIC.

 

I tried FMC to read and it was even worse.

 

What is the fastest way to read the state of a ~40MHz pin?

 

1 REPLY 1
gbm
Lead III

Two possibilities:

- For single pin - use SPI MISO line and SPI RX DMA. This guarantees fixed sampling frequency.

- For multiple pins - use timer-triggered DMA from port to memory. Some frequency variations and jitter will appear.

 

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice