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:
- disconnect the board from the power or PC.
- unplug the SIM card
- reconnect the board to the PC
- load the sketch SerialSARAPassthrough from the examples of the MKRNB library to the board.
- disconnect and reconnect the board from the PC if necessary.
- start Serial Monitor with "Both NL & CR" and 115200 baud
- send AT
- 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:
- close the serial monitor from the Arduino IDE.
- plug the board into the PC
- wait until windows sounds that the board is connected
- open the serial monitor
- enter the command AT (You need to be fast. Hint: work with copy and paste)
- 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:
- 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:
AT+USIMSTAT?
-> Response: +USIMSTAT: 4 (Status of the SIM card)
AT+CLAN?
-> Response: +CLAN: "en" (language of the SIM card)
I hope the instructions are understandable and help someone to solve the problem.