AT+M2M=4,xx starts the user M2M application having the RUN permission set, if xx seconds are expired. If the user types an AT command before the expiration of the xx seconds, the control does not executes the M2M application. The RUN permission is set by means of the AT#M2MRUN command.
For example, assume that the module has the factory-setting configuration +M2M=0,10,0, and no user M2M application installed on it. Power on the module and upload the user M2M application into /MOD directory (drive 0). For details, refer to chapter Error! Reference source not found..
AT#M2MWRITE=”user_m2mapz.bin”,61684,1
>>>
OK
Change the directory:
AT#M2MCHDIR=”MOD”
OK
Check the current directory:
AT#M2MCHDIR?
#M2MCHDIR: “/MOD”
OK
Verify, after the uploading, the list of files stored in the current directory (/MOD).
AT#M2MLIST
#M2MLIST: <.>
#M2MLIST: <..>
#M2MLIST: "user_m2mapz.bin",61684 à the user M2M application
#M2MLIST: free bytes: 6097920
OK
Use the following command to set the RUN permission for user_m2mapz.bin application and reset RUN permission for all other application included the default M2M application. The next command works on the executable binary files and compressed files stored in the /MOD directory.
AT#M2MRUN=2,"user_m2mapz.bin"
OK
Enter the next command to check which M2M application has RUN permission.
AT#M2MRUN?
#M2MRUN: “user_m2mapz.bin" à user M2M application has RUN permission
OK
Check the current +M2M value defining the application start mode on next reboot.
AT+M2M?
+M2M: 0,10,0 à the execution of any application is disabled on next reboot (default)
OK
Use the AT+M2M command with two parameters: the first one (4) sets the start mode, the second one (30, as example) defines a time interval expressed in sec.
AT+M2M=4,30
OK
After entering this command, the module reboots, and the following two choices are available:
1. If the operator enters an AT command (different from AT<CR>), before the expiration of the time interval, the control does not start the user M2M application, the user may enter AT commands. Enter the next command to verify the +M2M values:
AT+M2M?
+M2M: 4,30 à the +M2M values are memorized in NVM
OK
After entering again the AT+M2M=4,30 command the module reboots, and again the two choices are available.
2. If the time interval expires and the operator has not entered AT commands, the control starts the user M2M application. If no user application has RUN permission, the default application is executed.
If the module is powered OFF/ON, it uses the AT+M2M=4,30 configuration memorized in NVM and one of the scenarios above described may be used again.