Topic : Programming with RLink from my application [was: RLink]

Forum : ST7/STM8

Original Post
Post Information Post
February 22, 2007 - 9:03pm
Guest

Is it possible to interface with Rlink programmer's DLLs? I can program a ST7 uC by calling the ST7_pgm EXE, but I always get a successful status int (0). A 0 is returned even if I have the Rlink disconnected from the uC. I need some way of knowing the uC was or was not programmed. It would be good to integrate some of the DLLs into a custom application to check for this. Do you have any documents showing how to do this for C++ or .NET?

Replies
Post Information Post
+1
0
-1
February 26, 2007 - 3:28pm
Raisonance Support Team

Hi,

No, it's not possible to interface with our DLLs, and we don't want to make it possible. But we can and will make ST7_pgm return an error code. Actually, it should do it already. I'll check why it doesn't and correct that.

Best Regards,

Vincent

+1
0
-1
February 26, 2007 - 4:46pm
Raisonance Support Team

Hi,

I tried it here with the latest version and it works fine.

Please tell me the Build Number of the RIDE you are using. You can see it by clicking "help"->"About" in RIDE.

Are you sure that your procedure for getting the returned code is correct? I've done it with Visual C++ and found that it's not really straightforward.

For testing the executable, I wrote a batch file that calls it and displays the error code. Please try to copy the code below in a batch file and then execute it with RLink connected and then without it, and tell me what you see.

st7_pgm ST7Lite39 I
echo %errorlevel%

Best Regards,

Vincent

+1
0
-1
February 28, 2007 - 8:09pm
Guest

I could have called the wrong function before. If the RLink is not connected I receive a 0x304. If RLink is connected but module is not powered I receive a 0x303. I have seen a 0x102 returned, as well. Do you have a list of error messages/codes for the RLink.

Thanks

+1
0
-1
March 1, 2007 - 10:04am
Raisonance Support Team

Hi,

First, please note that there is no bijective relation between the error codes and the error message. The same error code can come with several different messages, and the same message could come with several different error codes.

The error code gives information on the type and source of error. The message gives some additional information.

The executable outputs the error message on its stdout stream. You should redirect it to your application and format it for displaying as you wish.

The error code consists in two bytes, for the type and source of the error. Below are the definitions. As you can see, 0x304 means "fatal communication error", and 0x303 means "recoverable communication error". But these are quite vague, so you really need to take the error message from the stdout...

Warm Regards,

Vincent

//standard error codes
#define DNG_ERR_OK 0         //no error.

// type: the 8 first bits are for the type of error.
#define DNG_ERR_WARN        1   //Warning.
#define DNG_ERR_TMP         2   //temporary error. try again later.
#define DNG_ERR_RECERR      3   //recoverable error. (means that other commands can be done)
#define DNG_ERR_FATAL       4   //fatal error.
#define DNG_ERR_LASTTYPE    4   //for the callers to define their own codes

// source: the next 8 bits are for the source of the error.
#define DNG_ERR_UNIMP           0      //command not implemented yet.
#define DNG_ERR_DEVICE          0x100   //device error.
#define DNG_ERR_PARAM           0x200   //wrong parameters received.
#define DNG_ERR_COM             0x300   //communication error.
#define DNG_ERR_PROTECT         0x400   //protection error.
#define DNG_ERR_INTERNAL        0x500   //internal error.
#define DNG_ERR_DATA            0x600   //data error (when verifying, for example).
#define DNG_ERR_COMMANDLINE     0x700   //error in the command line (for executables)
#define DNG_ERR_USER            0x800
#define DNG_ERR_LASTSOURCE      0x800   //for the callers to define their own codes

