Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
August 31, 2009 - 3:09pm
|
Hello, I bought RLink-PRO tool. I installed last Ride7 version avialable at your site (7.22.09.0203). When trying to blank check STM8AF6166 micro with "ST8_pgm TSTM8AF616 B" - two erros appears: - error 303: error during SWIM entry sequence ...... Most frequently err 304 appears. By the way in STM8_SWIM_ProductInfo file I didn't find STM8AF6166 micro. Does it mean that STM8AF616 option covers ALL ...6166 micros ??? Thanks in advance |
Hi,
Yes, the STM8AF616 selection covers all STM8AF616x devices. The last 6 of "STM8AF6166" tells the pin count of the device, which makes no difference as far as programming and debugging are concerned...
Please confirm that you are using the latest version of the RKit-STM8 kit.
If yes, then it looks like a connection problem...
Please check that the GND, VCC, RST and SWIM signals are connected from the RLink to the STM8.
Remember that VCC is the power from your board to the RLink, not the other way.
Check that no other component might be interfering with the RST or SWIM signals.
Check also that the lines for these signals are not too long or close to strong fast-moving signals.
If your VCC is lower than 3V, check that you have plugged the 'Adapt' jumper on the RLink ADP.
Check also all the powers and GNDs of the STM8.
Check that the VCAP pin is indeed connected to a capacitor of the correct value, with GND on the other side.
If all this doesn't solve the problem, then I will need to see the board's schematic before I can help any further.
Best Regards,
Vincent
Hello Vincent,
Yes, RKit-STM8 is the latest one downloaded yesterday (2.24.09.0238).
... But I see that in License column "RKit-STM8 Evaluation Suit" stands. Is there any memory limitattions ?
Just to add that I'm trying to program micro out of any board:
- micro is placed in QFP323 socket
- SWIM pins (1, 4, 6, 9, 10, 26) are wired to SWIM connector of RLink adapter
- jumpers are set to SWIM and PW-5V
Regards
Hi,
If it was a problem of license, you would get errors during compiling or linking.
Debugging (and programming) STM8 with RLink is not limited by any license.
Are you aware that the PW-5V jumper is designed for the RLink to power the target board?
Please confirm that this is what you want to do, and that there is no other power on your board that would conflict with the power from the RLink.
Please also tell me if there are components other than the STM8 and the RLink connected to the RST and SWIM signals.
When you get error 304, does it come very shortly after trying to connect, or only several seconds after?
Best Regards,
Vincent
Hi,
Meanwhile I observed that when I unplug/plug USB cable blank check works well... but first time only.
Second (and next) trial gives error 102.
Microcontroller I'm trying to program is not assembled on any PC board. I just use QFP32 socket that is wired to SWIM pins of RLink adapter. All SWIM connections (VCC, GND, Reset, and SWIM_data) are straightforward - not any external components.
Error 304 comes several seconds after - as a real timeout .
Hi,
Thanks for the information.
Which text do you get with the error 102?
Have you connected a capacitor on the VCAP pin?
I never managed to do anything correct with a STM8 if this capacitor was not there and close enough.
I have done my share of 'minimal boards' with the STM8 prototypes. They had GND, VCC, RST, SWIM, one IO to a LED ... and VCAP!
Intermittent failures (or I should say "intermittent successes" ;) ) like you describe is typically what happens without it.
Best Regards,
Vincent
Hi Vincent,
I added VCAP=100n and 22n between VCC and GND (just in case) ...
....And do not believe - communication bacame stable. 10 trials - 10 siccess. It seems communication is very sensitive against voltage spikes.
So this point is resolved - many thanks !!!
Second one:
I have to implement programming of micro as part of In-Circuit Test.
It means that test program needs to detect bad or good programming WITHOUT "human eye".
Command prompt STM8_pgm.exe is fine to run programming but how to get returned result programmaticaly ? Can I use any .dll function to get it ???
Thank You in advance
Hi,
Yes, I wouldn't expect anything to work without the capa on VCAP. See the STM8 datasheet for more information on this.
STM8_pgm has a Verify command that reads the flash out from the device and compares it with the expected content. And it returns an error code, like any Windows program, that you can test from a batch file or any other calling script or program. 0 means success, other values (102, 303, 304, etc.) are errors.
Best Regards,
Vincent
Hi,
Yes, I understand Your idea - it will work.
Does STM8_pgm distinguish Program, Data and OptionsByte Memory or I must use one merged .hex file to program micro ? In other word - is it possible to program Data Memory only ?
Best Regards
Hi,
The programming commands of STM8_pgm (P, F and U) program everything that is in the hex file and nothing more.
So if you want, you can have a single hex file containing data for Program, Data and Option Bytes memories. This is the fastest way to proceed, as it saves time by factorizing parts of the initialization phases of the programming of the three memory regions.
Or you can have several hex files, which will allow you to program the Program and Data memories, verify them, and then program the Option Bytes Memory. That's the typical method when setting Read-out protection in the option bytes, because you cannot verify the flash after setting the ROP.
You can also program the Program memory from a hex file and the Data memory from another hex file. That's the typical method when writing things in the Data memory that are unique for each device, like Serial Numbers or calibration values.
Basically, you can do as you wish. ;)
The erasing commands are different. You can erase everything (EA), or just one region (EF, EE, EO). Of course if ROP is set, you can only Erase All.
I hope it helps.
Best Regards,
Vincent
Hi,
Sorry for asking again, but next batch file:
@echo off
cls
c:
cd\
cd C:\Program Files\Raisonance\Ride\bin
start STM8_pgm TSTM8AF616 E B
if errorlevel 1 goto ERROR_1
echo OK
goto end
:ERROR_1
echo NOK
goto end
:end
cd\
returns always OK (not error) - even if micro is wrong positioned or not connected ???
Regards
Hi,
Try using "call" instead of "start" in your batch file.
"start" tells the batch interpreter to launch STM8_pgm in a separate process, and it does not wait for it to end before going on interpreting the rest of the batch file. Therefore, in your example you test the error code before STM8_pgm has returned, and so you never see the value that it really returns.
"call" tells the batch interpreter to launch STM8_pgm and wait for it to end. That's what you want to use.
Best Regards,
Vincent
Hi Vincent,
Yes, it works.
It was last question.
Many thanks !
Hi,
Thanks to you:
Now I have a very nice FAQ for the new STM8 users, showing all the main traps. ;)
Best Regards,
Vincent