Problem with SD card on RT1062

Hello, I have a problem with the SD card.
The documentation states that if you insert an SD card into the slot, it will replace the internal flash memory of the camera.
I insert an SD card, but the camera is also detected as a 4 MB flash drive and only after resetting via IDE it connect as an SD card.
Also when powered by battery the camera does not start from the SD card.

Hi, when the camera is plugged into the PC does the SD card appear instead of the internal flash? If not, then the camera is not recognizing the card. You may need to reformat it using FAT32.

When connecting the camera, its internal memory is displayed, but if I reset it via IDE, the SD card is displayed

im having the same problem, i formatted using ms-dos FAT 32 and still the camera is not recognizing the card. (Before it was) But as i was trying the record video and write to the sd card it stopped working, using this code

# MJPEG Video Recording Example (4 Minutes)


import sensor
import time
import mjpeg
import machine

# Initialize sensor
sensor.reset()
sensor.set_pixformat(sensor.RGB565)  # Set pixel format to RGB565
sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
sensor.skip_frames(time=2000)       # Wait for settings to stabilize

led = machine.LED("LED_RED")
led.on()

# Create MJPEG file
m = mjpeg.Mjpeg("test5.mjpeg")

# Record for exactly 4 minutes (240 seconds)
record_duration_ms = 240_000  # 60 seconds in milliseconds
start_time = time.ticks_ms()
frame_count = 0
clock = time.clock()

while time.ticks_diff(time.ticks_ms(), start_time) < record_duration_ms:
    clock.tick()
    m.add_frame(sensor.snapshot())
    frame_count += 1
    # Print FPS every 100 frames to reduce serial overhead
    if frame_count % 100 == 0:
        print("Frame", frame_count, "FPS:", clock.fps())

m.close()
led.off()

print(f"Recorded {frame_count} frames in {time.ticks_diff(time.ticks_ms(), start_time)/1000} seconds")
raise Exception("Please reset the camera to see the new file.")

Hi, it’s possible to corrupt the FAT partition very easily if you remove power while recording. If this happens you need to reformat the card and then try again.

already tried this several times… what if i try by formating the internal memory of the camera ?

Does it connect to the IDE? If so, then I don’t see that helping. Does the card work with the PC?

Note that I’ve never seen an SD card fail with the RT1062.

I was getting some weird beahvior the first time I ran the script, but, after a power cycle and running a few of the other image writer scripts everything worked smoothly.

# MJPEG Video Recording Example (4 Minutes)


import sensor
import time
import mjpeg
import machine

# Initialize sensor
sensor.reset()
sensor.set_pixformat(sensor.JPEG)  # Set pixel format to RGB565
sensor.set_framesize(sensor.VGA)   # Set frame size to QVGA (320x240)
sensor.skip_frames(time=2000)       # Wait for settings to stabilize

led = machine.LED("LED_RED")
led.on()

# Create MJPEG file
m = mjpeg.Mjpeg("test5.mjpeg")

# Record for exactly 4 minutes (240 seconds)
record_duration_ms = 240_000  # 60 seconds in milliseconds
start_time = time.ticks_ms()
frame_count = 0
clock = time.clock()

while time.ticks_diff(time.ticks_ms(), start_time) < record_duration_ms:
    clock.tick()
    m.write(sensor.snapshot())
    frame_count += 1
    # Print FPS every 100 frames to reduce serial overhead
    if frame_count % 100 == 0:
        print("Frame", frame_count, "FPS:", clock.fps())

m.close()
led.off()

print(f"Recorded {frame_count} frames in {time.ticks_diff(time.ticks_ms(), start_time)/1000} seconds")
raise Exception("Please reset the camera to see the new file.")

I put the camera into JPEG mode to ease the processor load. The RT1062 doesn’t have a hardware jpeg compressor. So, you should avoid using RGB565 for video record.

Anyway, after running the script and recording 350MB of video for 4 minutes, I then did tools->reset openmv cam, then after the reset I copied the video to my desktop and I was able to view it fine.

I have a PNY 64 GB Elite microsdxc uhs1.

1 Like

Note that we use exFAT not FAT32, that might be the issue.

1 Like

Will try to replicate, thanks for the help, will keep you posted

My rt1062 is not recognizing my sdcard(which before it did) including after formatting.
Did you saved main.py into sdcard or internal ?

PD: After clicking on Reset MV… on OpenMV IDE, it recognized the sdcard somehow… I’m testing the new script.
|I get this error

Traceback (most recent call last):
File “”, line 29, in
OSError: Assertion failed
OSError:
OpenMV v4.6.20; MicroPython v1.24.62; OpenMV IMXRT1060 with MIMXRT1062DVJ6A
Type “help()” for more information.

when running the main.py code you modified from the sdcard (connected to my pc{mac})

Changed the name of the file to test6.mjpeg (since test5 was already created with 0kb ) and now it worked, executing usb connected, will test with power only after this)

1 Like

I was testing from the IDE. I didn’t save main.py on the SD card.

Note, if the SD card is not being detected and the script is running from the internal flash you’re going to get a lot of crazy issues as the internal flash is 4MB. This will instantly run out of space and cause issues with the system.

Can you do this. Please erase any script from the SD card. Then power cycle the camera, and then run the script from the IDE after verifying the SD card appears as a mounted device on the PC.

What you mean by “power cycle the camera”?

Unplug and replug it into USB.

However, it appears our responses overlapped. It looks like you got it working.

Nop, its not, after doing the power cycle, my pc only detects internal flash. But if I go into the IDE, Tools > Reset Open MV Cam, then my pc{mac} detects the sdcard and i can execute a script from the sdcard if its stored there although when it ends I don’t know if i didnt gave much time to write the video to the sdcard or what but it didnt stored the file (appeared with 0 kb)

Live debugged the issue with the customer. His SD card doesn’t mount on power on, but resetting the camera causes it to mount. This means the SD card is not ready to enumerate after 1 second when the main firmware is booting. Suggest picking a different SD card.

Is it possible to simulate the function of Tools>Reset OpenMV Cam of the IDE, so I add this to the /flash/main.py so it will mount the sdcard and then execute a record.py script from the sdcard ?

Yes, just do machine.reset()

machine — functions related to the hardware — MicroPython 1.25 documentation in the script.

1 Like