stlink icon indicating copy to clipboard operation
stlink copied to clipboard

[feature] RFC: Support GPIO change triggered programming with STLINK-V3

Open martonmiklos opened this issue 3 years ago • 4 comments

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!

martonmiklos avatar Apr 09 '21 09:04 martonmiklos

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.

Ant-ON avatar Apr 11 '21 07:04 Ant-ON

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?

martonmiklos avatar Apr 11 '21 08:04 martonmiklos

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 avatar Apr 12 '21 04:04 Ant-ON

@Ant-ON Can you propose an implementation based on your initial idea?

Nightwalker-87 avatar Aug 31 '22 19:08 Nightwalker-87

Closing this feature request due to inactivity.

Nightwalker-87 avatar Sep 04 '23 22:09 Nightwalker-87