-
Notifications
You must be signed in to change notification settings - Fork 10
Example 16 not waking from deep sleep correctly after upgrade to v2.1 #38
Comments
I made some more tests with the tracker with different settings, and after some settings change it suddenly works again, even when changing the settings back to what they have been before. I have no idea what is different. |
Hi Andreas, Restoring the Artemis peripherals and pins to full function after deep sleep is a lot more complex in v2.1 than it was with v1.2 of the core. Getting that part of the code right on OpenLog Artemis took a lot of effort. It will be a question of making sure that the AGT deep sleep and wake code is exactly the same as the OpenLog Artemis code. Example12 is much simpler and doesn't have to worry about restoring (e.g.) Serial1, agtWire and all the pins and interrupts to full functionality after deep sleep. I will try and investigate this when I get some 'spare' time. (It is in short supply at the moment! ;-) ) Meanwhile if you discover any more clues, please report them here. Very best wishes, |
This morning a made another test with the same configuration that worked yesterday evening (i.e. no changes, just plugged the device to power), and it stopped after the first message. |
Hi Andreas, |
To test more, I tried to skip the deep sleep phase by adding the following lines in case zzz, line 2251 (i.e. after the modem is powered down):
Have I missed something? Now it hangs when reading the PHT sensor after sending two messages.
|
Hi Andreas, Thank you for investigating this. If you have time, it would be good to understand exactly where your code is hanging. Could you please try adding this line in many places in the
The The background to this is that v2.1 of the core does things differently compared to v1.2. The Ambiq Micro low-level calls to the Apollo3 Blue hardware are wrapped up in the Mbed OS functions, and things happen differently. The point at which the pins are configured for I2C / SPI is different for example. Maybe there is a gremlin in making repeated calls to Very best wishes, |
I have inserted several Serial.println lines. In my tests, it hung around the line
that is either the println before that line (i.e. after |
Excellent - thank you Andreas,
|
Hello Paul, |
Thank you Andreas, I will keep thinking about this - but I'm really struggling to think what the cause could be. I wish I could replicate it here - but my board is operating nicely. Would you be willing to let us replace your board if that is the only way forward? Please feel free to contact me privately about this - my email address is on my profile page. Best wishes, |
In order to test whether this may be caused by some installation issue, a colleague of mine flashed example 16 to the board with his independent installation (Arduino 1.8.12 under Windows 10, while I use Arduino 1.8.15 under Ubuntu Linux). Therewith, it hangs at a different place:
So this issue may be related to #36 yet. |
Thank you Andreas, I think I have a possible explanation for this... Please see: sparkfun/Arduino_Apollo3#423 When the Iridium modem is powered down, it is likely to pull the Serial1 RX pin low. As reported above, this can cause the code to hang. (With v1.2.1 of the core, this does not happen.) I will of course try to produce a fix for this as soon as possible. Very best wishes, |
Hi Andreas (@a-schneider-fmi ), I have updated the examples to include a fix for the Apollo3 Serial1 RX pin issue. Please give them a try. As usual, there are pre-compiled binaries you can upload. Or, you can compile the code yourself: please use v2.1.0 of the Apollo3 core; please update the IridiumSBDi2c library to v3.0.5. Please let me know if this resolves your issue. Very best wishes, |
Hi Andreas, |
Hi Paul, |
Thank you Andreas - that's great news, |
When I switch back on my custom code which uses the MCP23008 library to switch some GPIOs connected by I2C, I now get a MbedOS Fault in the user function upon the second execution which I haven't seen before:
Does this mean the MCP23008 library is not compatible (any more)? I have already inserted some |
Hi Andreas, Ah. I was worried this might happen. I guess you only see the hard fault after the AGT has woken up from deep sleep? (Is that your "second execution"?) You will need to replicate the code which (re)configures I'm guessing you are now using You should not need to change the pull-ups, so I think you do not need to fully replicate The important pieces to replicate are:
Artemis_Global_Tracker/Software/examples/Example16_GlobalTracker/Example16_GlobalTracker.ino Line 2386 in d3d7382
Artemis_Global_Tracker/Software/examples/Example16_GlobalTracker/Example16_GlobalTracker.ino Line 2408 in d3d7382
which means you need to comment this line: Artemis_Global_Tracker/Software/examples/Example16_GlobalTracker/Example16_GlobalTracker.ino Line 2411 in d3d7382
Add 39 and 40 to this list: Artemis_Global_Tracker/Software/examples/Example16_GlobalTracker/Example16_GlobalTracker.ino Lines 2417 to 2418 in d3d7382
The code to re-enable the pins afterwards will be similar to
I suggest you do this in I hope this solves your problem! |
Hi Paul,
The final version will use the broken-out I2C pins and thus |
Thank you Andreas - that is music to my ears...! |
I will do some more tests and notify you then. |
Now my tracker hangs after the first |
Hi Andreas, |
The tracker indeed hangs with the nearly unmodified Example 16 (code including #39 but otherwise unmodified) and with Example 7 and Example 21. In my tests, the AGT hung on starting the modem when it had cold temperatures. Background is that I put it into the freezer to test #39 . The handful of times I did this test it always hung when cold and never hung after letting it warm up for an hour or so, for all three examples mentioned. |
I should add that if I build and flash the old firmware using v1 of the Artemis core (but including #39 ) the tracker does not hang when cold from the freezer, but sends messages with negative temperatures. |
Thank you Andreas, |
Maybe it's not directly caused be the low temperature, but the low temperature is correlated to the effect causing it. |
Just to document how things are with the board I have here: Running Example21 at room temperature: the yellow trace is the EXT_PWR power rail for the Iridium modem (5.3V switched by U3 and Q1); the purple trace is the Iridium modem RX1 line (RX(OUT)). From initial power-up: note that the RX1 line is already high - it goes high as soon as the code starts; note also the small glitch on the RX1 line 1.0s after the 5.3V rail goes high coinciding with the modem.begin; note also that serial characters are seen on RX1 0.5s after modem.begin is called On the second and subsequent loop: note that RX1 is low (disabled) until the modem.begin Here the yellow trace is ARTEMIS_D17 (modem ON/!OFF). First loop: Second and subsequent loops: |
Thinking more about the glitch on RX1 on the first loop. Is the glitch wide enough to cause the Artemis to hang? Here it is with a shorter timebase: yellow is ARTEMIS_D17, purple is RX1 Inconclusive... It is ~500us wide and does not go fully low. A thought experiment... The Artemis could hang: IF Serial1 is enabled in v2.1 of the core as soon as code execution starts, and IF the glitch on RX1 corresponds to >9.5 bit periods at whatever the default baud rate happens to be. JR (@jerabaul29) reported similar issues in Apollo3 Issue 349 If the width or depth of the glitch is temperature-dependent, that could explain this issue. (More to follow shortly.) |
That was interesting... I am curious of why these issues happen with the core v2 but not the core v1. Following several issues with the core v2 (including the one you linked to), I decided to stick to the core v1 instead, and things work like a charm then... |
Hi Andreas (@a-schneider-fmi ), It is easy to test if the glitch is the cause of this issue, by making sure that the RX1 pin is disabled before calling If I add:
to the setup code in Example21:
then I can guarantee RX1 is disabled (low) the first time loop is executed: The slow rise of RX1 is interesting. It implies that the circuit inside the Iridium modem which drives the RX(OUT) pin has a slow response when ON/!OFF is pulled high. Perhaps while the internal microcontroller is starting up. If you have time, please do try adding Best wishes, |
Hi Paul, Thank you for your investigations. I have tested the modified Example 21 (i.e. with RX1 pin disabled as you wrote) with the deep-frozen tracker twice, and it doesn't hang. Best regards Andreas |
Thank you Andreas - that is great news! Let's leave this issue open until I have completed my own freezer tests. Very best wishes, |
Just for information, here's the start of my own cold test: The freezer is a Russell Hobbs RHTTFZ1. Start of the test: 11AM local. Example3 reports the following (the desiccant is clearly working!): Example9 shows the antenna cable is working: Here's the initial glitch on RX1 - same as above. The code is not calling My thesis is that the glitch will become wider or deeper as the temperature falls. More to follow... |
In my tests, I took the cold AGT out of the freezer and put it in front of a window in order to have radio reception while making the actual tests. Making a hole in the freezer was not an option. Thus, the effects I saw may also be related to humidity or warming effects. |
Thank you Andreas - understood. There are no obvious signs of anything having changed after a few hours at ~ -22C. Example21 is still running successfully: I'm not worried that I cannot replicate the behavior you observed. I believe we understand the core issue - and have a work-around for it. Meanwhile, my colleague is working on a proper fix for this issue. I will leave this open until I have had the opportunity to test Razvan's (@razvandragomirescu , #36 ) board. Have a nice weekend, |
After ~70 hours at ~ -22C, Example21 is still working OK for me. The glitch on the RX1 line does not appear to have changed significantly, but is perhaps 0.2V deeper / lower. So no clear "smoking gun" here... I will test Razvan's (@razvandragomirescu , #36 ) board as soon as it arrives. Best wishes, |
Hi Andreas (@a-schneider-fmi ), |
Original issue was raised by @a-schneider-fmi in #36:
Since the update to version 2, I experience another issue which may or may not be related: the tracker seems not to wake from deep sleep after 2 messages have been sent. From the configuration tool, I see the following messages:
And then it hangs. This happens with several TXINT settings (I tried 2 minutes, 5 minutes, 10 minutes).
I have tested example 12 to debug. It seems to work, at least it runs for more than half an hour. Do you have any suggestion how to investigate further?
The text was updated successfully, but these errors were encountered: