今天遇到个问题,修改了一下文件,加了信号量。然后工作好像也没问题。但串口打印红色信息。不知道是啥?
Get mqtt password success!
Get reg success!
The semaphore was created successfully!
The semaphore can now be used.
is registered!
got ip: 192,168,0,106
Broker url: mqtt://150.158.77.97
MQTT_EVENT_CONNECTED
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect..
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect.............
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect.....................
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect.....................
GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5))
Waiting for the device to reconnect...................
打印了这么多。后来就这样 没打印了。
第二次 idf.py -p COM21 monitor 又没发现了
难道是monitor软件发出来的?
请教请教。是个什么情况。
今天遇到个问题,修改了一下文件,加了信号量。然后工作好像也没问题。但串口打印红色信息。不知道是啥?
Re: 今天遇到个问题,修改了一下文件,加了信号量。然后工作好像也没问题。但串口打印红色信息。不知道是啥?
Waiting for the device to reconnect.. 这句 log monitor 的打印,这个意识说明串口不稳定,我们无法发现串口,最简单的验证方法是插拔板子的USB线,至于另外的 GetOverlappedResult failed (PermissionError(13, '???????????????', None, 5)) 更像是程序的打印。
Re: 今天遇到个问题,修改了一下文件,加了信号量。然后工作好像也没问题。但串口打印红色信息。不知道是啥?
我也遇到了这个问题,有时候会出现,不知道什么原因导致的。楼主解决了嘛
-
- Posts: 786
- Joined: Wed Nov 14, 2018 8:45 am
Re: 今天遇到个问题,修改了一下文件,加了信号量。然后工作好像也没问题。但串口打印红色信息。不知道是啥?
这部分 log 的出处是在 tools/idf_monitor_base/serial_reader.py 里,代码:
以及 serial/serialwin32.py:
串口读取数据异常了,这个是 python serial 库里报出的 exception。这个应该只有在 windows 下才有此问题。
当前使用的是什么开发板?用的是什么 windows 版本?是否也有其他工具在操作串口?出现这个问题时,直接退出 idf.py monitor,然后用其他串口工具,是否还能打开?
Code: Select all
try:
data = self.serial.read(self.serial.in_waiting or 1)
except (serial.serialutil.SerialException, IOError) as e:
data = b''
# self.serial.open() was successful before, therefore, this is an issue related to
# the disappearance of the device
red_print(e)
yellow_print('Waiting for the device to reconnect', newline='')
self.serial.close()
while self.alive: # so that exiting monitor works while waiting
try:
time.sleep(RECONNECT_DELAY)
self.serial.open()
break # device connected
except serial.serialutil.SerialException:
yellow_print('.', newline='')
sys.stderr.flush()
yellow_print('') # go to new line
Code: Select all
def read(self, size=1):
"""\
Read size bytes from the serial port. If a timeout is set it may
return less characters as requested. With no timeout it will block
until the requested number of bytes is read.
"""
if not self.is_open:
raise PortNotOpenError()
if size > 0:
win32.ResetEvent(self._overlapped_read.hEvent)
flags = win32.DWORD()
comstat = win32.COMSTAT()
if not win32.ClearCommError(self._port_handle, ctypes.byref(flags), ctypes.byref(comstat)):
raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
n = min(comstat.cbInQue, size) if self.timeout == 0 else size
if n > 0:
buf = ctypes.create_string_buffer(n)
rc = win32.DWORD()
read_ok = win32.ReadFile(
self._port_handle,
buf,
n,
ctypes.byref(rc),
ctypes.byref(self._overlapped_read))
if not read_ok and win32.GetLastError() not in (win32.ERROR_SUCCESS, win32.ERROR_IO_PENDING):
raise SerialException("ReadFile failed ({!r})".format(ctypes.WinError()))
result_ok = win32.GetOverlappedResult(
self._port_handle,
ctypes.byref(self._overlapped_read),
ctypes.byref(rc),
True)
if not result_ok:
if win32.GetLastError() != win32.ERROR_OPERATION_ABORTED:
raise SerialException("GetOverlappedResult failed ({!r})".format(ctypes.WinError()))
read = buf.raw[:rc.value]
else:
read = bytes()
else:
read = bytes()
return bytes(read)
当前使用的是什么开发板?用的是什么 windows 版本?是否也有其他工具在操作串口?出现这个问题时,直接退出 idf.py monitor,然后用其他串口工具,是否还能打开?
Who is online
Users browsing this forum: No registered users and 73 guests