kendryte / canmv

Other
58 stars 21 forks source link

Code stops working after few seconds on Maix M1 Dock #37

Open narduzzi opened 1 year ago

narduzzi commented 1 year ago

Hello,

I am tying to run the hello_world.py scripts but it crashes after a few seconds of running.

# Hello World Example
#
# Welcome to the CanMV IDE! Click on the green run arrow button below to run the script!

import sensor, image, time, lcd

lcd.init()                          # Init lcd display
lcd.clear(lcd.RED)                  # Clear lcd screen.

# sensor.reset(dual_buff=True) # improve fps
sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
#sensor.skip_frames(time = 2000)     # Wait for settings take effect.
#clock = time.clock()                # Create a clock object to track the FPS.

while(True):
   #clock.tick()                    # Update the FPS clock.
    img = sensor.snapshot()         # Take a picture and return the image.
    lcd.display(img)                # Display image on lcd.
    #print(clock.fps())              # Note: CanMV Cam runs about half as fast when connected
                                    # to the IDE. The FPS should increase once disconnected.

To Reproduce Steps to reproduce the behavior:

  1. Build firmware from kpu/featwith nncase 1.8.0 support for Maix M1 Dock (using project canmv_dock).
  2. Flash Micropython v1.0.5-5-ge1b2766-dirty on 2023-05-24; CanMV_Board with kendryte-k210
  3. Connect to IDE
  4. Run hello_world.pyscript. Output is:
    init i2c:2 freq:100000
    [CANMV]: find ov2640
    [CANMV]: find ov sensor
    ...crash

What could be the source of the problem? Not sure of it, but it seems related to the data transfer in the IDE. The code following code works:

import sensor, image, time, lcd

lcd.init()                          # Init lcd display
lcd.clear(lcd.RED)                  # Clear lcd screen.
sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
time.sleep(2)

while(True):
    print(0)
    time.sleep(0.2) # removing this line makes the code crash.

Configuration

narduzzi commented 1 year ago

The error seems to originate from the IDE as the code continues to run on the chip.

kendryte747 commented 1 year ago

Update IDE to the lastest version.

narduzzi commented 1 year ago

Hi @kendryte747, I have updated my IDE to the latest release (Commit: v2.9.2-2-0-g132467a), but the bug is not solved. Is it originating from the editor of from the firmware?

kendryte747 commented 1 year ago

Hi @kendryte747, I have updated my IDE to the latest release (Commit: v2.9.2-2-0-g132467a), but the bug is not solved. Is it originating from the editor of from the firmware?

Disable framebuffer dump can run continuously?