Flasher Hub - Remote control

From SEGGER Wiki
Revision as of 16:00, 6 May 2024 by Leon (talk | contribs) (Created page with "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 in...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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.

Contents

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.

Note:
There are situations where the execution of a known command is rejected with #NACK:ERRxxx if the Flasher Hub is currently busy and the received command is not allowed to be sent while the Flasher Hub is busy.

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
Telnet see ASCII interface via Telnet
UART (RS-232) see ASCII interface via RS232
USB (FlasherControl.exe) see FlasherControl

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.

Commands

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

Commands to the Flasher Hub
#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>]...)
#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>]...)
Replies from the Flasher Hub
#ACK
#NACK
#OK
#OK:<num bytes>:<data>
#OK:<data>
#OK:<module>:<data>
#RESULT:<module>:
#DONE
#ERRxxx

Command #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)

Command #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 #Patch file support.

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)

Command #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 #Patch file support.

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)

Command #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

Command #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

Command #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

Command #FFORMAT


This command formats the file system on the specified module(s).

Syntax

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

Example sequence

Command Reply
#FFORMAT 1
#ACK
#RESULT:1:OK
#DONE

Command #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

Command #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

Command #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".

Command #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

Command #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

Command #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

Command #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

Command #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

Command #RESETIPCONFIG


Reset the IP configuration to DHCP.

Syntax

#RESETIPCONFIG

Example sequence

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

Command #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

Command #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

Command #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

Command #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

Command #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

Command #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

Command #SERIALMOD


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

Syntax

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

Example sequence

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

Command #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

Command #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

Command #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

Command #TERMINAL


This command enables/disables the UART transceiver for the given module(s). For more information, please refer to the #UART to TCP transceiver.

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

Command #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 from the Flasher Hub

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:

#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.

#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>

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:<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

#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

For a detailed description of the handshake interface, please refer to the Flasher Manual (UM08022) chapter 'Handshake control'.