Sipy crashes when attempting to initialise Sigfox twice.
-
Has anyone tried to execute the following line from the documentation twice:
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4)
The first time I do it, everything is fine and I can carry on setting up Sigfox and send a message. But if I accidentally execute this line again without resetting the board, e.g., by clicking run in Pymakr, the board crashes shortly afterwards. I say "shortly" because if I include some print statements after the line, 2 or 3 of them will get executed before it locks up. The only way out is to reset the board. I have the latest firmware and latest Pymakr.
My current workaround is to put this line in boot.py so it is very unlikely I will accidentally execute it twice between resets.
-
The latest firmware, 1.6.12.b1 has fixed this issue for machine.reset(). Typing CTRL-D in Pymakr still causes a crash but that is manageable by testing for machine.SOFT_RESET before attempting to set up Sigfox and if true, do a machine.reset() or machine.deepsleep(1) first.
-
@aevraewrvaervea Having done more investigation, the type of reset I do before next calling this line is critical. The following are effective and do not result in any crashes:
Power cycling (unplugging and plugging USB connector).
Pushing reset button on PCB.
machine.deepsleep(1).The following initially appear to cause a successful reset but will result in the board crashing the next time the above line is executed:
Typing CTRL-D in Pymakr.
machine.reset().Which is rather interesting as I thought machine.reset() was a proper hard-reset but for some reason isn't as "hard" as machine.deepsleep(1). This makes machine.deepsleep(1) the much more preferable command to use when trying to hard-reset a remote system via the REPL.