what version of MicroPython is it?

Discussion related to "under the hood" OpenMV topics.
Capstan
Posts: 21
Joined: Tue Nov 12, 2019 11:04 am

what version of MicroPython is it?

Postby Capstan » Mon Dec 09, 2019 6:40 pm

I'm trying to read data in from a json file and ensure that it is string type. In the official docs the conversion would be done like so;

https://docs.micropython.org/en/latest/ ... s.html#str

Code: Select all

print(str(b'abc', encoding='utf8'))
On the cam that code results in;
"NotImplementedError: keyword argument(s) not yet implemented - use normal args instead"
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: what version of MicroPython is it?

Postby iabdalkader » Mon Dec 09, 2019 7:46 pm

1.11 with some upstream patches.
Capstan
Posts: 21
Joined: Tue Nov 12, 2019 11:04 am

Re: what version of MicroPython is it?

Postby Capstan » Wed Dec 11, 2019 4:23 pm

I see that the _thread module is present in the FW. I have some code from elsewhere that uses threads and trying to port it, but the thread function isn't being called. Is _thread fully implemented in the H7?

Documentation is here;
https://docs.python.org/3.5/library/_th ... le-_thread

When I call;
_thread.start_new_thread(function, args[, kwargs])

... it executes without complaint but the function doesn't appear to run.
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: what version of MicroPython is it?

Postby iabdalkader » Wed Dec 11, 2019 5:21 pm

No threading is not supported, you're going to have to use timer callbacks.
Capstan
Posts: 21
Joined: Tue Nov 12, 2019 11:04 am

Re: what version of MicroPython is it?

Postby Capstan » Thu Dec 12, 2019 11:42 am

I'm looking at your timer_control.py example.

Code: Select all

def tick(timer):            
    blue_led.toggle()
    
tim = Timer(4, freq=1)      # create a timer object using timer 4 - trigger at 1Hz
tim.callback(tick)          # set the callback to our tick function
I assume timer 4 is a hardware timer? How many timers are there and what are the available numbers?
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: what version of MicroPython is it?

Postby iabdalkader » Thu Dec 12, 2019 3:28 pm

Hi, you should be able to use all the timers (up to 17 on the H7) except 1,3,4,5, 6 which are reserved for other stuff. I was just double checking timers on the H7 before I reply and found out that not all of them are working as expected, I'm going to fix this in the next couple of days and send patches to micropython. For now you can use tim 2, 12, 14 (and 4 and 6 if you must) I'll keep you posted on this.
Capstan
Posts: 21
Joined: Tue Nov 12, 2019 11:04 am

Re: what version of MicroPython is it?

Postby Capstan » Thu Dec 12, 2019 5:06 pm

Interesting! Thanks for the info. I am thinking I will write a general-purpose wrapper class that keeps track of what timers are available so other code doesn't have to know.
User avatar
iabdalkader
Posts: 1214
Joined: Sun May 24, 2015 3:53 pm

Re: what version of MicroPython is it?

Postby iabdalkader » Tue Dec 17, 2019 1:41 pm

Hi, the issues with timers have been fixed, if you update to the latest firmware on github you can use TIM2, TIM3 and TIM7->TIM14 on the F7/OMV3 and TIM2,TIM3,TIM7,TIM8 and TIM12->TIM17 on the H7/OMV4.
Capstan
Posts: 21
Joined: Tue Nov 12, 2019 11:04 am

Re: what version of MicroPython is it?

Postby Capstan » Tue Dec 17, 2019 4:37 pm

Fast work, you are the man! I downloaded the release zip and extracted, not sure which directory to use. OPENMV4? OPENMV4R?

Nevermind, found in another thread;
"The OPENMV4/firmware.bin is the right file to use."

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests