2025-03-24 4:29 AM
Hi everyone,
I have 12v dc 4 channel relay module which have stm8s103f3 on it.
i am using ST visual develop and STVP to flash program using ST-Link V2 programmer.
ST-Link V2 Pins: 1- RST, 3- GND, 5- Swim, 7- 3.3v (which is required for relay module).
when i make the connections as above pinouts and try to program using In ST programmer, the module gets turned ON but it gives:
Error : Cannot communicate with the device !
Check the SWIM cable connection and check all the needed pin connections on the SWIM connector.
If the application code uses Swim Disable and Reset pin as Output or has disabled SWIM Clock Divider:
Try Now to SWITCH OFF and ON the application Power Supply while NRST Reset pin is forced low.
Error : < PROGRAM MEMORY verifying failed.
I have attached the image of Module and programmer.
please help to find the solution on it.
Thanks, and regards.
Saurav.
2025-03-24 5:58 AM
Welcome @saurav, to the community!
Ahm... you use a fake ST-LINK/V2 with a counterfeit STM32F103 in one of those colourful tin cans and expect STMicroelectronics to support it?
A solution would be a genuine ST-LINK/V2 from an authorised dealer, e.g. from the eStore of STMicroelectronics. Yes, it's a little more expensive, but it also works.
Regards
/Peter
2025-04-03 9:04 PM - last edited on 2025-04-04 2:03 AM by Andrew Neil
Hello Peter,
As per your suggestion I have tried to flash the firmware with the help of ST-LINK/V2-ISOL debugger. but got the same problem.
first of all i have tried to give 3.3v supply from debugger but debugger did not provide 3.3v supply.
then i have tried with external 12v supply. then controller receive the supply and led glows but still device did not get connect by connecting only 3 wires (RST, GND, SWIM).
I have attached the image of debugger.
according to manual we have made the connections shown below:
Relay module | ST-LINK/V2 ISOL (20 pin) pin no. |
3v3 | 1 |
GND | 12 |
SWIM | 7 |
RST | 15 |
I have tried both the RST pins (15th and 3rd).
Also, i have tried the (5th, 7th, 9th and 13th pins) for SWIM connection but, not worked.
Please suggest the solution.
Thanks, and regards.
Saurav.
2025-04-04 12:21 AM - edited 2025-04-04 12:22 AM
Hi,
SWIM ? its for STM8 series - sure you have not an stm32f103 ?
2025-04-04 1:21 AM - edited 2025-04-04 1:29 AM
Hi,
Yes, I have STM8 series controller (STM8S103F3).
i have connected SWIM PIN from controller to PIN 7 of debugger.
I am not completely sure that PIN 7 is a SWIM or not but, that's why I have tried with PIN 5, 7, 9,13.
but every time same issue occurs.
Earlier I had tried with clone debugger and now as Mr. Peter suggests to use a genuine debugger.
but same issue observed with both debuggers.
one more thing, Does ST-LINK/V2- ISOL is Right for STM8 controllers as I need to use SWIM PIN. OR need to use ST-LINK/V2 as it has separate connector for STM8. because on ST-LINK/V2- ISOL, STM8 & STM32 is mentioned.
Thanks, and regards.
Saurav.
2025-04-04 1:49 AM
Sorry, i cannot say much about stm8...didnt do much with these.
But from pins: i would use the V2 stick ("clone"), connect: vcc, gnd, swim, rst .
Then power cycle: disconnect vcc, press + hold reset lo, connect vcc. Now try connect /flash ...
if connect , release rst lo.
2025-04-04 1:50 AM
The connection on the ST-LINK/V2-ISOL:
Regards
/Peter
2025-04-04 2:10 AM - edited 2025-04-04 2:12 AM
@saurav wrote:
As the title of that table says, That's about JTAG/SWD.
The STM8 does not use JTAG/SWD - it uses SWIM.
@saurav wrote:Does ST-LINK/V2- ISOL is Right for STM8 controllers .
Yes - see section 4.1 in the User Manual:
via: https://www.st.com/en/development-tools/st-link-v2.html#documentation
The SWIM connections are shown in Table 3:
2025-04-04 2:29 AM - last edited on 2025-04-04 2:31 AM by Andrew Neil
Yes,
Mr. Andrew
Earlier I have checked this also.
but see below:
As Mr. Peter said.
And if you look at the image below the Orange and White colour pins are already connected on 10th PIN which is SWIM and 14th PIN which is RST.
So, i have connected the SWIM on 10th PIN and RST on 14th pin which is also shown in above image.
but still the issue is occurring.
Thanks, and regards.
Saurav Koli.
2025-04-04 2:37 AM - edited 2025-04-04 2:38 AM
That's the photo from the ST Manual.
Please show a photo of your own setup.
The schematic of your board would also be helpful.
See: How to write your question to maximize your chances to find a solution.
The screenshot you showed earlier:
Says SWD - again, the STM8 does not use SWD !
Please see How to take screenshots in Windows - rather that photographing the monitor!