-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReceiveSMS sketch hangs after SMS received #86
Comments
Just a short reply. Sorry, i was unclear with "other library". I meant i compiled my sketch with another computer with a pristine MKRNB lib (without any changes made by me ;=) and then it worked. Thats what i meant with "another" lib. You are right, the / char was coincidence. I just replicate the error, but with another board (and SIM) with the same sketch it works perfektly. There is a bug and it's going to be a tough one... PS: I loaded the serialPasstrough (the modem keeping powered on), with Joshbober, you wrote |
PPS: I reproduced the bug with Manually, it works perfectly: Where do you count 64 characters? This issue comes out of a sudden and vanish the same way...strange flaky thing. |
Thanks for looking into this, Cpt. First off, I have also seen that manually sending the AT+CMGL command using the passthrough sketch works perfectly. Where do you mean? Is the buffer handling not within NB_SMS.cpp, 350? Where do you count 64 characters? You can see from here that the "AT+CGML="REC UNREAD"" command is also stored in this buffer, which explains why the total characters printed is 64 and not only 40. A way to test this is to remove "="REC UNREAD"" from "NB_SMS.cpp", line 226; the "AT+CGML" command by default will return the unread messages (see section 9.12.4 of SARA-R4 series AT commands manual). 13 more characters of the response get printed since the part of command that is removed is 13 characters long. I think the response for the AT+CGML command is longer than expected for most AT responses, and thus the Modem.cpp code is not equipped to process it. Only the first 64 characters of the total command+response get stored in the buffer, so the result code (OK, ERROR, NO CARRIER, or CME ERROR) is not found. The value of _ready remains 0, and the code remains forever in the while loop found in NB_SMS.cpp, line 283 (this can be verified by putting a Serial.print statement within the while loop and watching on the Serial monitor). Sorry for the wall of text, hopefully this gets us closer to an understanding of the issue. |
No worries! I'm glad i found a mate with this issue! |
I fully support the theory that it's a simple fix that I'm just not understanding, hopefully someone who understands or contributed to this library can chime in. As for your question- I have no clue. I have not gotten it to work even once yet. I tried using a fresh library install on the same computer, with a fresh compile (temp folder emptied), to no avail. I noticed you said in another comment that it worked for you on a different computer; I will attempt that as well and report my results. |
UPDATE: Tested on different computer, but I have found the real culprit: the Arduino SAMD boards library. Versions 1.8.10 and 1.8.11 exhibit this buffer/hanging issue. @CptHolzschnauz please test with the downgraded SAMD library and let me know if you see the same result. If this is the case, and the issue is not with the MKRNB library, but with the SAMD, should there be a disclaimer or something to not use v1.8.10+ of the SAMD core until they fix it? I will pursue submitting this issue over there if it hasn't already been brought up. |
Oh man, you are right! I can confirm. |
Thank you for confirming! I'm glad that we got to the bottom of this, and that your gut feeling was right. I just created an issue over on the SAMD repo, hopefully they can provide some insight. @per1234, not sure if this should be closed here, with the stipulation that this is an issue with dependencies rather than the MKRNB lib itself. |
Thank you for finding! My gut was half right, i think you were on the right path to the bug deep down in the core... |
Update: I had also a strange behaviour with the same symptons with the nbscanner class, call getSignalStrength() with core 1.8.9. I downgraded the core lib to 1.6.12, the last version of the mighty Sandeep Mistry. The age of the mkrnb and the core are now more equal. I will let u know. |
I have been following this thread (and all the precursors to this thread on Arduino forums including the board soldering to get the R410M firmware upgraded on the MKRNB) and am very interested in the progress on this. In my particular experience, I have been trying to get SMS messages to send and receive, but have achieved neither of these even once. I seem to be able to run all of the other examples (SATA pass through, NTP time pull from a server, Network type configuration (LTE-M, NB, then the ones with failover order)) but the SMS side of it has never worked. My AT&T account swears SMS is enabled for this SIM, although I never took it out and tried it on a cell phone because I wasn't sure if the SIM had to be tied to a device IMEI to work and feared that may alias the truth. I'm having a bit of an embarassing moment here, but I can't seem to find this library in my Arduino Library Manager. What can I search for specifically to find it and ensure it is downgraded? I feel like I've seen it before but it's just not showing up. Thanks, EDIT: I realized the board manager core firmwares are in separate managers than the code libraries. All good here, will post any unique results that improve further guidance. When I get a moment, I'll keep downgrading them until I can possibly avoid the character loss issue described above. EDIT 2: Still can not send or receive SMS using either MKR NB 1500 included examples. m-center shows "success" when sent manually over AT commands, but it's never received on my device, nor vice versa. |
The issue is between the modem and the mobile network, nothing with the lib or your sketch. |
What I meant was that I have done this. I do appreciate all that great information. It really was quite easy.
Unfortunately I still cannot send nor receive SMS. |
Firmware is fine. sms don't work with MKRNB lib, nor manually, nor u-blox center? |
Nope. M-Center is my primary test tool when I boot it up and always nothing. It typically doesn't ever populate the "Radio access technology" field under the Network tab either. I have seen it do that maybe once. I was going to try that but worried with SIM being 3-in-1 if I popped it down from micro/3ff to nano/4ff for my phone, I might have trouble getting it back into the micro slot without a special adapter. Not sure if just pushing it back into the micro plastic template will work after it is detached from plastic, but I'll try. |
One interesting thing is that the AT+URAT= commands don’t seem to be accepted in M-Center after updating the firmware for the uBlox, and it says command not supported. I have attached a few images to show you what works and what doesn’t. Do you ever hear of people saying this doesn’t work with standard AT&T LTE-M network? Or maybe SMS doesn’t work over that network? I have ordered some Hologram sim cards since I see a lot of people using those and was wondering if you might recommend a US network that has been demonstrated/proven to work with this board. Attached some images to help you get an idea. Strangely the radio access technology field in the network tab almost never populates (I've seen it once) with either version of ublox firmware, old or new. |
AT+URAT= is not workin anymore, probably this is automatic now. |
It will OK it just like everything else, but not actually show/read anything.
From: CptHolzschnauz ***@***.***>
Sent: Monday, September 20, 2021 9:20 AM
To: arduino-libraries/MKRNB ***@***.***>
Cc: Richard Howell ***@***.***>; Comment ***@***.***>
Subject: Re: [arduino-libraries/MKRNB] ReceiveSMS sketch hangs after SMS received (#86)
AT+URAT= is not workin anymore, probably this is automatic now.
I have no idea about AT&T capabilities, i'm in switzerland. It works here, somehow..
Try AT+CFUN=15,1 to reset also the SIM card.
Tick the box in "Automatic reading of RX SMS"
When you send a SMS to the device whats happen with AT+CMGL="ALL" ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#86 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKCNE3RFOEBN2ZBOPJRVB7LUC47JNANCNFSM5DVR56YQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Just OK means there are no SMS in the memory of the modem. |
My friend I hope you are right. I turned crazy days ago already. I am working on trying something with Verizon or some other network with my Hologram sim that should be coming. Do you have any knowledge of why this link for the NB is still active but the more general link is still dead? Noticed they appended a "-B" to the product ID. May be just a US thing. |
I am, thx. I'm fighting with this modem problem since months, you are not alone in the loony bin ;=) |
Regarding your issue above, while I was reading page after page of uBlox AT manuals -- which is almost as exciting as a moto/freescale MC9SO8 manual -- somewhere it mentioned 3GPP release 13 power saving modes / deep sleep modes shutting off the actual UART channels until it could realize edge triggering on tx/rx lines if not using the dedicated wake pin to wake unit up. Might explain the missing character at start on some of these responses. This may have been the SARA-N3 series though. |
You can turn off power saving with AT+UPSV=0 |
|
Sorry, i meant AT+UMNOPROF? |
AT+UMNOPROF? returns "0"
and..
Still returns 0 when checking AT+UMNOPROF? |
Sorry, i forgot, after AT+UMNOPROF=198 you have to AT+CFUN=15 |
Oh dang, thanks, forgot that. After doing this, it doesn't appear to register with the network.
|
So then, back to start... Have you also tried AT+UMNOPROF=1 ? |
So you were right, it did end up being something on the carrier side. They finally fessed up and told me they didn't "have data activated" on their end. After that got resolved, I started seeing data. The texts from the device to the phones never miss a beat -- very good. Sometimes the receiption from my phone to the device, however, can lag quite a bit. But it is looking more responsive tonight, the difference being that I have improved my antenna situation. Perhaps that's what's causing it, we will see. Thanks for the tips! |
Cheers! |
Resolved with version 1.8.12 of the SAMD core. I tested the ReceiveSMS sketch with the new core and a MKR NB1500. Though the first character of each message is still dropped when writing the message to the SM, the device no longer hangs, and multiple messages can be received without resetting the modem. Thanks for your help chasing this down, and special thanks to @sandeepmistry for finding the issue with the SAMD core. |
In the Arduino example sketch ReceiveSMS.ino, when a message is received by the device, the response gets cut off and the sketch hangs. This was discussed partially in #50, but is a separate issue from what has been discussed there. #80 hypothesized that it was an issue with the '/' character, but the issue was closed without clear resolution (using another library may have solved this). With Serial debugging active, I see that the response returned over the serial monitor is cut off abruptly, like this:
14:32:05.683 -> AT+CMGL="REC UNREAD"
14:32:05.683 -> +CMGL: 6,"REC UNREAD","+1##########",,"21
After this, the code gets stuck in a while() loop, waiting for MODEM.ready() to return something other than 0. This is where the problem becomes more clear. Incoming uart data is stored in the RX ring buffer, which has a size of 64 ints. The first 64 characters of the response are being stored in this buffer, and the rest seems to be dropped. I verified this by adding a Serial.print statement with the size of the RX buffer after each character is read. This means that the response code at the end is not stored or read in the modem's poll() function, causing the return value for "ready" to always remain 0.
I have verified that this is NOT an issue with processing the '/' character; if you change the AT command in the library from "AT+CMGL="REC UNREAD"" to just "AT+CGML" (identical commands, see AT commands reference), the serial monitor will print more of the date/time, like this:
15:45:05.700 -> AT+CMGL
15:45:05.746 -> +CMGL: 11,"REC UNREAD","+1##########",,"21/09/08,12:45
I see that buffering is handled differently for the NBClient functions (the NBSocketBuffer files), where the buffer is extended to 512 ints. Does a similar solution need to be applied here to handle SMS message reading? Is there something that I am missing in my understanding?
Steps to replicate:
Link to gist of Serial Monitor output following the 3 steps above (with phone number redacted)
https://gist.github.com/joshbober/9a9a01e35c540c0f4d4771276bfee0be
Other relevant information:
The text was updated successfully, but these errors were encountered: