Flasher Hub - Remote control

From SEGGER Knowledge Base
Jump to navigation Jump to search

The integrated ASCII terminal interface is the primary way to remotely control the Flasher Hub operation. Alternatively, the Flasher Hub can be controlled via the handshake interface.

ASCII terminal interface

The Flasher Hub can be driven by any application or just a simple terminal using ASCII commands.

Every known command is acknowledged by the Flasher Hub and then executed. After command execution, the Flasher Hub sends an ASCII reply message.

Setting up an ASCII terminal connection

The Flasher Hub supports multiple interfaces to connect to the Flasher Hub and access its ASCII terminal. The following table lists all supported interfaces and also links to a description explaining how to use the interface.

Interface Usage
Web see ASCII interface via Web server
Telnet see ASCII interface via Telnet
UART (RS-232) see ASCII interface via RS232
VCOM see ASCII interface via VCOM
USB (FlasherControl.exe) see FlasherControl


Note:
The terminal can be operated fully offline. See Offline operation for more information.

General command and reply message format

  • Each ASCII command has to start with the start delimiter #.
  • Each ASCII command has to end with simple carriage return ('\r', ASCII code 13).
  • Commands can be sent upper or lower case.

General usage

Reply messages must be considered in each case. In general, a new command must not be sent before a reply for the last one has been received. At least the "#ACK" message needs to be received by the controlling application before sending a new command for a flash module not yet executing a command.

