6 days, 11 hours ago.

C030 N211 AtCmdParser


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?


Question relating to:

Development team for u-blox positioning and wireless products

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 2018

Oh, yes you are right, but if I remove "&" it still doesn't work.

posted by Daniel Peters 14 Feb 2018

What 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 Daniel Peters 14 Feb 2018

In terms of the AT command interface everything is a string.

posted by Rob Meades 14 Feb 2018
Comment on this question

1 Answer

6 days, 9 hours 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: 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.


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 Daniel Peters 14 Feb 2018

Yes, 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 Rob Meades 14 Feb 2018

I 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 Daniel Peters 14 Feb 2018

Please let me know, when you tested this issue on a board.

posted by Daniel Peters 14 Feb 2018

No, 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 Rob Meades 15 Feb 2018

I'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:





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 Rob Meades 15 Feb 2018


posted by Daniel Peters 15 Feb 2018

I think you have to update ublox-cellular-base too, because there the command + cgsn is still outdated and therefore possibly more.

posted by Daniel Peters 16 Feb 2018

S'OK, the ublox-cellular-base library is not used with N211, there’s s a ublox-cellular-base-n2xx for this purpose.

posted by Rob Meades 16 Feb 2018

Oh, 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 Daniel Peters 16 Feb 2018

Thanks for pointing that out, I'll get it fixed.

posted by Rob Meades 19 Feb 2018

So the out of the box demo works, but it includes the ublox-cellular-base and not the ublox-cellular-base-n211 lib. If you then, like me, test on this example further functionalities for the N211, then it does not work.

posted by Daniel Peters 19 Feb 2018

Yes, understood, we will fix.

posted by Rob Meades 19 Feb 2018

To post an answer, please log in.