NMT Commands
Network Management protocol defines the communication and operational modes of the modules
Network Management (NMT) is a CANopen protocol for sending commands to modules, changing their operational states, and managing overall network behavior. The effect of these commands is to change the mode of the device (or devices collectively on the network). The command table is maintained as a list of #defines in the CanFest code base. Each module in the COSMIIC system maintains its own version of def.h in the application source code for each of the modules at canFest/include/def.h, and not all NMT commands are implemented by every module.
Triggering an NMT Command
Users can control the use of NMT commands through NNP-API on MATLAB and using .nnpscripts. NMT commands must specify the target node, the specific hex code of the command, and relevant parameters.
node: Target node ID (0= broadcast,7= PM,1–15= RM)command: NMT command as a hex string (e.g.,'95') or decimal integerparam1,param2(optional): Additional parameters (0–255)
NMT in NNP-API
The NNP-API MATLAB library provides the nmt function in NNPCORE for sending NMT commands directly to any node on the network.
dataOut = nnp.nmt(node, command)
dataOut = nnp.nmt(node, command, param1)
dataOut = nnp.nmt(node, command, param1, param2)
Examples:
nnp.nmt(7, '95') % Turn network ON (PM)
nnp.nmt(7, '8D', 1) % Run script ID 1 on PM
NMT in .nnpscript
Within a .nnpscript file, use the NMT0, NMT1, or NMT2 opcodes depending on the number of parameters required.
NMT0 <NODE> <CMD>
NMT1 <NODE> <CMD> <PARAM1>
NMT2 <NODE> <CMD> <PARAM1> <PARAM2>
Examples:
NMT0 7 0x95 % Turn network ON (PM)
NMT1 7 0x8D 1 % Run script ID 1 on PM
NMT Command Reference Table
| Command Name↕ | Value↑ | PM | PG4 | BP2 |
|---|---|---|---|---|
NMT_Start_Nodes | 0x01 | ✓ | ✓ | ✓ |
NMT_Stop_Nodes | 0x02 | ✓ | ✓ | ✓ |
NMT_Enter_Patient_Operation | 0x03 | ✓ | ✓ | ✓ |
NMT_Enter_X_Manual | 0x04 | ✓ | ✓ | ✓ |
NMT_Enter_Y_Manual | 0x05 | ✓ | ✓ | ✓ |
NMT_Enter_Stop_Stim | 0x06 | ✓ | ✓ | ✓ |
NMT_Enter_Wait_Mode | 0x07 | ✓ | ✓ | ✓ |
NMT_Enter_Patient_Manual | 0x08 | ✓ | ✓ | ✓ |
NMT_Enter_Produce_X_Manual | 0x09 | ✓ | ✓ | ✓ |
NMT_Do_Save_Cmd | 0x0A | ✓ | ✓ | ✓ |
NMT_Do_Restore_Cmd | 0x0B | ✓ | ✓ | ✓ |
NMT_Enter_Record_X | 0x0C | ✓ | ✓ | ✓ |
NMT_Enter_Charging_Mode | 0x0F | ✓ | — | — |
NMT_Return_Node_Table | 0x10 | ✓ | — | — |
NMT_Return_Single_Node | 0x11 | ✓ | — | — |
NMT_Group_On | 0x20 | — | ✓ | — |
NMT_Group_Off | 0x21 | — | ✓ | — |
NMT_All_Groups_Off | 0x22 | — | ✓ | — |
NMT_Reset_Node | 0x81 | ✓ | ✓ | ✓ |
NMT_Reset_Comunication | 0x82 | ✓ | ✓ | ✓ |
NMT_Enter_Bootloader | 0x83 | ✓ | ✓ | ✓ |
NMT_Start_Sync | 0x84 | ✓ | ✓ | ✓ |
NMT_Stop_Sync | 0x85 | ✓ | ✓ | ✓ |
NMT_Start_PDO | 0x86 | ✓ | ✓ | ✓ |
NMT_Stop_PDO | 0x87 | ✓ | ✓ | ✓ |
NMT_Set_RTC | 0x88 | ✓ | — | — |
NMT_Set_Alarm | 0x89 | ✓ | — | — |
NMT_Reset_Watchdog | 0x8A | ✓ | ✓ | ✓ |
NMT_Radio_WOR_ON | 0x8B | ✓ | — | — |
NMT_Radio_WOR_OFF | 0x8C | ✓ | — | — |
NMT_Run_Script | 0x8D | ✓ | — | — |
NMT_Enable_Script(s) | 0x8E | ✓ | — | — |
NMT_Disable_Script(s) | 0x8F | ✓ | — | — |
NMT_Delete_Script | 0x90 | ✓ | — | — |
NMT_Erase_Serial_Eprom | 0x90 | — | ✓ | ✓ |
NMT_Radio_Address | 0x92 | ✓ | — | — |
NMT_Wake_Remote_Modules | 0x93 | ✓ | — | — |
NMT_Network_On | 0x95 | ✓ | — | — |
NMT_Network_Off | 0x96 | ✓ | — | — |
NMT_Halt_RTC | 0x97 | ✓ | — | — |
NMT_Clear_CAN_Errors | 0x98 | ✓ | ✓ | ✓ |
NMT_Set_Radio_Power | 0x99 | ✓ | — | — |
NMT_Init_NV_Memory | 0x9A | ✓ | — | — |
NMT_Init_CAN | 0x9B | ✓ | — | — |
NMT_Reset_Radio_Counters | 0x9C | ✓ | — | — |
NMT_Reset_OD_Defaults | 0x9D | ✓ | ✓ | ✓ |
NMT_Reset_Module | 0x9E | ✓ | ✓ | ✓ |
NMT_Enter_Low_Power | 0x9F | ✓ | ✓ | ✓ |
NMT_Network_On_Only | 0xA0 | ✓ | — | — |
NMT_Load_Pattern | 0xA5 | — | ✓ | — |
NMT_Read_Pattern | 0xA6 | — | ✓ | — |
NMT_Reset_Global_Vars | 0xA7 | ✓ | — | — |
NMT_Turn_OFF_Alarms | 0xA8 | ✓ | — | — |
NMT_Start_Script_Debug | 0xAB | ✓ | — | — |
NMT_Stop_Script_Debug | 0xAC | ✓ | — | — |
NMT_Single_Step_Debug | 0xAD | ✓ | — | — |
NMT_Stop_Script | 0xAE | ✓ | — | — |
NMT_Run_Script_Once | 0xB3 | ✓ | — | — |
NMT_Set_Script_Delay_Time | 0xB4 | ✓ | — | — |
NMT_Abort_Scripts | 0xB5 | ✓ | — | — |
NMT_Clear_Startup_Script | 0xB6 | ✓ | — | — |
NMT_Clear_Shutdown_Script | 0xB7 | ✓ | — | — |
NMT_Flush_Log_Files | 0xB8 | ✓ | — | — |
NMT_Init_File_System | 0xB9 | ✓ | — | — |
NMT_Enable_Encryption | 0xBA | ✓ | — | — |
NMT_Erase_PM_Blocks | 0xBB | ✓ | — | — |
NMT_BlankCheck_PM_Flash_Mem | 0xBC | ✓ | — | — |
NMT_Set_VSYS | 0xBE | ✓ | — | — |
NMT_Exit_Low_Power | 0xBF | ✓ | — | — |
NMT_Enable_ForceAnodeOn | 0xC0 | — | ✓ | — |
NMT_Disable_ForceAnodeOn | 0xC1 | — | ✓ | — |
NMT_Update_Scheduler | 0xC2 | — | ✓ | — |
NMT_Set_Gains | 0xD0 | — | — | ✓ |
NMT_Set_AntiAliasing_High | 0xD1 | — | — | ✓ |
NMT_Set_AntiAliasing_Low | 0xD2 | — | — | ✓ |
NMT_Set_Analog_Pin_Config | 0xD3 | — | — | ✓ |
NMT_Read_Script_Lengths | 0xE0 | ✓ | — | — |
NMT_Read_Script_Revs | 0xE1 | ✓ | — | — |
NMT_Read_Script_IDs | 0xE2 | ✓ | — | — |
NMT_Read_Script_CRCs | 0xE3 | ✓ | — | — |
NMT_Calculate_Script_CRCs | 0xE4 | ✓ | — | — |
NMT_Read_Memory_Now | 0xE8 | ✓ | — | — |
NMT_Set_nBOOT_HighOut | 0xF0 | ✓ | — | — |
NMT_Set_nBOOT_LowOut | 0xF1 | ✓ | — | — |
NMT_Set_nBOOT_In | 0xF2 | ✓ | — | — |
NMT_Enable_Gyro | 0xF3 | ✓ | — | — |
NMT_Disable_Gyro | 0xF4 | ✓ | — | — |
Coming Soon...
Some NMTs have a System Mode dependency and Target Node dependency. In other words, the NMT may be non-functional under certain system modes or if sent to an incompatible node. We will be adding more detailed information about these dependencies for each command in the future.