AT+M2M=1 starts the user M2M application having the RUN permission set through AT#M2MRUN command. If no user M2M application has set the RUN permission, AT+M2M=1 command starts the default M2M application.
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 check the current drive:
AT#M2MCHDRIVE?
#M2MCHDRIVE: 0 à the module provides only drive 0
OK
Check the current directory:
AT#M2MCHDIR?
#M2MCHDIR: “/” à factory setting
OK
Enter the following command to verify the free space of file systems:
AT#M2MLIST
#M2MLIST: <MOD>
#M2MLIST: “m2m_config”,134
#M2MLIST: free bytes: 6160384 à free bytes
OK
|
The size of the file system depends on the module type under test. |
Now, assume that the user has created a M2M application as show in the previous chapters, and renamed the m2mapz.bin file in user_m2mapz.bin.
Here are the steps to upload the user M2M application into the module.
Before uploading the file into the file system of the module, you need to know the size of the file expressed in bytes. Use the Properties dialog box to get this information. The figure on the left side shows 61684 bytes, use this value with the AT#M2MWRITE command. Telit provides a tool to upload the and run user M2M application. See 8Run Applications on the Module for more information.
Enter the command below. After the command has responded with the “>>>”prompt, you are allowed to send the M2M application using the Send File option provided by the Terminal tool (use RAW ASCII protocol). On success, the module returns the OK message.
AT#M2MWRITE=”user_m2mapz.bin”,61684,1
>>>
OK
|
If a file is already present in the module with the same name of the file just uploaded, the new one without notification overwrites the old one. The new uploaded file assumes the run permission of the old one. |
If the third parameter is equal to 1, the AT#M2MWRITE command uploads automatically the .bin file into drive 0 and directory /MOD. To verify it enter the following commands.
Change the directory:
AT#M2MCHDIR=”MOD”
OK
Check the current directory:
AT#M2MCHDIR?
#M2MCHDIR: “/MOD”
OK
Check if the uploaded .bin file has been stored in the /MOD directory.
AT#M2MLIST
#M2MLIST: <.>
#M2MLIST: <..>
#M2MLIST: "user_m2mapz.bin",61684
#M2MLIST: free bytes: 6097920
OK
Enter the next command to check which M2M application has RUN permission. The command works on executable binary files and compressed files stored in the /MOD directory (drive 0).
AT#M2MRUN?
OK à no user applications have RUN permission
Check the current +M2M value defining the application start mode on next reboot.
AT+M2M?
+M2M: 0,10,0 à M2M application execution on next reboot is disabled (default)
OK
Enter the next command to reboot the module.
AT+M2M=1
OK
After rebooting, the module starts the default M2M application because the just uploaded user application has not RUN permission. The default M2M application displays on DTE the following message:
Telit Communications S.p.A - AppZone M2M Default Application...
OK
The AT parser can still receive AT commands from the operator on the serial line. Check the current +M2M value stored in NVM after the previous rebooting.
AT+M2M?
+M2M: 1,10,0 à M2M application execution on next reboot is disabled (default)
OK
Use the following command to set the RUN permission for the user_m2mapz.bin application, and reset RUN permission for all other applications included the default M2M application. The command below works on the executable binary files and compressed files stored in the /MOD directory of drive 0.
AT#M2MRUN=2,"user_m2mapz.bin"
OK
Enter again the AT#M2MRUN? command to check which M2M application has RUN permission.
AT#M2MRUN?
#M2MRUN: “user_m2mapz.bin" àuser application has RUN permission
OK
Enter the next command to reboot the module.
AT+M2M=1
OK
After rebooting, the module starts the user M2M application enabled via the previous AT#M2MRUN command. For example, the user M2M application displays on DTE the following message:
Hello World
The AppZone layer has executed the user application. The AT parser cannot receive AT commands from the operator because the user application has permanently captured the serial line. If the module is turned off/on, the user application runs again; to exit from this scenario the module must be re-flashed.