I'm trying upython on an ESP32-CAM, a board supposedly with 520k ram + 4Mb psram & 32Mb flash (with upython loaded it reports 2Mb ram & 1Mb flash available to the user).
I naively thought 2Mb free ram would solve my [Errno 12] ENOMEM problems from more resource constrained boards, sadly no. If I want to use urequests to upload a photo to a server I first have to camera.deinit() or urequests crashes with [Errno 12] ENOMEM.
If I want to use the camera after I've used requests it won't initialise (OSError: Camera Init Failed) & I can't deinit urequests to fix that issue.
Can someone explain why this is happening? The board still reports 2Mb of free ram if I try urequests without deinitialising the camera or try to initialise the camera after I've used urequests so I'm struggling to understand what resource I've run out of?
ESP32-CAM
Re: ESP32-CAM
I've tracked this down to https. If I use http for urequests uploads prior to using the camera the camera inits OK. It's only when I upload via https before hand that the camera won't init. So its prior ssl use that is preventing the camera initialising (http doesn't use ssl). How can I somehow clean out the ussl garbage after urequests? I tried gc.collect() but that never seems to work.
Re: ESP32-CAM
I tried changing the 38k .py file to a 13k .mpy file but the camera still won't initialise if urquests has previously used ssl. Got further info on why the camera can't initialise though
Looks like I'm still 32768-20992=12k short. Does anybody know why gc.collect() isn't cleaning up after ssl? Any tips on what else I could try?
I'm also very curious why running a .mpy in lieu of a .py yields the extra diagnostics on why the camera can't initialise. I don't understand why a precompiled file should behave differently when it comes to diagnostics output?
Code: Select all
E (14790) cam_hal: cam_dma_config(296): DMA buffer 32768 Byte malloc failed, the current largest free block:20992 Byte
E (14800) cam_hal: cam_config(364): cam_dma_config failed
I'm also very curious why running a .mpy in lieu of a .py yields the extra diagnostics on why the camera can't initialise. I don't understand why a precompiled file should behave differently when it comes to diagnostics output?