-
-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Support stlink v2 isol variant #1720
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,19 @@ void platform_init(void) | |
#ifdef BLUEPILL | ||
led_idle_run = GPIO13; | ||
nrst_pin = NRST_PIN_V1; | ||
#elif defined(STLINK_V2_ISOL) | ||
led_idle_run = GPIO9; | ||
nrst_pin = NRST_PIN_V2; | ||
/* PB12 is SWDIO_IN */ | ||
gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO12); | ||
/* PA4 is used to set SWDCLK floating when set to 1 */ | ||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO4); | ||
gpio_clear(GPIOA, GPIO4); | ||
/* PA1 is used to set SWDIO floating and MUXED to SWDIO_IN when set to 1 */ | ||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO1); | ||
#elif defined(STLINK_FORCE_CLONE) | ||
led_idle_run = GPIO9; | ||
nrst_pin = NRST_PIN_CLONE; | ||
#else | ||
switch (rev) { | ||
case 0: | ||
|
@@ -69,7 +82,13 @@ void platform_init(void) | |
} | ||
#endif | ||
/* Setup GPIO ports */ | ||
#ifdef STLINK_V2_ISOL | ||
/* In case of ISOL variant, this pin is never set to high impedance */ | ||
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN); | ||
Comment on lines
+85
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if that's true -- PB14 being T_JTMS (effectively T_SWDIO_OUT) was toggled to become input across BMF previously. Do you think PB14 forcing high/low SWDIO in no way interferes with receiving data on PB12 across the isolation circuitry? Although I don't have the exact schematics and don't know where the 100R between SWDIO_IN & SWDIO_OUT resides for ISOL PCB. But you seem to have the means to test it with live targets. |
||
#else | ||
/* In all other variants, this pin is initialized as high impedance */ | ||
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_INPUT_FLOAT, TMS_PIN); | ||
#endif | ||
gpio_set_mode(TCK_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, TCK_PIN); | ||
gpio_set_mode(TDI_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, TDI_PIN); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wanted to, you could implement feature parity with BMP v2.3 HW rev 6 w.r.t. floating the SWCLK pin, required to support stm32g0 in small pin-count packages. See Issue 945 and PR1192 (intentional not-a-mention), specifically commit a573c26 for
native
platform.PB12 is
T_SWDIO_IN
on most/all stlinkv2 schematics, and you made it a macro -- please substitute it into here (SWDIO_IN_PIN
).Accordingly, PA4 sounds like
TCK_DIR_PIN
and PA1 likeTMS_DIR_PIN
/SWDIO_DIR_PIN
. This makes for less unused/magic pin numbers, even if you described their purpose in adjacent comments (nice!).