I'm reaching out here since I have some trouble to get the network PSM to work properly.
For testing purposes, I want a program that sends a packet every 10 minutes, in between goes in to sleep. After the packet is sent the device should be active for 1 minute to check for replies from the server.
So far I have successfully requested the TAU and Active Time from the network using AT Command "AT+CPSMS".
However, I have some trouble getting this working in an actual program that sends packets.
I haven't found any examples where PSM mode is used in a program that actually sends data. If anyone here could guide me I'm grateful!
I have experimented a little with PSM settings. I became very confused with some conflicting information on the timers. The other challenge is that you request these settings from the network operator, but they do not have to grant them. From my experience, it did not seem like AT&T was supporting this yet, but I could be way off.
If the modem does go into PSM, you need to pulse the pwr_on pin to bring it out of PSM.
@zbelding Do you have exactly the implementation of pulsing the pwr_on pin in Arduino?
From code examples....I'm guessing...
pinMode(SARA_PWR_ON, OUTPUT);
digitalWrite(SARA_PWR_ON, HIGH);
delay(150); // Datasheet says power-on pulse should be >=150ms, <=3200ms
digitalWrite(SARA_PWR_ON, LOW);
I'm noticing (as you and others have pointed out) that after random times, the SARA chip goes into an unresponsive state and my sketch basically infinitely loops in trying to reconnect via "nbAccess.begin()". I thought that the begin method in the NB class of the MKRNB library would pulse the pwr_on pin correctly...but maybe I am mistaken?
I'm using the latest master branch of the MKRNB library since the fixes aren't in a release yet:
then...
I'm thinking maybe the V_INT pin check after some time in Arduino is out of sync with the Modem's actual state and it infinitely hangs because it never actually sends the power on pulse when it gets into this unresponsive state.
Okay, I've been in contact with my carrier (Telia) and they do support PSM. I'm currently running a test with the SARA serial. Using AT+UCPSMS I can see that my PSM request was granted. The shortest sleep time Telia allows is 1 hour. So we'll see how it goes.
If I want to abort the PSM I usually run the command AT+CFUN=15 to reset the modem.
I'm however confused about how to implement this in a program, seems like the loop still continues even if the modem is in PSM mode.
ccorrads: @zbelding Do you have exactly the implementation of pulsing the pwr_on pin in Arduino?
From code examples....I'm guessing...
pinMode(SARA_PWR_ON, OUTPUT);
digitalWrite(SARA_PWR_ON, HIGH);
delay(150); // Datasheet says power-on pulse should be >=150ms, <=3200ms
digitalWrite(SARA_PWR_ON, LOW);
I'm noticing (as you and others have pointed out) that after random times, the SARA chip goes into an unresponsive state and my sketch basically infinitely loops in trying to reconnect via "nbAccess.begin()". I thought that the begin method in the NB class of the MKRNB library would pulse the pwr_on pin correctly...but maybe I am mistaken?
I'm thinking maybe the V_INT pin check after some time in Arduino is out of sync with the Modem's actual state and it infinitely hangs because it never actually sends the power on pulse when it gets into this unresponsive state.
Your pwr_on code looks right to me. I usually use 500ms, but anything between the range you found in the manual should work. I would keep it less than 1.5s, that way you don't accidentally turn the modem off if it's already on. V_INT is not connected on this board. It doesn't really need to be. You can pulse the pwr_on pin at any time to confirm the modem is on.
Sorry, I can't help you too much with arduino library specific questions. I only used these libraries in the very beginning.
With regard to the modem seeming to be unresponsive, in my experience this was completely fixed with the new version of the modem firmware. I believe this was a specific AT&T issue. You can find more details in my other threads.
Thanks so much! Yes I did find your other thread about the 2.16 firmware update. I am in talks with UBlox now to hopefully get my hands on the latest firmware. I followed your instructions for the 2.00-2.04 update but still these hangups persist. Hopefully by this weekend, 2.16 solves my problems
Good to know about the pulse. I assumed that the pulse is to ensure the modem is indeed on but not responding. Found that the reset is to take the modem down and bring it back to hopefully get AT commands to work again, but this is where I have not had much luck and I've had to unplug and replug the Arduino which isn't very ideal for remote monitoring... (the soft NVIC_systemReset() doesn't cut it).
I responded to this thread since its the most recent, and I have a feeling this PSM could be related to issues with the older firmware and hangups with TCP packets...but as you mentioned AT&T has not explicitly supported this...so i'm probably wrong which has been the case many times.