cancel
Showing results for 
Search instead for 
Did you mean: 

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

saurav
Associate II

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.

11 REPLIES 11
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.

Hi,

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

 

If you feel a post has answered your question, please click "Accept as Solution".
saurav
Associate II

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.

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.

If you feel a post has answered your question, please click "Accept as Solution".

The connection on the ST-LINK/V2-ISOL:

  • SWIM on pin 10
  • RST on pin 14

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

@saurav wrote:

 

AndrewNeil_2-1743757942789.png

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:

AndrewNeil_0-1743757704362.png

https://www.st.com/resource/en/user_manual/um1075-stlinkv2-incircuit-debuggerprogrammer-for-stm8-and-stm32-stmicroelectronics.pdf#page=9

via: https://www.st.com/en/development-tools/st-link-v2.html#documentation

 

The SWIM connections are shown in Table 3:

AndrewNeil_1-1743757820056.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Yes,

Mr. Andrew

Earlier I have checked this also.

but see below:

As Mr. Peter said.

saurav_0-1743758254130.png

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.

saurav_1-1743758476675.png

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.

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:

AndrewNeil_0-1743759272535.png

Says SWD - again, the STM8 does not use SWD !

Please see How to take screenshots in Windows - rather that photographing the monitor!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.