Solution MKR NB 1500 - AT command passthrough stopped working -> ERROR, no modem answer

I had the problem that my board does not process AT commands anymore. The modem was suddenly no longer accessible. When I ran the example script "TestModem" from the MKRNB library, then I got the following error:

-> Starting modem test...ERROR, no modem answer.
-> Checking IMEI...Error: Could not get IMEI

I thought that my modem was defective, but fortunately it was not. I found out that the modem works fine without a SIM card. To check this, you need to do the following:

  1. disconnect the board from the power or PC.
  2. unplug the SIM card
  3. reconnect the board to the PC
  4. load the sketch SerialSARAPassthrough from the examples of the MKRNB library to the board.
  5. disconnect and reconnect the board from the PC if necessary.
  6. start Serial Monitor with "Both NL & CR" and 115200 baud
  7. send AT
  8. OK should come back

If OK comes back, then the modem is not defective!

Now you can unplug the board from the PC again and insert the SIM card. Proceed as follows:

  1. close the serial monitor from the Arduino IDE.
  2. plug the board into the PC
  3. wait until windows sounds that the board is connected
  4. open the serial monitor
  5. enter the command AT (You need to be fast. Hint: work with copy and paste)
  6. now you will probably get no OK or answer back.

I found out that the modem is only accessible for about 6 seconds with the SIM card inserted. So you have to be fast with opening the Serial Monitor and entering AT. Close the serial Monitor, unplug the board and follow the steps above again.

After the modem returned OK with the SIM card inserted, I was able to solve the problem as follows:

  1. Repeat the above steps with the SIM card inserted using the command AT+COPS? instead of AT. If you do not get +COPS: 0 back, then you have the same problem as me.

Now you have to disconnect the board from the PC again and repeat the steps described above. Instead of AT or AT+COPS? enter the following command: AT+COPS=0,0

-> OK should come back.

Now you should be able to communicate with the modem even if the SIM is inserted. The problem should be solved now.

You can check this by entering the following commands:

-> Response: +USIMSTAT: 4 (Status of the SIM card)


-> Response: +CLAN: "en" (language of the SIM card)

I hope the instructions are understandable and help someone to solve the problem. :slightly_smiling_face:

There are several way to make the AT console not answering anymore. IMHO the main problem ist that the socket (TCP and UPD) is closed in sync mode by the lib, i postet a PR to switch to async which helped me A LOT - > Push 512 instead of 256 bytes, async socket close by CptHolzschnauz · Pull Request #84 · arduino-libraries/MKRNB

The best is to avoid that state of the AT console.
Keep in mind:

  • The modem is a computer with a OS of its own and not really under control, eg. you can send AT commands and then more or less pray. This is the most important lesson.
    EG. If your sketch is is writing data into a socket and after that the sketch is let's say checking sms, it's possible that the new AT command comes before the old command is executed.
    Timing is everything.
  • even with the access(true) argument you do NOT see all the commands and answers in the serial monitor.
    -the modem.WaitForResponse function does not work all the time
  • timing is everything, errors (like socket deads) can lead to completely different behaviours of the modem
    -When the modem gives no answer on the AT console it does not mean that the modem is stuck, there are timeouts of minutes in he lib.

Your way is a hard reset to reboot the modem. (hardware reset, power loss) that makes the SIM card sometimes unaccesible too.