cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S001J3M enter SWIM mode problem

XLi.3
Associate II

Hello,

I want to program the device using SWIM interface, The host is FPGA, but the device can't response successfully.

When I reset the SWIM, the return value is wrong, and write SWIM_CSR could not successfully.

I attach the wave form picture, please help to check what the problem.

Thanks very much.​

I can use ST-Link to program the device.

4 REPLIES 4
Cristian Gyorgy
Senior III

You can tell more easily if a tree is dead by looking at it as a whole rather than analyzing its leaves under microscope.

So, better show us the setup rather than oscilloscope frames.

XLi.3
Associate II

​Hello Cristian,

Thanks for your reply.

I just do 4 step,

  1. write SWIM entry sequence,   Does the SWIM entry sequence of this device is 8 bits: 4 pulses at 1ms, followed by 4 pulses at 0,5ms? Does it need change?
  2. send SRST sequence to reset system.
  3. write SWIM_CSR register 0x20 to enable the SWIM debug
  4. write  SWIM_CSR register 0xA0.

Then, it has error, sometimes the step 3 has error, others the step4 errors.

It seems the programmer could not receive right ACK waveform after sending command.

Please help give me some suggestion.

Shirley

XLi.3
Associate II

​Hello,

I see in the datasheet:

The “connect on-the-fly�? mode can be used while the device is executing code, but if there is a device reset (by software reset) during the SWIM connection, this connection is aborted and it must be performed again from the debug tool. Note that the software reset occurrence can be of every 4 milliseconds, making it difficult to successfully connect to the device's debug tool (there is practically only one successful connection trial for every 10 attempts). Once that a successful connection is reached, the device can be programmed with a valid firmware without problems; therefore it is recommended that device is never erased and that is contains always a valid code loop.

Does the device is difficult to connect?

Thanks!

Philipp Krause
Senior II

A problem with the 8-pin STM8 devices is that the SWIM connection pins are wired together with multiple bond pads internally and there is no external reset pin. Setting a port as output that shares a pin with a SWIM input pin will make the device inaccessible via SWIM. For details see section 7.2, "Delay before SWIM pin configuration" in the STM8S001J3 getting started document (AN5047).