NMT telegram

Hello,

Another question
How can i write an NMT telegram from TIA portal?
AS slave SDO’s are read only in Pre-Operational, and on startup it switches to Operational automatically.
Can any one please give an example how to do that?

are writable in Pre-Operational
*edit

CM CANopen: NMT telegrams

must be differentiated between

a) CM CANopen is running as a CANopen Slave

CM CANopen is only allowed to send the NMT command: set all nodes to operational
condition:
1. there must not be a CANopen master connected to the CANopen network
2. CM CANopen must be configured as a self-starting device
=> configuration of 1F80h,subindex 0: 0x0000000A

b) CM CANopen is running as CANopen Manager

note: set a device to operational
=> a slave device can be only set to operational
1. when it is configured as slave
=> CM CANopen Configuration Studio
Bit 0 of its NMT Slave must be set
2. when it has must be set been booted successfully
=> see chapter 8.1.4 Get Node & Network Status of the manual of the CM CANopen

hint: CM CANopen Configuration Studio: Network Management Configuration
a) NMT Startup
Bit 2 should not be set
=> CM CANopen will automatically set itself to operational at the end of the network initialization
Bit 3 should not be set
=> CM CANopen will automatically set successfully booted slaves to operational
b) Slave Assignment
Bit 0 must be set
=> otherwise a present device is managed as a failure
Bit 2 should be set
=> otherwise a failed boot slave process will not be repeated automatically

NMT telegrams are requested by SDO write command:
addressed device:
CANopen node id of the CM CANopen

index: 1F82h (Request NMT)
subindex: value range: 1 … 127 decimal
CANopen node id of the device that shall execute the requested NMT command
value: 128 decimal
all nodes including the CM CANopen

data of index 1F82h, subindex 1 … 128
data size: 1 Byte

values:
04h: enter Stop
05h: enter Operational
06h: execute Reset node
07h: execute Reset communication
7Fh: enter Pre-Operational

Example:
CM CANopen uses the CANopen node id 127
slave device with CANopen node id 1 shall be set to operational

Note:
WriteSDO FB is different form the description in the manual: it is based on a revised library (I have attached the revised library)

// initialize data to be sent
// 16#1F82, subindex x:
// => byte size: 1 byte
// => value:
// 04h: enter Stop
// 05h: enter Operational
// 06h: execute Reset node
// 07h: execute Reset communication
// 7Fh: enter Pre-Operational
//
// note: DATA
// data type: “SDO_WriteData”
// “SDO_WriteData”: Array[1…x] of Byte x: can be set by the customer
//
// example
// “DB_SDOWrite_Data”.Data: DB that holds the data to be written
// data type: “SDO_WriteData”
//
// note: data format of the value <=> little endian <=> LSB first MSB last
// LSB of the value: “DB_SDOWrite_Data”.Data.SDO_WriteData[1]
//
“DB_SDOWrite_Data”.Data.SDO_WriteData[1] := 5; // example: set operational

“WriteSDO_DB”(REQ:=TRUE,
ID:=“Local~CM_CANopen_1”, // hardware identifier of the acessed CM CANopen in TIA Portal
SLOT:=16#0, // used SDO channel of the CM CANopen
NODE:=127, // CANopen node id of the CM CANopen: here 127
INDEX:=16#1F82,
SUB:=16#1, // CANopen node id of the device that shall execute the NMT command: example: 1
DATA:=“DB_SDOWrite_Data”.Data,
DATASIZE:=1, // byte size of 1F82h, subindex x: 1 byte
BUSY=>#fBusy,
RET=>#uiRet);

IF #fBusy = TRUE THEN
// command is running
;
ELSE
// command has been processed
// #uiRet informs about the result
;
END_IF;

@kyle_HMS Just have tried this, it works without issues, thank you very much. That helped a lot.

Great! Thanks for the update!