Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 9 months ago.
C030 N211 AtCmdParser
Hello,
I use the C030-N211 and tried to communicate with the board with the ATCmdParser. I first tried to read IMSI and IMEI. With the following code:
if(_at->send("AT+CIMI") && _at->recv("%15[^\n]\nOK\n", &pinstr)) { printf("\nIMSI:\n"); printf("%s",pinstr); }
if(_at->send("AT+CGSN=%d",1) && _at->recv("%15[^\n]\nOK\n", &pinstr)) { printf("\nIMEI:\n"); printf("%s",pinstr);
}
But the problem is that it does not work. The command arrives and an answer is also returned, because I played with the Format Specifiers and then it printed "IMSI" and "IMEI" but not the numbers. However, it does not come back to what should come back.
Could somebody help me?
Thanks
Question relating to:
1 Answer
6 years, 9 months ago.
As a first step, if you haven't already done so, it might be worth you importing, compiling and running the example program we provide here:
https://os.mbed.com/teams/ublox/code/example-reading-imei-imsi/
...to see if that works. It should work out of the box with no configuration.
In terms of time IMSI/IMEI reading this program does exactly what you are doing but the issue may lie elsewhere, e.g. with modem initialisation/baud-rate etc. If the example program works then you should look at what it does in setup_modem() for hints. If the example program does not work, let me know and I will investigate the issue on a board here.
Thanks!
I ran the example program but it failed and there came a message "Unable to initialise modem". Do I have to define somewhere that my target is the C030 and not the C027? Can this possibly be due to the firmware version of the module, if so, how can I update it?
I still have a question to initialisation of the UARTSerial. Where and how is MDMTXD and MDMRXD defined?
Thank you!
posted by 14 Feb 2018Yes, you must build for the UBLOX_C030_N211 target as the power-up procedures are different for each target. Since the N211 target is not in production the button to add it to your on-line IDE will not be available however I believe that you can add it by looking in the drive that Windows presents when the board is plugged into your PC and opening the link in the .htm file in a browser.
posted by 14 Feb 2018I can add the C030-N211 to my online IDE. But I mean, if I have to define the target somewhere else in the code, since the examples are maybe designed for the C030 and the C027 ?
posted by 14 Feb 2018No, you don't have to define the target type anywhere else, code that needs to know it will pick it up from the global definition. The example-reading-imei-imsi build I pointed you at, which doesn't use our standard modem drivers in order to keep things simple, is only written to work on the UBLOX_SARA_U201 target (though it doesn't say that). I will update it to work with the UBLOX_SARA_N211 target but, in the mean time, the way to check what the modem is returning is to switch debug on in the AT command parser. Wherever you instantiate the AtCmdParser, you need to change the fifth parameter to "true" (add it if it is not there). You will then be able to see the detail of the AT conversation that is going on. Can you try that and post the bit after you send "AT+CGSN" here?
posted by 15 Feb 2018I've just synced up with the engineer who knows the AT commands for the N211 module inside-out and it looks as though the documentation for the AT+CGSN command for this module is incorrect. The expected sequence for this module is:
AT+CGSN=1
OK
+CGSN:15-digit-number
OK
I have confirmed that this is correct on a board here and will shortly push an updated version of example-reading-imei-imsi that supports the UBLOX_SARA_N211 target as well as the UBLOX_SARA_U201 target.
posted by 15 Feb 2018I think you have to update ublox-cellular-base too, because there the command + cgsn is still outdated and therefore possibly more.
posted by 16 Feb 2018S'OK, the ublox-cellular-base library is not used with N211, there’s s a ublox-cellular-base-n2xx for this purpose.
posted by 16 Feb 2018Oh, yes, you are right. I first took the example out of the box demo for the C030 and tested on it further functionalities, but in this case also this example is not designed for the N211. This is a bit unclear when using this example.
posted by 16 Feb 2018
One quick question: do you really mean to use &pinstr in the call to _at->recv("%15[^\n]\nOK\n", &pinstr) above? It looks like pinstr is an array, so you want _at->recv("%15[^\n]\nOK\n", pinstr).
posted by Rob Meades 14 Feb 2018Oh, yes you are right, but if I remove "&" it still doesn't work.
posted by -- -- 14 Feb 2018What I also noticed right now:
In the latest at-command-manual the value of IMSI is specified as number. In the old manual, however, the IMSI is specified as a string. Does this make a difference when I use the command at->recv ? Or ist everything interpreted as a string?
posted by -- -- 14 Feb 2018In terms of the AT command interface everything is a string.
posted by Rob Meades 14 Feb 2018