Running program without the IDE - upload, reset, no-go

Discussion related to "under the hood" OpenMV topics.
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Running program without the IDE - upload, reset, no-go

Postby type11969 » Mon Oct 29, 2018 5:01 pm

Subject says it all. I've uploaded my script, I've confirmed that the file has been updated on the OpenMV side, I've reset the camera and nothing happens. My program works without issue when running through the IDE. I've taken a look through the threads on this topic, but all seemed to have been resolved by following the upload/reset instructions. Any ideas what might be wrong?

-Chris
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Mon Oct 29, 2018 5:11 pm

I confirmed the issue with a very simple file:

Code: Select all

# Untitled - By: cphelan - Mon Oct 29 2018

import sensor, image, time, pyb
from pyb import delay

uart = pyb.UART(1, 115200, timeout_char = 1000) #pin 0 = RX, pin 1 = TX

while(True):
    uart.write ("test")
    delay(1000)
What do I need to do to get this running standalone?
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: Running program without the IDE - upload, reset, no-go

Postby iabdalkader » Mon Oct 29, 2018 5:41 pm

Tools->Save open script to OpenMV cam.
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Mon Oct 29, 2018 8:19 pm

Thanks, but I've already done this. My quote above "I've uploaded my script, I've confirmed that the file has been updated on the OpenMV side, I've reset the camera and nothing happens." means:

Tools->Save open script to OpenMV cam
Tools->Reset OpenMV cam
Navigate to the USB drive hosted by the OpenMV cam and confirm that the file on the drive has been updated (check date)

Sorry that this wasn't clear. What am I doing wrong?
User avatar
kwagyeman
Posts: 2401
Joined: Sun May 24, 2015 2:10 pm

Re: Running program without the IDE - upload, reset, no-go

Postby kwagyeman » Mon Oct 29, 2018 11:31 pm

Hi, we don't support UART1.

http://docs.openmv.io/openmvcam/quickre ... serial-bus

Please move it to UART 3.
Nyamekye,
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Tue Oct 30, 2018 8:27 am

Thanks, but I'm using an OpenMV Cam M7. If I follow that link, it states the following:

UART 3 RX -> P5 (PB11)
UART 3 TX -> P4 (PB10)
UART 1 RX -> P0 (PB15) (OpenMV Cam M7 Only)
UART 1 TX -> P1 (PB14) (OpenMV Cam M7 Only)

Which is further supported by the pinout provided on this page:

https://cdn.shopify.com/s/files/1/0803/ ... 0464094715

Obviously I feel a bit silly telling you this as one of the creators. So, given this documentation, can I not use UART1?

Furthermore, I've tested/confirmed that UART1 works, at least when using the IDE.

Please let me know when you have a moment

Thanks,

Chris
westonchambers
Posts: 5
Joined: Thu Oct 11, 2018 2:07 pm

Re: Running program without the IDE - upload, reset, no-go

Postby westonchambers » Tue Oct 30, 2018 11:01 am

I've actually been having a very similar problem.
User avatar
kwagyeman
Posts: 2401
Joined: Sun May 24, 2015 2:10 pm

Re: Running program without the IDE - upload, reset, no-go

Postby kwagyeman » Tue Oct 30, 2018 12:08 pm

Hmmm, this is a valid problem. Um, Ibrahim can you figure out what's wrong?

...

Please note that the OpenMV Cam is kinda like a giant open-source feature creep software system. The bugs are in the system because we keep adding functionality and releasing firmware updates... and then when we update MicroPython things break.
Nyamekye,
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: Running program without the IDE - upload, reset, no-go

Postby iabdalkader » Tue Oct 30, 2018 12:09 pm

I'll look into it, we're about to do a new firmware release anyway, if there's a bug it will be fixed very soon.
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Tue Oct 30, 2018 1:02 pm

Thanks guys, really appreciate it! Some clarification questions:

1) Is it okay to proceed with using UART1?
2) Is standalone operation impacted because I am using UART1? In other words, if I shift to UART3, do you expect that standalone operation will begin functioning? Note that I will independently test with some simple program - flashing an LED or something similar - on my side shortly.
3) When do you expect to release new firmware solving this standalone bug? I'm using the OpenMV cam in a proof-of-concept device that needs to operate in a standalone manner, so given the answer to this, the above, and my schedule, I will need to figure out the best way to proceed.

-Chris
User avatar
kwagyeman
Posts: 2401
Joined: Sun May 24, 2015 2:10 pm

Re: Running program without the IDE - upload, reset, no-go

Postby kwagyeman » Wed Oct 31, 2018 1:29 am

Use UART3 if possible. UART1 might have been tested once during an MP upgrade and then ignored afterwards. UART3 is the only one I have code that I know works when in a script by itself.

Also, keep in mind that writes to the embedded file system sometimes are delayed unless you are using a flash card. This is because all OSes ABSOLUTELY REQUIRE you to safety unmount the OpenMV Cam after you write to it's internal flash. I put some code into OpenMV IDE that tries to make sure things get flushed to the OpenMV Cam when you reset the camera... however, they only sometimes work.

(For the uninitiated... SD cards are FAT16/32 devices which all OSes flush writes to immediately. However, our internal upyFlash device on the OpenMV Cam when there's no SD card is FAT12 which all OSes buffer writes on. FAT12 is decided by the disk size being smaller than 16 MB. So, it's impossible to fix without having 16MB of flash. Due to the file-allocation-table requirement too you can't fake 16MB either).
Nyamekye,
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: Running program without the IDE - upload, reset, no-go

Postby iabdalkader » Wed Oct 31, 2018 11:14 am

Hi, this script is running fine standalone (in main.py). Seems to be an issue with the IDE not flushing the writes before removing the disk. Please make sure the main.py is actually written (not an empty file) and manually remove/umount the disk until this issue is fixed.

EDIT: You can use UART1 or UART3, they both work.
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Wed Oct 31, 2018 1:29 pm

Update:

I was able to demonstrate that an OpenMV cam disconnected from my custom adapter PCB was able to run standalone, even using UART1. I then proceeded to swap the header orientation on this OpenMV cam (so I could connect to my custom PCB), and somehow managed to kill that OpenMV cam in the process. I attempted to reflash the firmware on that cam, but it is not recognized by the IDE - not sure what happened.

Upon plugging back in the OpenMV cam which was already connected to my custom adapter PCB, the IDE started re-flashing the firmware. Oops. But, once the re-flash was complete, it could run my basic LED flash/hello world program.

So, reflashing the OpenMV cam seems to have resolved the standalone operation issue. But the firmware version is still 3.0.0 (as it was before).

I still need to confirm that I can run my actual program standalone - but this is progress nonetheless.

Any ideas what may have caused this issue?

-Chris
User avatar
kwagyeman
Posts: 2401
Joined: Sun May 24, 2015 2:10 pm

Re: Running program without the IDE - upload, reset, no-go

Postby kwagyeman » Wed Oct 31, 2018 2:49 pm

Mmm, could be some type of static shock might have broken something. I don't have enough of a picture to say what's wrong.
Nyamekye,
type11969
Posts: 30
Joined: Tue Aug 14, 2018 1:03 pm

Re: Running program without the IDE - upload, reset, no-go

Postby type11969 » Wed Oct 31, 2018 8:09 pm

Sorry, by issue I was more curious about why re-flashing the firmware enabled standalone operation. I've written off the other OpenMV cam and ordered another - I'm sure that issue was due to user error.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests