Your PDU begins 001104 where “04” is the message reference number.
Normally, you’d always set this field to “00”, and this would allow the last sent reference number to be read from the SIM and incremented by 1 automatically.
Might this be causing a problem?
Is the modem verified as being in PDU mode prior to the sending attempt?
I did change the pdu frame to set the message reference at “00”. Modem is registered in 2G, carrier is movistar Spain, and the command sequence is the same as shown in my firts post.
It seems quite random, some times the command returns OK, and in other ocasion it fails with +CMS ERROR: 500. Interestingly even when the command returns error 500 the SMS is sent.
Well, I did some more tests and it also fails when registered on LTE-M. Although the PDU I am sure is correct.
There is some intriguing note on the manual that says: After the execution of Read Command, a delay of 5-10 s is required before issuing the Write Command. Otherwise +CMS ERROR: 500 may appear.
I have tried a 10s delay just before issuing the AT+CMGS command and it makes no change.
I’ve found that note about the delay in other Quectel manuals also, including for devices like the EM06-E, EM12-G and RM500Q-AE that I use regularly.
But I’ve always got the message reference number returned rather than an “ERROR: 500”. My sent SMSs are always in PDU-mode.
I rely on that message reference number to indicate successful sending. If this was happening to others, I would know about it, as I developed and maintain SMS software which is in use on a great many modems internationally (the ROOter project).
I’ve only found that quote made in relation to the +CMMS command, implying the delay needs to happen between AT+CMMS? and AT+CMMS=n (for some value of n).
Is it only a BG95 modem that’s having this issue?
Thanks again snowgan. Yes, this +CMS ERROR: 500 only happens with the BG95. This same PDU works perfectly with modems from Cinterion, uBlox, and even the EG91 from Quectel.
I think it’s almost certain you’ve discovered a BG95 firmware bug. In the early days of the EM12-G there was a bug that I reported and was soon fixed.