# OSError: 16 using Portenta H7 + vision shield

**URL:** <https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906>\
**Category:** Arduino Boards\
**Created:** [May 21, 2021, 7:40am UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906 "2021-05-21T07:40:29Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 21, 2021, 7:40am UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/1 "2021-05-21T07:40:29Z")

</div>

Hi there,

I created a TFLite model using Edge Impulse. I successfully loaded the model onto my new Portenta H7 (after loading OpenMV’s firmware successfully), and when I run the micropython script I see the board’s camera feed for a few seconds – until suddenly it gets stuck and I receive `OSError: 16`.

Any ideas what might be going on here?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 21, 2021, 2:42pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/2 "2021-05-21T14:42:22Z")

</div>

What line is throwing that error?

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 21, 2021, 2:53pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/3 "2021-05-21T14:53:41Z")

</div>

It’s a popup window, that’s all the window says with no further explanation. How might I go about getting a traceback for this error?

---

<div class="post-metadata">

**Author:** ![Balz-Heusler](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/balz-heusler/32/1564_2.png) [@Balz-Heusler](https://forums.openmv.io/u/Balz-Heusler)\
**Post date:** [May 22, 2021, 3:04pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/4 "2021-05-22T15:04:55Z")

</div>

Hello W. Agyeman

The error showed up during the implementation of the I2C interface. It was finally a Hardware problem with a bad connection. No it works.

Thanks for asking.

Mit freundlichen Grüssen

Kind Regards

Balz Heusler

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 22, 2021, 6:29pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/5 "2021-05-22T18:29:59Z")

</div>

I’m confused… you seem to be responding as if you opened this topic, but my problem still persists.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 22, 2021, 8:57pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/6 "2021-05-22T20:57:47Z")

</div>

I thought you were the same person. Please post the script + tflite file, which cam, firmware version and any other details and we’ll test it.

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 7:50pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/7 "2021-05-23T19:50:07Z")

</div>

Thanks for the reply!

- First of all, [here](https://drive.google.com/drive/folders/1v0yGFv22SaXuhtvFPQJRQ2HbpVDluWYh?usp=sharing) is a link to the requested files (as they were exported from Edge Impulse).

- I’m using an Arduino Portenta H7 with the LoRa Vision Shield.

- According to OpenMV my device’s firmware is 3.6.8.

Happy to provide any further details needed! Thank you.

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 7:54pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/8 "2021-05-23T19:54:01Z")

</div>

I’m now seeing that the error is being thrown at line 12, where the script attempts to access the labels.txt file. The file exists in the same folder as the script, so I’m not sure why it is having trouble finding it… (if that is the problem)

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 8:03pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/9 "2021-05-23T20:03:57Z")

</div>

I tried an additional test and received a different error:

Instead of trying to access labels.txt, I wrote in the labels as a list. The script managed to pass line 12 without issue.

But **now** it is getting stuck at line 21:  
` for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):`

Where it is throwing the following error:  
`OSError: The physical drive cannot work`

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 23, 2021, 9:42pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/10 "2021-05-23T21:42:04Z")

</div>

> [@avielbr](#):
>
> According to OpenMV my device’s firmware is 3.6.8.

Before I can test this you have to upgrade to the latest firmware first, 4.0.0 and then test it again and if the problem still persists let us know. (Please make sure to check the Erase filesystem box when upgrading the fw, if you use the internal flash storage).

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 9:46pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/11 "2021-05-23T21:46:15Z")

</div>

Hi, thanks. It automatically uploads the 3.6.8 when I click “Reset firmware to release version”. I’m happy to try and load a specific file – could you direct me to where I can find the 4.0.0 firmware file?

Edit: OpenCV is telling me that 3.6.8 is [latest]…

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 23, 2021, 9:48pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/12 "2021-05-23T21:48:59Z")

</div>

IDE resources are outdated, the latest release is here: [https://github.com/openmv/openmv/releases/download/v4.0.0/firmware\_v4.0.0.zip](https://github.com/openmv/openmv/releases/download/v4.0.0/firmware_v4.0.0.zip)  
Upload firmware/PORTENTA/firmware.bin

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 9:56pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/13 "2021-05-23T21:56:18Z")

</div>

Looks like I had foolishly ignored the message telling me to update the IDE’s resources.

I updated them and flashed 4.0.0 to my device (erasing filesystem as you suggested). I replaced the script and model and now I am receiving an error on line 5:  
`sensor.reset()`

Error:  
`OSError: Reset Failed`

(This is after multiple attempts including reuploading the firmware, reconnecting the device physically, restarting OpenMV…)

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 23, 2021, 9:57pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/14 "2021-05-23T21:57:46Z")

</div>

> [@avielbr](#):
>
> script and model and now I am receiving an error on line 5:  
> `sensor.reset()`
> 
> Error:  
> `OSError: Reset Failed`

Yes sometimes I get this too, it just needs a power cycle.

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 10:02pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/15 "2021-05-23T22:02:37Z")

</div>

Indeed!

Power cycled the device (unplugged and held down button for 30 sec) and it managed to run the script!

Thank you for your help thusfar – if you still have energy to help more, I’m getting a sort of “roll” effect on my camera buffer display… The image is smooth for 2 sec (or however long I define `sensor.skip_frames(time=...)` to be), but once the `while` loop starts, the image gets very choppy.

Have you run into this issue in the past?

EDIT: Example video available [here](https://drive.google.com/file/d/1jAm60DiMqeOdda3Juas6eRLjBWTewBrR/view?usp=sharing).

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 23, 2021, 10:12pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/16 "2021-05-23T22:12:27Z")

</div>

Yes I see the issue, looks related to double buffering that was recently implemented… for now you can just disable it with:

```python
sensor.set_framebuffers(1)

```

@kwagyeman You should see this.

---

<div class="post-metadata">

**Author:** ![avielbr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/avielbr/32/1621_2.png) [@avielbr](https://forums.openmv.io/u/avielbr)\
**Post date:** [May 23, 2021, 10:14pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/17 "2021-05-23T22:14:55Z")

</div>

Best support ever!

This fixed the problem. Thank you so much for all the help.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [May 23, 2021, 10:22pm UTC](https://forums.openmv.io/t/oserror-16-using-portenta-h7-vision-shield/5906/18 "2021-05-23T22:22:39Z")

</div>

I can also reproduce the bug on other cams likely memory issue we’ll work on fixing it for the next release. FWIW double buffering works (triple is broken):

```auto
sensor.set_framebuffers(2)

```