For the Flasher Hub, all commands triggering a flash programming function (#AUTO, #CANCEL, #ERASE, #PROGRAM, #VERIFY) may be used for other modules, before the current operation has been finished. Please note that in this case the overall finish indicator "#DONE" will be sent when all commands have been executed.

When a flash programming function has finished, the debug logic of the MCU is disabled (powered down) and the target interface of the module is switched off (tri-stated).

Some commands, e.g. #AUTO require the modules to be specified.

#AUTO all|*|(<module>[,<module>]...)
  • all will execute the command using all modules which can be detected.
  • * will execute the command using all modules selected by the latest executed selmodule command.
  • Alternatively, the modules can be specified in a comma separated list.

Examples

The following Python script demonstrates how to communicate with the Flasher Hub ASCII interface using Telnet:
Download example Python script

Commands

The table below provides an overview about the commands which are supported by the current version of the Flasher Hub firmware.

Commands
#AUTO all|*|(<module>[,<module>]...)
#AUTO NOPATCH all|*|(<module>[,<module>]...)
#AUTO PATCH all|*|(<module>[,<module>]...) <number of patches>,<address>,<number of patched bytes>:<data bytes>
#BAUDRATE <baudrate>
#CANCEL all|*|(<module>[,<module>]...)
#ERASE all|*|(<module>[,<module>]...)
#FFORMAT all|*|(<module>[,<module>]...)
#FWVERSION
#FWVERSIONMOD all|*|(<module>[,<module>]...)
#IPCONFIG
#POWERON all|*|(<module>[,<module>]...), <power source>,<discharge mode>
#POWEROFF all|*|(<module>[,<module>]...)
#PROGRAM all|*|(<module>[,<module>]...)
#PROJECT all|*|(<module>[,<module>]...)
#PROTVER
#RESETIPCONFIG
#RESULT all|*|(<module>[,<module>]...)
#RTTOFF all|*|(<module>[,<module>]...)
#RTTON all|*|(<module>[,<module>]...) <RTT channel>,<RTT control block addr>,<number down buffers>,<number up buffers>
#SELECT all|*|(<module>[,<module>]...) <project>
#SELMODULE all|(<module>[,<module>]...)
#SERIAL
#SERIALMOD all|*|(<module>[,<module>]...)
#VTREF all|*|(<module>[,<module>]...)
#SETVTREF all|*|(<module>[,<module>]...) <voltage>
#START all|*|(<module>[,<module>]...)
#STATUS
#TERMINAL all|*|(<module>[,<module>]...) off|(<baudrate>,<data bits>,<parity>,<stop bits>)
#VERIFY all|*|(<module>[,<module>]...)

#AUTO


The #AUTO command behaves exactly like pushing the programming button on a connected Flasher Compact.

Usually, the following command sequence will be performed when receiving the #AUTO command:

The selected modules...

  • erase the targets (if not blank)
  • program the targets
  • verify the targets

Depending on the tasks chosen in J-Flash or U-Flash, this sequence can differ from the one shown above.

Syntax

#AUTO all|*|(<module>[,<module>]...)

Results

Result Meaning
#OK Programming done successfully.
#ERRxxx Error occurred during operation. xxx represents the error code, which may be followed by an additional error text.

Example sequence

Command Reply
#AUTO 1
#ACK
#RESULT:1:OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

#AUTO NOPATCH


The #AUTO NOPATCH command allows to ignore an existing patch file for the programming.

This command exists because the default behavior of the #auto command is such that an existing patch file (patch.txt in the module folder) is applied to a data if the #auto command is executed.

For further information about the usage of the #AUTO PATCH command, please refer to Flasher Hub - Patch data.

Syntax

#AUTO NOPATCH all|*|(<module>[,<module>]...)

Results

Result Meaning
#OK No error occurred.
#ERRxxx Error occurred during operation. xxx represents the error code, which may be followed by an additional error text.

Example sequence

Command Reply
#AUTO NOPATCH 1
#ACK
#RESULT:1:OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

#AUTO PATCH


The #AUTO PATCH command allows patching of the content of the data to be programmed.

For further information about the usage of the #AUTO PATCH command please refer to Flasher Hub - Patch data.

Syntax

#AUTO PATCH all|*|(<module>[,<module>]...) <number of patches>,<address>,<number of patched bytes>:

Results

Result Meaning
#OK No error occurred.
#ERRxxx Error occurred during operation. xxx represents the error code, which may be followed by an additional error text.

Example sequence

Command Reply
#AUTO PATCH 1 1,0,8:0011223344556677
#ACK
#RESULT:1:OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

#BAUDRATE


This command can be sent in order to change the baud rate of the RS-232 interface used by the ASCII terminal.

Syntax

#BAUDRATE <baudrate>

Results

Result Meaning
#OK No error occurred.
#ERR255: Invalid parameters The baud rate parameter is invalid, e.g. contains characters that cannot be parsed.
#ERR255: Invalid parameters The selected baud rate is not supported.

Example sequence

Command Reply
#BAUDRATE 115200
#ACK
#OK

#CANCEL


This command can be sent to abort a running operation. It may take a while until the current operation is actually canceled.

Syntax

#CANCEL all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#AUTO 1
#ACK
#CANCEL 1
#ACK
#RESULT:1:ERR255:Error while flashing

#ERASE


This command can be sent to erase all selected target flash sectors.

Syntax

#ERASE all|*|(<module>[,<module>]...)

Results

Result Meaning
#OK Erase done successfully.
#ERRxxx: TEXT Error message with text.

Example sequence

Command Reply
#ERASE 1
#ACK
#RESULT:1:OK (Total 0.362s, Erase 0.252s)
#DONE

#FCLOSE

This command closes the file which was opened via #FOPEN. After this command has been issued further file I/O operations except #FDELETE are not allowed until the #FOPEN command is sent again.

Syntax

#FCLOSE

Example sequence

Command Reply
#FCLOSE
#ACK
#OK

#FCRC

This command calculates a 32-bit CRC of the given file. This CRC can be used to verify file integrity. This command should not be used while a file has been opened via #FOPEN.
The method for calculating the CRC is the same as for J-Flash when opening, downloading or saving data files in J-Flash.
For more information on CRC calculation in J-Flash, refer to CRC calculation.

Special handling:
When providing a path to a file under the pseudo folder "All modules", the CRC for that file will be calculated and returned for each connected module.

Syntax

#FCRC Path\To\File

Example sequence

Command Reply
#FCRC MODULE.001\FLASHER.DAT
#ACK
#OK:0x3F27C398
#DONE
#FCRC All modules\FLASHER.DAT
#ACK
#OK:1:0x3F27C398
#OK:2:0x9F961680
#OK:3:0x9F961680
#OK:4:0x7E15546A
#DONE

#FDELETE

This command deletes a file.

Syntax

#FDELETE Path\To\File

Example sequence

Command Reply
#FDELETE MODULE.001\FLASHER.DAT
#ACK
#OK

#FFORMAT

This command deletes all files located in Flasher Hub's internal memory.


Note:
  1. This command does not affect files located on connected modules.
  2. This command removes Flasher Hub's configuration file, resetting it to factory defaults.

Syntax

#FFORMAT

Example sequence

Command Reply
#FFORMAT
#ACK
#DONE

#FLIST

This command lists all files and folders on Flasher Hub as well as on connected modules.

Syntax

#FLIST

Example sequence

Command Reply
#FLIST
MODULE.001 (DIR)
MODULE.002 (DIR)
MODULE.003 (DIR)
All modules (DIR)
Logs (DIR)
Config.ini Size: 316
#OK

#FOPEN

This command opens a file for further file I/O operations. Filename specifies the file to be opened. If Filename can not be found, the file will be created.

Syntax

#FOPEN Filename

Example sequence

Command Reply
#FOPEN MODULE.001\FLASHER.LOG
#ACK
#OK

#FREAD

This command reads data from a file. Offset specifies the offset in the file, at which data read starts. NumBytes specifies the number of bytes to read.

Syntax

#FREAD Offset NumBytes

Example sequence

Command Reply
#FREAD 0,10
#ACK
#OK:10:000102030405060708090A0B0C0D0E0F

#FSIZE

This command gets the size of the currently opened file on Flasher.

Syntax

#FSIZE

Example sequence

Command Reply
#FSIZE
#ACK
#OK:800

#FWRITE

This command writes to a file on Flasher. Offset specifies the offset in the file, at which writing is started. NumBytes specifies the number of bytes which are sent with this command and which are written into the file. NumBytes is limited to 512 bytes at once. This means, in order to write e.g. 1024 bytes, the #FWRITE command must be sent twice, using an appropriate offset when sending it the second time.

Syntax

#FWRITE Offset,NumBytes:Data

Example sequence

Command Reply
#FWRITE 0,A:0102030405060708090A
#ACK
#OK

#MKDIR

This command creates a directory. Dirname specifies the name of the new directory. Dirname may also specify a path to create a subdirectory.

Syntax

#MKDIR Dirname

Example sequence

Command Reply
#MKDIR MODULE.001\NewProject
#ACK
#OK

#FWVERSION


This command returns the firmware version of the Flasher Hub.

Syntax

#FWVERSION

Example sequence

Command Reply
#FWVERSION
#ACK
#OK:Flasher Hub-12 V1 compiled Sep 20 2023 15:55:39
#DONE

#FWVERSIONMOD


This command returns the firmware version of one or more modules connected to the Flasher Hub.

Syntax

#FWVERSIONMOD all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#FWVERSIONMOD 1,2,3
#ACK
#OK:1:J-Link / Flasher Compact V5 compiled Mar 17 2021 11:50:31
#OK:2:J-Link / Flasher Compact V5 compiled Mar 17 2021 11:50:31
#OK:3:J-Link / Flasher Compact V5 compiled Mar 17 2021 11:50:31
#DONE

#IPCONFIG


This command returns the current IP configuration.

Syntax

#IPCONFIG

Example sequence

Command Reply
#IPCONFIG
#ACK
#RESULT:IP address:192.168.1.111
#RESULT:subnet mask:255.255.0.0
#RESULT:Gateway:192.168.1.1
#RESULT:IP mode:Automatically assigned (DHCP)
#DONE

IP mode can be "Automatically assigned (DHCP)" or "User assigned".

#POWERON


This command can be used to turn ON the target power (5V on pin 19 of the attached Flasher Compacts) without any erase, program or verify action.

Syntax

#POWERON all|*|(<module>[,<module>]...), <power source>,<discharge mode>

Parameters

Parameter Meaning
power source 0 = internal power
discharge mode 0 = no discharge

Example sequence

Command Reply
#POWERON 1,2,3 0,0
#ACK

#POWEROFF


This command can be used to turn OFF the target power (5V on pin 19 of the attached Flasher Compacts) without any erase, program or verify action.

Syntax

#POWEROFF all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#POWEROFF 1,2,3
#ACK

#PROGRAM


This command can be used instead of #AUTO to program a target without erasing the target before programming and without performing a final verification.

Syntax

#PROGRAM all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#PROGRAM 1
#ACK
#RESULT:1:OK (Total 9.963s, Prog 9.183s)
#DONE

#PROJECT


Returns the selected projects from the specified module numbers.

Syntax

#PROJECT all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#PROJECT 1,2
#ACK
#RESULT:1:OK:FLASHER.UNI
#RESULT:2:OK:PROJECT.CFG
#DONE

#PROTVER


This command can be used to check the version of the ASCII command protocol in use.

Syntax

#PROTVER

Example sequence

Command Reply
#PROTVER
#ACK
#OK:2.02b
#DONE

#RESETIPCONFIG


Reset the IP configuration to DHCP.

Syntax

#RESETIPCONFIG

Example sequence

Command Reply
#RESETIPCONFIG
#ACK
#RESULT:IP configuration was reset successfully.
#DONE

#RESTART


Restarts the Flasher Hub firmware.

Syntax

#RESTART

Example sequence

Command Reply
#RESTART
#ACK
#OK:Restarting Flasher Hub-4 now...

#RESULT


This command can be sent any time, even during other command execution. The Flasher Hub responds with the result of the previously executed command.

Syntax

#RESULT all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#RESULT 1,2,3
#ACK
#RESULT:1:OK ((Total 2.216s, Erase 0.126s, Prog 1.231s, Verify 0.144s)
#RESULT:2:OK ((Total 2.216s, Erase 0.126s, Prog 1.231s, Verify 0.144s)
#RESULT:3:OK ((Total 2.216s, Erase 0.126s, Prog 1.231s, Verify 0.144s)
#DONE


#RMDIR

This command removes a directory and all of its contents.


Note:
Deleting the special folder 'All modules' removes all files and folders from all connected modules.

Syntax

#RMDIR Dirname

Example sequence

Command Reply
#RMDIR MODULE.001\MyDir
#ACK
#OK

#RTTOFF


This command turns off the RTT connection for the given module(s).

Syntax

#RTTOFF all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#RTTOFF 1,2,3
#ACK
#DONE

#RTTON


This command turns on the RTT connection for the given module(s).

Syntax

#RTTON all|*|(<module>[,<module>]...) <RTT channel>,<RTT control block addr>,<number down buffers>,<number up buffers>

Example sequence

Command Reply
#RTTON 1,2,3 0,0x20001000,3,3
#ACK
#DONE

#SELECT


The #SELECT command is used to select a specific configuration and data file pair to be used by the connected Flasher Compact modules to program the target.

Syntax

#SELECT all|*|(<module>[,<module>]...) <project>

Parameters

Parameter Meaning
project The [Project Name] specifies the name of file pair without extensions (.CFG and .DAT) on the Flasher Compact modules to be selected. The Flasher Compacts save the selected configuration and data file in the FLASHER.INI file. Therefore, this selection is remembered even after power-cycling the Flasher Compacts.

Example sequence

Command Reply
#SELECT 1,2,3 emPower
#ACK
#RESULT:1:OK
#RESULT:2:OK
#RESULT:3:OK
#DONE

#SELMODULE


This command is used to select one or more modules in a Flasher Hub system. Following commands using an asterisk to specify the modules will use the modules selected by this command.

Syntax

#SELMODULE all|(<module>[,<module>]...)

Example sequence

Command Reply
#SELMODULE 1,2,3
#ACK
#SELECTED:1,2,3

#SERIAL


The #SERIAL command is used to query the serial number of the Flasher Hub.

Syntax

#SERIAL

Example sequence

Command Reply
#serial
#ACK
#RESULT:1021000001
#DONE

#SERIALMOD


The #SERIALMOD command is used query the serial numbers of the connected Flasher Compact modules.

Note:
With Flasher ATE2, this command will return the serial number of the Flasher ATE2 combined with each module number indicated in the last digit.

Syntax

#SERIALMOD all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#serialmod 1,2,3
#ACK
#OK:1:1015000015
#OK:2:1015000016
#OK:3:1015000017
#DONE

#VTREF


This command can be used to read the reference voltage (VTref, pin 1) of the target interface.

Syntax

#VTREF all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#VTREF 1,2,3,4
#ACK
#OK:1:3303
#OK:2:0
#OK:3:1800 (Fixed)
#OK:4:3300 (Fixed)
#DONE


#SETVTREF


This command can be used to set a fixed voltage for I/O pins of the target interface.

Syntax

#SETVTREF all|*|(<module>[,<module>]...) <voltage>

Parameters

Parameter Meaning
voltage The IO voltage level for the target interface in mV.

Example sequence

Command Reply
#SETVTREF 1,2,3 3300
#ACK
#DONE

#START


This command can be sent to start the application using the method configured in the J-Flash project.

Syntax

#START all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#START 1,2,3
#ACK
#RESULT:1:OK (Total 0.083s)
#RESULT:2:OK (Total 0.082s)
#RESULT:3:OK (Total 0.084s)
#DONE

#STATUS


This command can be sent any time, even during other command execution. The Flasher Hub responds with its current state. All defined state messages are described under #Replies from the Flasher Hub.

Syntax

#STATUS

Example sequence

Command Reply
#STATUS
#ACK
#STATUS:READY

#TERMINAL


This command enables/disables the UART port (formerly "UART Transceiver") for the given module(s). For more information, please refer to the Flasher Hub - UART Port.

Syntax

#TERMINAL all|*|(<module>[,<module>]...) off|(<baudrate>,<data bits>,<parity>,<stop bits>)

Example sequence

Command Reply
#TERMINAL 1,2,3 9600,8,N,1
#ACK
#DONE

Example sequence

Command Reply
#TERMINAL 1,2,3 off
#ACK
#DONE

#VERIFY


This command can be used to verify the target flash content against the data stored in the Flasher Compact module.

Syntax

#VERIFY all|*|(<module>[,<module>]...)

Example sequence

Command Reply
#VERIFY 1,2,3
#ACK
#RESULT:1:OK (Total 0.206s, Verify 0.129s)
#RESULT:2:OK (Total 0.210s, Verify 0.131s)
#RESULT:3:OK (Total 0.207s, Verify 0.128s)
#DONE

Replies

The reply messages from the Flasher Hub follow the same data format as commands. Any reply message starts with ASCII start delimiter #, ends with simple carriage return (ASCII code 13), and is sent in uppercase. In contrast to commands, replies can be followed by a descriptive message, which provides more detailed information about the reply. This description is sent in mixed case. The #OK reply, for example, is such a reply. It is followed by a string containing information about the performance time needed for the operations:

#OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

The following reply messages from the Flasher Hub are defined:

Replies
#ACK
#NACK
#OK
#RESULT
#DONE
#ERR

#ACK

The Flasher Hub replies with the #ACK message on reception of any defined command before the command itself is executed.

#NACK

The Flasher Hub replies with #NACK, if an undefined command was received.
There are situations where the execution of a known command is rejected with #NACK:ERRxxx if Flasher Hub is currently busy and the received command cannot be processed while Flasher Hub is busy.

#OK

#OK:<module>:<data>

The Flasher Hub replies with #OK, if a command other than #STATUS or #RESULT was executed and ended without any error. #OK may be followed by a module number and/or data.

#STATUS

#STATUS:<status> 

The Flasher Hub replies with its current state.

The following status messages are currently defined:

Message Description
#STATUS:READY Flasher Hub is ready to receive a new command.
#STATUS:BUSY Flasher Hub is currently executing a previously received command.

#RESULT

#RESULT:<module>:<data>

The Flasher Hub reports the result of an operation on a specific module. If the operation has been completed successfully, it will report the outcome with a single message of this type followed by the last result of the operation.

#DONE

This message is being sent once all operations are finished and all connected Flasher Compact modules are back in idle state.

A typical sequence for using the Flasher Hub is shown below:

Flasher Hub-12 telnet-shell telnet-shell.
Flasher Hub-12 V1.01a compiled May 17 2021 10:19:45
#SELMODULE 1,2
#ACK
#SELECTED:1,2
#AUTO *
#ACK
#RESULT:1:#ERR255:Error while flashing
#RESULT:2:#OK (Total 2.653s, Erase 0.327s, Prog 1.960s, Verify 0.234s)
#DONE

#ERR

#ERRxxx <data>

If any command other than #STATUS or #RESULT was terminated with an error, the Flasher Hub cancels the command and replies with an error message instead of the #OK message.

Some error codes may be followed by a colon and an additional error text.

For example:

#ERR007:CANCELED.

The error code numbers are described in the following table:

Message Description
#ERR007 Flasher Hub received a #CANCEL command and has canceled the current operation.
#ERR008 Flasher Hub is already busy with execution of previous command.
#ERR009 Failed to allocate memory.
#ERR010 Failed to open file.
#ERR011 Failed to read file.
#ERR012 Failed to write file.
#ERR013 Failed to delete file.
#ERR098 Failed to delete file.
#ERR098 Could not allocate memory for device specific algorithm.
#ERR099 Device specific algorithm is not yet supported by this firmware version. Please check for a firmware update.
#ERR101 Could not find device programming algorithm.
#ERR102 Could not open the data file.
#ERR255 Undefined error occurred. This reply is followed by an error string.

Handshake interface

Flasher Hub's handshake interface works similar to that of Flasher. For a detailed description of Flasher's handshake interface, please refer to Flasher Manual - Remote control.
Flasher Hub's SUBD9 male connector, normally used as an RS232 interface, also serves as handshake interface.
The following diagrams show the internal remote control circuitry of Flasher Hub:
FlasherHubRemotecontrol.png

Note:
Flasher ATE2's RS232 interface is available via its ATE connector (20-pin). For more information on the pin mapping, see: Flasher ATE2's overview page.


Pin No. Function Description
1 START A positive pulse of any voltage between 5 and 30V with duration of min. 30 ms starts "Auto" function (Clear / Program / Verify) on falling edge of pulse. The behavior of the "Auto" function depends on the J-Flash or U-Flash project settings.
4 BUSY Open-drain output: As soon as the "Auto" function is started, BUSY becomes active, which means that transistor is switched OFF.
It is recommended to connect an external high-impedance pull-up (e.g. 5K) to measure the state.
5 GND Common Signal ground.
7 OK Open-drain output: This output reflects result of last action. It is valid after BUSY turned back to passive state. The output transistor is switched ON (OK is pulled to GND) to reflect OK state.
It is recommended to connect an external high-impedance pull-up (e.g. 5K) to measure the state.

FlasherRemoteSignal.png

Note:
  1. Signaling START to Flasher Hub will trigger production programming (#AUTO) on all connected modules
  2. Signaling START to Flasher Hub while it is BUSY will not have any effect. The request will be ignored.
  3. Flasher Hub will signal BUSY while one or more modules are busy with a target operation (i.e. #AUTO, #ERASE, ...).
  4. Flasher Hub will signal OK only if the last result for all connected modules is "OK". If programming failed for one or more modules, Flasher Hub will signal NOT OK.