B4R Question Random characters in log

RJB

Active Member
Licensed User
I'm sure I've seen something about this before but can't find it now.
At startup the B4R log shows random characters in the log. This isn't normally a problem but I'm trying to test the deep sleep function of the 8266. This mans that every time it restarts and something is sent to the log these characters are displayed. The 'copy all to clipboard' ability of the log window also doesn't seem to work properly so may be related?
Is it possible to stop these characters being sent to the log?
Thanks
 

Erel

Administrator
Staff member
Licensed User
You are seeing the data exactly as it is received from the device. There are no filters.

You can add something like this when the program starts:
B4X:
For i = 1 to 10 
 Log("*****************************")
Next
 

RJB

Active Member
Licensed User
That will make it a bit more readable but when the device is continually re-starting, i.e. from deep sleep, then the log will fill up much quicker.
Is there any way to tell the device not to send the characters/ to clear it's buffer first?
If I could copy the whole log then at least I could look at it/ search in Notepad or Word but it only copies a few lines. Presumably something in the random characters stops it?
 

emexes

Well-Known Member
Licensed User
At startup the B4R log shows random characters in the log. This isn't normally a problem but I'm trying to test the deep sleep function of the 8266. This mans that every time it restarts and something is sent to the log these characters are displayed.
If this is happening when going in to or (more likely) out of deep sleep mode, then one possibility is that the UART is being put to sleep in the middle of transmitting a byte. When it later wakes up, it merrily sends the remaining part of byte, which will be misinterpreted by the receiving UART of the serial-to-USB bridge.

You could try forcing the junk to occur by sending a long log just before going into sleep mode.

Or you could send a short log last thing before sleeping and first thing after waking, with a (say) 1-10 ms delay after the going-to-sleep log, eg:
B4X:
Log("Sleeping")
Sleep(10)    'allow enough time for this message to get through the UART and USB bridge

GoToDeepSleepMode

Sleep(2)    'perhaps also try giving the log UART a moment to spin up
Log("Waking")
 

tigrot

Well-Known Member
Licensed User
This happen in most uart also on larger computers. First chars are often corrupted.
 
Top