Differentiate between IDE & VCP connections

Discussion related to "under the hood" OpenMV topics.
phantom8
Posts: 5
Joined: Thu Jul 26, 2018 11:49 pm

Differentiate between IDE & VCP connections

Postby phantom8 » Wed Sep 19, 2018 2:56 am

In the python program, how to tell if the camera is connected to IDE or USBVCP? I tried to use USB_VCP.isconnected(), but it returns True even the cam is connected to IDE. During development and testing, my cam will normally connect to IDE. However, the cam will be connected to a linux box during production. I need a way to distinguish between these 2 cases.
User avatar
kwagyeman
Posts: 2461
Joined: Sun May 24, 2015 2:10 pm

Re: Differentiate between IDE & VCP connections

Postby kwagyeman » Wed Sep 19, 2018 11:30 am

Hi, um, you can't use the VCP port when the IDE is connected to the camera because the IDE uses that. I'd recommend using the hardware UART for testing purposes and then switch to the VCP port once you think your code is ready.
Nyamekye,
phantom8
Posts: 5
Joined: Thu Jul 26, 2018 11:49 pm

Re: Differentiate between IDE & VCP connections

Postby phantom8 » Wed Sep 19, 2018 9:30 pm

I fully understand that I can't use the VCP port when the IDE is connected to the camera. I'm not trying to connect the camera to IDE and use the VCP port at the same time.

All I am asking is there an API in the OpenMV library which can tell me if I'm currently connected to IDE or using VCP as a serial terminal? During development, the Camera will connect to a Mac running IDE. As for production, the camera will connect to a Linux box and communicate to a Java program via VCP. And the Camera will switch between these 2 environments very often. The handling of the Python program will be different in these 2 scenarios. I can modify the program each time when I switch environments, but this is not ideal. I would expect there is a way to tell which connection it's currently using programmatically.

As for the USB_VCP.isconnected() API in the OpenMV, why does it return "True" when the Python program is running under IDE? Is this a bug? My expected behaviour of this API is to return "True" when connected via VCP, and "False" when connected to IDE. If this API works, it will serve my purpose.
User avatar
kwagyeman
Posts: 2461
Joined: Sun May 24, 2015 2:10 pm

Re: Differentiate between IDE & VCP connections

Postby kwagyeman » Thu Sep 20, 2018 2:16 am

Mmm, it probably is a bug. Mostly related to the way our IDE connects to the cam. Please submit a bug request to our GitHub.
Nyamekye,
phantom8
Posts: 5
Joined: Thu Jul 26, 2018 11:49 pm

Re: Differentiate between IDE & VCP connections

Postby phantom8 » Thu Sep 20, 2018 6:00 am

I've submitted a bug report to Github. Besides the USB_VCP.isconnected() API, is there any other API that I can use to detect if the OpenMV cam is connected to IDE? If I'm not mistaken, the OpenMV cam connects to IDE with 921600 BPS. Is this the way the firmware detects if the IDE is connected by checking the baud rate? Is there any OpenMV API that I can use to check the USB VCP port baud rate?
User avatar
iabdalkader
Posts: 629
Joined: Sun May 24, 2015 3:53 pm

Re: Differentiate between IDE & VCP connections

Postby iabdalkader » Thu Sep 20, 2018 9:44 pm

Hi, I've added a new function for that (see github issue), it will be available in the next release.
phantom8
Posts: 5
Joined: Thu Jul 26, 2018 11:49 pm

Re: Differentiate between IDE & VCP connections

Postby phantom8 » Fri Sep 21, 2018 3:21 am

I've compiled the firmware and tested the new debug_mode_enabled() API. It's working perfectly. The technical support that you've provided for the product is incredible. Thank you so much! :)

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests