Hi -
I am having some serial monitor issue in VSCode. After putting device into stay of the sleep modes I am unable to get any serial output on serial monitor.
I have tried various extensions as well as running particle serial monitor --follow from the CLI in VSCode without success. The initial output is printed, the device then sleeps and serial monitor shows the disconnect. It then shows the connect again, but not output.
Below his output from the Serial monitor extension in VSCode.
---- Closed serial port /dev/tty.usbmodem2101 due to disconnection from the machine ----
---- Reopened serial port /dev/tty.usbmodem2101 ----
---- Closed serial port /dev/tty.usbmodem2101 due to disconnection from the machine ----
Below us output from Serial Monitor rand from the CLI.
As you can see, on neither on of these it output anything to Serial Monitor even though --follow
was successful. I tried 3rd part serial monitor outside of VSCode as well, the issue.
I am using Mac M1, not sure whether that is relevant.
Regards, Friedl.
Which Particle device and what version of Device OS is running on it?
1 Like
Hi @rickkas7 -
B524 with DeviceOS 5.8.0 (Tried 5.6.0 as well)
Many thanks!
Hi,
sometimes a similar thing happens to me when I am running more than one particle serial monitor --follow from another VS Code or terminal.
Are you?
Hi -
No unfortunately this is not the problem in my case. Only a single window open. 
I'm having exactly the same behavior. No serial monitor output after sleep (ULTRA_LOW_POWER).
My setup:
- M-SoM(M524) + Muon
- DeviceOS 6.3.2
Funny enough, on wake up, I can see some internal messages from the OS, I guess from the modem (see screenshot), but nothing from my application is written to the terminal (and my firmware is full of Log.info calls):
It looks like your device is going back to sleep without most of your code executing. Without the code it's impossible to say why, but my guess is that there is a bug in the logic that causes your code to immediately go back to sleep after waking up.
In my case, to immediatelly go to sleep is intentional.
I've just started an application, that should read some sensors from time to time, and the rest of the time being sleep.
By the moment, I only have a very basic logic that wakesup/sleeps every 4 minutes. After wake up device pass through some finite machine states (that are empty, they are pending to be developed), and ends again in sleeping state.
I see that logging to the terminal works correctly if device starts from a manual reset (all my finite state machine changes are logged). But they are not logged after a wake up, and my logic seems to work fine, because final sleep state is correctly reached again after every wake up.
I have to ad something that I was not aware in my first post: device is normally disconnected from the cloud, it only connects every 1h to send vitals (just for fun by the moment). I have seen that immediatelly after connecting to cloud, terminal logging starts working again. See next screenshot. Hinted lines in the middle means that my application has correctly connected to Particle Cloud. Application Log.Info starts from this moment to appear on the terminal (you can see next output "app" lines from now on). But previous to this state, non "app" lines are printed (and I have plenty of Log.Info in my code before connecting to cloud):
After that, once device sleeps/wakesup again, terminal logging don't work again till new cloud connection (or manual button reset):
The serial terminal takes several seconds to reconnect, up to 8 seconds on Windows. My guess is that your code executes before the reconnection occurs, and you only see the cloud messages before the device goes back to sleep.
You can test this by adding this after returning from System.sleep():
waitFor(Serial.isConnected, 10000);
delay(2000);
You probably don't want to leave this is all the time, but it's a good test.
The best solution is to use Serial1 and USB to 3.3V serial adapter and Serial1LogHandler
for debugging sleep mode issues. Because the USB to serial adapter stays powered from the USB port, it stays connected even in sleep mode. Thus no messages will be lost immediately after waking from sleep.
Thanks Rick. That worked for me 