Python library comms issue (RT1062/Windows 11)

I seem to be having a communications issue using the Python library to talk to an RT1062. I am using Windows 11.

The OpenMV IDE has absolutely no issues and works perfectly.

I even tried to run the CLI and get the same error:

> python -m openmv.cli --port COM10 --debug --timeout 3.0
pygame 2.6.1 (SDL 2.28.4, Python 3.12.10)
Hello from the pygame community. Contribute - pygame wiki
000141.617 - Using built-in script
000501.505 - :repeat_button: Resynchronizing
000503.075 - :right_arrow: Send: seq=000, chan=0, opcode=PROTO_SYNC, flags=0x00, length=0
003503.612 - :warning: Sync attempt 1 failed, retrying…
003504.633 - :right_arrow: Send: seq=000, chan=0, opcode=PROTO_SYNC, flags=0x00, length=0

It usually hangs at this spot. Recovery typically requires unplugging the USB cable.

Can you update your firmware to the latest (Tools->Install Latest Development Release) in the IDE. It’s working for me on windows:

That seemed to do it. Thank you!!

I’m using the Multispectral Thermal Camera Module on the RT1062. Oddly enough, after upgrading to firmware 5.0.0, the IR camera stopped displaying an image, even in the IDE. It seems like its talking, gets the correct width and size, but no image seems to be transmitted.

I went back to version 4.8, and the IR image started being transmitted again.

Is there something different I need to do differently with the setup procedure with firmware version 5?

Run this example:

import time
import csi
import image
from ulab import numpy as np
import math

print(["0x%x"%i for i in csi.devices()])

alpha_pal = image.Image(256, 1, image.GRAYSCALE)
for i in range(256):
    alpha_pal[i] = int(math.pow((i / 255), 2) * 255)

csi0 = csi.CSI()
csi0.reset(hard=True)
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)

csi2 = csi.CSI(cid=csi.LEPTON)
csi2.reset(hard=False)
csi2.pixformat(csi.GRAYSCALE)
csi2.framesize(csi.QVGA)
csi2.ioctl(csi.IOCTL_LEPTON_SET_MODE, True, False)
csi2.ioctl(csi.IOCTL_LEPTON_SET_RANGE, 20.0, 40.0)

print(csi0, csi2)
clock = time.clock()

tmp = image.Image(csi0.width(), csi0.height(), csi0.pixformat())
img2 = image.Image(csi2.width(), csi2.height(), csi2.pixformat())

while True:
    clock.tick()
    img0 = csi0.snapshot()
    csi2.snapshot(blocking=False, image=img2)
    img0.draw_image(img2, 0, 0, color_palette=image.PALETTE_IRONBOW,
                                       alpha_palette=alpha_pal,
                                       hint=image.BILINEAR)
    print(clock.fps())

Thank you @kwagyeman
The overlay test code you gave me did work on firmware version 4.8

However, I’m having have 2 problems:

  1. Today, when I try to ā€œInstall latest development releaseā€ bricks the board, and I have to recover using SBL/DFU. However, this worked yesterday and I was able to grab the image using python on my PC.
  2. In my PC application, using python and openmv API, I will need both outputs separately for analysis, preferably reading one image then the other, and not an overlay. Is that possible?

Please see this GUI here: openmv-projects/tools/thermal-overlay-calibration/README.md at master Ā· openmv/openmv-projects Ā· GitHub

Let me test the latest firmware.

Yes, the latest RT1062 firmware appears to break the system.

It’s this PR: Merge pull request #3133 from openmv/add_lwip_section Ā· openmv/openmv@87d082b Ā· GitHub

We’ll have it fixed soon.

@kwagyeman Thank you for all your support! V5.0.0 is now running on the RT1062 after your release this morning.

I have re-verified your overlay script included above is working.

However, I still can’t get IR to stream by itself in V5, in my python app or the IDE. The visual camera works in both, but for some reason the IR camera does not.
Ironically, it does work in V4.8. In the IDE, I can pick one or the other and it is received and displayed correctly. But once I move to V5, the IR does not stream.

import time
import csi
import image
from ulab import numpy as np
import math

csi0 = csi.CSI(stream=False)
csi0.reset(hard=True)
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)

csi2 = csi.CSI(cid=csi.LEPTON, stream=True)
csi2.reset(hard=False)
csi2.pixformat(csi.GRAYSCALE)
csi2.framesize(csi.QVGA)
csi2.ioctl(csi.IOCTL_LEPTON_SET_MODE, True, False)
csi2.ioctl(csi.IOCTL_LEPTON_SET_RANGE, 20.0, 40.0)

clock = time.clock()

while True:
    clock.tick()
    img2 = csi2.snapshot()
    print(clock.fps())

You have to change the image composition. There’s a new stream argument too for these things.

I’ll be switching to firmware documentation next week for the v5.0.0 release.

Oooh! Thanks for giving me a little ā€œsneak peakā€ at the new V5 rollout.

Playing with your new code now.

Having high incidence of ā€œRuntimeError: Sensor control failed.ā€

To be safe, I ran ā€œInstall latest development releaseā€ earlier today to make sure I was at the latest firmware.

I can run the micropython once and everything works ok. If I stop it, then start again, I get the ā€œSensor Control Failedā€. My only recovery option is to unplug the USB, wait a moment, then plug it back in.
I am trying to run at a high resolution (QXGA/WQXGA).

Any thought on what might be causing this?

import time
import csi

csi0 = csi.CSI(cid=csi.OV5640, stream=True)
csi0.reset(hard=True)
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QXGA)

# csi2 = csi.CSI(cid=csi.LEPTON, stream=False)
# csi2.reset(hard=False)
# csi2.pixformat(csi.GRAYSCALE)
# csi2.framesize(csi.QVGA)
# csi2.ioctl(csi.IOCTL_LEPTON_SET_MODE, True, False)
# csi2.ioctl(csi.IOCTL_LEPTON_SET_RANGE, 20.0, 40.0)

clock = time.clock()

while True:
    clock.tick()
    img0 = csi0.snapshot()
    print(clock.fps())

It appears to be working on my board. I just tried your script above and it’s functional.