//standard return values
#define DNG_ERR_BUSY          (DNG_ERR_TMP+DNG_ERR_DEVICE)         //device busy
#define DNG_ERR_REAL          (DNG_ERR_RECERR+DNG_ERR_DEVICE)      //"real" error reported by the device
#define DNG_ERR_WRONGPARAM    (DNG_ERR_RECERR+DNG_ERR_PARAM)      //wrong parameter
#define DNG_ERR_FORBIDDEN     (DNG_ERR_RECERR+DNG_ERR_PROTECT)      //forbidden access
#define DNG_ERR_DATAERR       (DNG_ERR_RECERR+DNG_ERR_DATA)         //Data Error
#define DNG_ERR_COMERROR      (DNG_ERR_RECERR+DNG_ERR_COM)         //communication failed
#define DNG_ERR_LOSTCOM       (DNG_ERR_FATAL+DNG_ERR_COM)         //communication lost
#define DNG_ERR_PARAMERROR    (DNG_ERR_FATAL+DNG_ERR_COMMANDLINE)   //error in the command line
#define PARAMERROR            (DNG_ERR_PARAMERROR)                  //error in the command line (old define, kept for backward-compatibility)
#define DNG_ERR_INT           (DNG_ERR_FATAL+DNG_ERR_INTERNAL)      //internal error
#define DNG_ERR_ABORT         (DNG_ERR_FATAL+DNG_ERR_USER)          //user abort
+1
0
-1
March 6, 2007 - 4:50pm
Guest

Have a good day.

I can write with ST7_pgm.
Is it possible to read the MCU.

Thanks.

+1
0
-1
March 6, 2007 - 5:38pm
Raisonance Support Team

Hi,

No, you cannot read the flash using st7_pgm.

You have to use RFlasher for that.

Best Regards,

Vincent

+1
0
-1
March 6, 2007 - 5:46pm
Guest

Have a good day.

I have used ST7_pgm in c++.
Is RFlasher a program which gets command from command line and exits with a code.

Thanks

+1
0
-1
March 6, 2007 - 6:07pm
Raisonance Support Team

Hi,

No. RFlasher is a GUI, and there is no way to read the flash with a command-line executable for now.

Maybe we'll do that later, but I cannot tell when.

Best Regards,

Vincent

+1
0
-1
March 21, 2007 - 5:00pm
Guest

Have a good day.

in command line

st7_pgm st7liteus 2.hex no problem

st7_pgm st7liteus 2.hex 0xF023 F Error102 No Response from the DTC

What must i do?

Thanks.

+1
0
-1
March 21, 2007 - 5:21pm
Guest

continues from the above message

st7_pgm st7liteus 2.hex 0xF023 F there is error102 but inside configuration as i want.

Is there anyway to read 0 instead of 102.

+1
0
-1
March 22, 2007 - 10:25am
Raisonance Support Team

Hi,

I get the same error when I use REva powered from the RLink. In this situation, VCC is only 3.73V, which is probably low enough to trigger the LVD. If I use a 9V external power on the jack connector, then I have a VCC of 5.13V and I don't have the error anymore.

So it seems to me that you are using a power that is too low, and this triggers the LVD. (you program 0xF023 in the option bytes, which activates the LVD)

Can you please measure the VCC on your board?
Are you using the REva?
If yes, how do you power it?
Do you have the possibility to use a higher VCC?

Best Regards,

Vincent

+1
0
-1
March 22, 2007 - 12:33pm
Guest

Have a good day,

i use RLink Primer ST7Ultralite and Vcc is nearly 4.5V because of serial diode and USBVcc is 4.8V.
I use an other same MCU with an other PCB.I cancelled the MCU on the RLink Primer board.The values doesnt change when i plug the MCU.The results are the same.

Thanks.

+1
0
-1
March 22, 2007 - 2:20pm
Raisonance Support Team

Hi,

Sorry, but the RLink in the Primer is not supposed to be used with anything else than the ST7Ultralite that is in the Primer.

We don't expect it to work in the configuration you are using, and of course we don't give any support for it.

Best Regards,

Vincent

+1
0
-1
March 22, 2007 - 2:25pm
Guest

Thanks again.