[SOLVED] Flasher STM8 Problem

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Flasher STM8 Problem

    Good day to all,

    I need help to fix a problem i have with the Flasher for STM8. I had prepared a project to flash the memory of my STM. Since the program, in production phase, could change i need to build a system to overcome this possibility. In practice I ha build an application that load the right program on the flasher during startup phase, so the flasher could work correctly. After some programming procedure, all goes well, i try to change the program loaded on the flasher and at this point i encountered problems. Ireceive this error:

    Application log started
    - Flasher STM8 V1.30h (Flasher STM8 Software compiled Aug 19 2016 15:28:55)
    - JLinkSTM8.dll V1.30h (DLL compiled Aug 19 2016 15:28:53)
    Reading flash device list [C:\Program Files (x86)\SEGGER\FlasherSTM8_V130h\ETC\FlasherSTM8\Flash.csv] ...
    - List of flash devices read successfully (159 Devices)
    Reading MCU device list [C:\Program Files (x86)\SEGGER\FlasherSTM8_V130h\ETC\FlasherSTM8\MCU.csv] ...
    - List of MCU devices read successfully (159 Devices)
    Opening project file [C:\Candy\Products\31006961\STM8S207CB_SEGGER0.jflash] ...
    - Project opened successfully
    Opening data file [C:\Candy\Products\31006961\STM8_Flash.hex] ...
    - Data file opened successfully (131072 bytes, 1 range, CRC = 0x176884BA)
    Merging data file [C:\Candy\Products\31006961\STM8_Eeprom.hex] ...
    - Data file merged successfully (133120 bytes, 2 ranges, CRC = 0x0D0A618A)
    Downloading files to programmer...
    - Downloading "Flasher.cfg" (2048 bytes) ...
    - ERROR: Can not connect to emulator via USB.
    - ERROR: Could not download to emulator

    The only way the make the flasher work again is to unplug it from usb and then plug in again. The problem seem to appear only if i put one or more flashing procedure beetwen one loading project procedure and another. Any hint?

    Thank you in advance!

    The post was edited 3 times, last by MATA82 ().

  • Dear MATA82,

    Is my assumption correct that you are programming by using the Flasher button, or a remote terminal ?

    This will leave the PC mode and enter the stand alone mode in which the Flasher will no longer accept commands from
    Flasher STM8 Software or STM8 Commander sent via USB or Ethernet.

    If you do use the button or remote trigger, is there a specific reason not to use programming directly out of Flasher STM8 Software instead of anything else ?

    Best regards,
    Oliver Olligs
    Flasher STM8 Product Manager
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Yes, you're right I use the com port to send serial commands; #auto in particular. I was using the serial commands because i can catch the flasher response and display it in my application's interface, instead of opening another window. Can i load a project into the flasher using the com port?

    The post was edited 1 time, last by MATA82 ().

  • Dear MATA82,

    MATA82 wrote:

    Can i load a project into the flasher using the com port?
    Not directly. You can access the file system of the Flasher using the file I/O described in the manual:
    #FOPEN, #FCLOSE, #FDELETE, #FWRITE, #FREAD, #FSIZE, #FLIST

    This way you can create the FLASHER.DAT and FLASHER.CFG on your PC and then store it on the Flasher using the file I/O.

    If your only intention is to switch between files but the files itself will not differ between targets to program, you can use the #SELECT command to switch between files already on the Flasher.

    Another solution to use the Flasher STM8 Software and directly program out of it in command line mode would be to output the messages to a log file and examine this after the command line execution is done. The return value of the Flasher STM8 Software is 0 if everything was successful and unequal 0 if there was an error (in this case you could look into the log file).

    Best regards,
    Oliver Olligs
    Flasher STM8 Product Manager
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • So i need to create the flasher.dat and flasher.cfg file for multiple configuration. At the moment of switching i need to delete the file from the flasher and then upload the new ones using FWRITE? How can i create manually the two file?

    Thank you, Oliver.
  • MATA82 wrote:

    How can i create manually the two file?

    You can either save them using the GUI of the Flasher STM8 Software ("File"->"Save programmer configuration file..."/"Save programmer data file...") or by executing the required commands via command line options as described in the manual. Using command line options you are able to fully automate typically all operations you would do with the GUI.

    MATA82 wrote:

    At the moment of switching i need to delete the file from the flasher and then upload the new ones using FWRITE?

    Exchanging files can be done using #FDELETE to remove an existing file followed by #FWRITE to store the new file.

    Switching means that you create different configurations (create a FLASHER.DAT and FLASHER.CFG and rename both to CONFIG1.*, then repeat for the second setup). You can then store multiple configurations onto the Flasher, either via remote commands or by simply connecting it in MSD mode (hold the button when USB connecting it to your PC. To switch between configurations on the Flasher you would execute the remote commands #SELECT CONFIG1, #SELECT CONFIG2, ..., followed by the regular #AUTO command to start programming.

    Best regards,
    Oliver
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Excuse me again,

    i have noticed a strange behaviour of the auto procedure when using it via serial command or via the Flasher STM8. Using the last one seems to be more time consuming, tha auto procedure take more or less 40 sec. Using the serial command the auto procedure stop after only 19 sec. Did i miss something?
  • Dear MATA82,

    I assume you have enabled Erase Chip in the production settings, is this correct ?

    Either way in standalone mode the Flasher can operate much more efficient as he does not have to wait for instructions from the PC. Especially an erase operation for the whole chip can take way more time as the sectors are erased one by one and the sectors/blocks of STM8 devices are very small (64 or 128 bytes).

    If you do not rely on an empty Flash for your application (expecting 0x00 in the flash which is empty for STM8 devices) you should be safe to disable the erase operation as STM8 does not require erase before programming.

    Best regards,
    Oliver
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • MATA82 wrote:

    Yes erase chip is enable. So you're saying that the serial erasing procedure is much faster?

    Yes, serial (standalone mode) is always faster than PC mode as it eliminates latencies caused by PC interfaces. Delay from Ethernet is typically lower than USB but standalone operation eliminates it completely.

    For programming we are already using an optimized procedure by loading bigger chunks to the Flasher that will then be processed like in standalone mode. For erasing the device we are still doing this using manual commands to erase block by block. This might be moved into the firmware in the future (as more intelligent handling like the programming operation) but is not for the moment.

    Best regards,
    Oliver
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.