Skip to main content
Visitor II
March 24, 2025
Question

12v dc 4 channel relay module / Error : Cannot communicate with the device !

  • March 24, 2025
  • 3 replies
  • 2430 views

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.

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    March 24, 2025

    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

    sauravAuthor
    Visitor II
    April 4, 2025

    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 moduleST-LINK/V2 ISOL (20 pin) pin no.
    3v31
    GND12
    SWIM7
    RST15

    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.

    Super User
    April 4, 2025

    Hi,

    SWIM ? its for STM8 series - sure you have not an stm32f103 ?

     

    sauravAuthor
    Visitor II
    April 4, 2025

    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.

    saurav_0-1743754395256.png

    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.

    Super User
    April 4, 2025

    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.

    sauravAuthor
    Visitor II
    April 7, 2025

    I have attached the image of setup which showing the connection between STM8S103F3 which is mounted on relay module with Debugger.

    When I tried to give supply from ST-link/V2 debugger using VCC PIN 1 (3.3v) the debugger was unable to provide the supply. That's why I have given external 12v dc supply to module.

    I have made below connections:

    Relay moduleST-LINK/V2 ISOL (20 pin) pin no.
    GND (grey)12
    SWIM (pink)10
    RST (black)14 

     

     

    Thanks, and regards.

    Saurav.

    Technical Moderator
    April 7, 2025

    Can you please upload a schematic of the relay module?