OpenMV N6: Problem with VL53L9 and Wifi Interface

I’ve written a driver for the VL53L9 time-of-flight; I added a i3c driver + the module to interact with the sensor. The code I’ve written is based on the STM official libraries.

Everything works well unless I activate the wifi chip and use a socket communication: in this cases, the cam crashes!! It may be a memory leak but I suspect that it could be a hardware conflict. Please note that I’ve disabled I3C DMA and interrupts.

May you suggest what to check and/or if there may be hardware conflicts with the wifi chip?

Thanks!

Here are my connections:

P0 → TOF INTR

P1 → TOF XSHUT

P4 → I3C2 SCL

P5 → I3C2 SDA

P7 → TOF AP_CLK

Hi, this isn’t enough info for me to debug this for you. Those pins have nothing to do with the CY4343 WiFi chip onboard the N6.

Like, how did you modify the firmware? Typically, the issue you might be having is that there are blocking I/O calls in your code that don’t service events. This will cause a crash. You need to call these functions when doing blocking operations:

// Handles any pending MicroPython events without waiting for an interrupt or event.
void mp_event_handle_nowait(void);

// Handles any pending MicroPython events and then suspends execution until the
// next interrupt or event.
//
// Note: on "tickless" ports this can suspend execution for a long time,
// don't call unless you know an interrupt is coming to continue execution.
// On "ticked" ports it may return early due to the tick interrupt.
void mp_event_wait_indefinite(void);

// Handle any pending MicroPython events and then suspends execution until the
// next interrupt or event, or until timeout_ms milliseconds have elapsed.
//
// On "ticked" ports it may return early due to the tick interrupt.
void mp_event_wait_ms(mp_uint_t timeout_ms);

Hello,

thank you very much for the suggestion!! Indeed it was a problem related to the blocking call waiting for the frame from the TOF. I included the call to mp_event_handle_nowait() and now everything works fine!!