VCP error or bug?

I’m finding that if I’m using USB_VCP my script runs fine from the ide. However, when I attempt to run the script standalone, it crashes. Other scripts run fine. Is this something I’m doing wrong?

simplified script:

import sensor, image, time, utime
from pyb import LED, USB_VCP 

def blink(led,t=80):
    LED(led).on()
    time.sleep(t)
    LED(led).off() 


def write():
    blink(3,t=1000)
    if usb.isconnected():
        print("usb exists; blinking 2")
        blink(2)
    while(True):
        time.sleep(20)
        if usb.any():
            print("usb exists")
            blink(2, t=1000)
            cmd = usb.readlines(timeout=50) #fails here
        else:
            blink(2,t=50)
            print("Nothing on the usb")

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) 
sensor.set_auto_whitebal(False) 
clock = time.clock()
usb = USB_VCP()

while (True):
    write()

output coming from the ide:

>>> usb exists; blinking 2
Nothing on the usb
Nothing on the usb
Nothing on the usb
Nothing on the usb

Output from minicom while running the script:

Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyACM1, 19:41:01

Press CTRL-A Z for help on special keys             
                                                    
usb exists; blinking 2                              
usb exists                                          
Traceback (most recent call last):                  
  File "/main.py", line 36, in <module>
  File "/main.py", line 21, in write
TypeError: fAT
Traceback (most recent call last):AT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'AT' isn't defined
>>> ~x~

Can you try to communicate to your script using the Open Terminal Feature in OpenMV IDE? It’s under Tools->Open Terminal. It creates a terminal to talk to the camera.

Running connecting with the IDE terminal yields an “Exception: IDE interrupt” blocking my script from running still. I have tried adding

usb.setinterrupt(-1)

to no avail.

Additional point I forgot in the first post: if I leave nothing connected to camera I can tell from the blinks it has crashed too.

Do you have an H7 or an H7 plus? We just found a serious issue in the H7 firmware in regards to it being overclocked.

H7 R1. Can you elaborate at all on this bug? Is there an issue open already for it on github?

Could I push an earlier version of firmware to resolve this potentially?

There seems to be a bug in readline and readlines, please avoid using it, for now you can implement something like this:

while (usb.any()):
    print(usb.recv(1, timeout=100))

You should report a bug on github to keep track of this issue.