cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 gpio speed problem

garinus
Visitor

Hello everyone,

I am encountering difficulties with a project. I decided to use an STM32H7B0 microcontroller, which I had previously used in other projects, for a new application. However, I have encountered a difficulty due to the signal propagation delays between the core and the GPIO peripherals.

Specifically, I need to wait for the state change of an input and immediately change the state of an output pin at a particular point in the code. The pins are already allocated on two ports and I cannot change them at the moment (the need is for multiple inputs and outputs).

The issue is that the propagation time, besides being excessively long (currently not below 200ns), is not stable.

I am working at 280MHz, have DMA enabled for ADC, and disable interrupts during the execution of this code. I have already tried all levels of optimization:

while (LL_GPIO_IsInputPinSet(INPUT_GPIO_Port, INPUT_Pin) && __HAL_TIM_GET_COUNTER(&htim17) < 250)
{
}

LL_GPIO_ResetOutputPin(OUTPUT_GPIO_Port, OUTPUT_Pin);

It does not seem to depend on the code but rather on the access time to the peripherals.

5 REPLIES 5

The fact that your post does not contain a question indicates that you already understood.

This is an inherent property of the overcomplicated 'H7 architecture and you can't avoid/circumvent it, unless you pull out the functionality you expect entirely in hardware (probably in timer).

JW

 

garinus
Visitor

Hi,

you're right I forgot the question, which was if anyone had a solution or a workaround to limit or avoid the problem. 
Do you think it is possible to use timers to achieve this? Do you know where I can find a guide to perform this type of synchronization?

> Do you think it is possible to use timers to achieve this?

It's hard to tell unless we know what exactly is "this"?

> Do you know where I can find a guide to perform this type of synchronization?

I don't talk about synchronization but about performing the task entirely in hardware.

JW

What is the requirement here? Just "as good as possible" or do you have specific needs?

It's probably not possible to have an exact delay between a generic input and an output. You could significantly improve the code with better code and better optimization settings, but some delay is to be expected. 200ns is pretty small but is probably doable with better code.

If the inputs can be hooked up to the opamp or a timer input, you could likely use some functionality of those peripherals.

If you feel a post has answered your question, please click "Accept as Solution".
garinus
Visitor

the code have to do basically this: 

LL_GPIO_SetOutputPin(OUTPUT_GPIO_Port, OUTPUT_Pin);
while
(LL_GPIO_IsInputPinSet(INPUT_GPIO_Port, INPUT_Pin) && __HAL_TIM_GET_COUNTER(&htim17) < 250) { } LL_GPIO_ResetOutputPin(OUTPUT_GPIO_Port, OUTPUT_Pin);

Where the input pins were currently mapped as GPIO INPUT, but can be configured as 4 channels of TIM3.

While the outputs are GPIO, but can be on TIM2 or TIM1.

I had thought about the COMP but the pins are already occupied for analog signals.