stlink
stlink copied to clipboard
[feature] RFC: Support GPIO change triggered programming with STLINK-V3
Hello folks!
I opened this issue to start some discussion about the following idea: The STLinkV3 has GPIOs which could be accessed through the USB via a so called 'bridge API'. I would like to use these GPIOs to detect the target connection before programming. I usually use TAG connect connector which has 6 pins: VCC, 2 GNDs, RST, SWDIO, SWDCLK. One of the GND pins is connected to the STlink's GND and the another one to a GPIO which configured to input with a pull up.
I am thinking about adding the following arguments to the st-flash to being able to detect the target connection and start the programming automatically:
- config GPIO (--config-gpio <gpio_number> <gpio_mode>) gpio_mode could be in, in_pd, in_pu
- wait for GPIO level (--wait-for-gpio-level
) level could be low, high or 0, 1
If these arguments passed to the st-flash the GPIO configuration and the transition wait would be executed before any programmer operation.
With this modification the serial programming could be made easy.
Any comments on this idea is welcome!
I think this could be useful in a narrow range of tasks.
It seems to me that both actions could be reduced to one command. Like this --config-gpio <gpio_number> <gpio_mode> <action>
. action
could be some thing like none
, wait-for-hi-level
and wait-for-low-level
. In the future, other actions may appear.
Like this --config-gpio <gpio_number> <gpio_mode>
. action
Merging the arguments makes sense but then I would rather name it --config-gpio-trigger. Because the config-gpio name describes only the half of the feature and could be overlooked by someone who looks for this feature in man or in help. What do you think?
I think that the trigger postfix only narrows the functionality of the option. It seems like this is just a trigger setting. If you want to focus attention on the trigger option, then maybe so?
--config-gpio <gpio_number> <gpio_mode> <trigger>
@Ant-ON Can you propose an implementation based on your initial idea?
Closing this feature request due to inactivity.