development enviroment used by OpenMV

Discussion related to "under the hood" OpenMV topics.
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

development enviroment used by OpenMV

Postby OutoftheBOTS » Tue Jun 19, 2018 11:48 pm

I have started to work on a software I2C slave driven by interrupts on the SDA and SCL lines. At the moment I have been playing with this dev board http://wiki.stm32duino.com/index.php?title=Blue_Pill that uses a STM32F103C8 chip and just programming with Ardunio IDE but not using any of the Ardunio high level function but rather writing to the registers to control the pins and interrupts.

At some stage I will need to port it to the same chip as OpenMV uses and also a compatible programming environment. What programming environment do you use to write the firmware with??
User avatar
kwagyeman
Posts: 2045
Joined: Sun May 24, 2015 2:10 pm

Re: development enviroment used by OpenMV

Postby kwagyeman » Wed Jun 20, 2018 1:13 am

Nyamekye,
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: development enviroment used by OpenMV

Postby OutoftheBOTS » Wed Jun 27, 2018 12:46 am

I have got a basic software I2C slave working on my STM32F1 dev board. It uses a interrupt on the SDA line to detect the start of a transmission from master and interrupt the main program.

It doesn't have a timeout watch dog so this needs to be added still.
Also at the moment the master can only read or write 1 byte per transmission atm so I still need to add doing larger tansmissions

It shouldn't require much modification to be able to add it to the STM32F7 or STM32H7 see https://github.com/OutOfTheBots/I2C_Slave-STM32f10x
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: development enviroment used by OpenMV

Postby OutoftheBOTS » Thu Jun 28, 2018 12:31 am

OK I have my I2C slave now that master can read or write up to 256 bytes in 1 transmission, I have also made a timeout on it so that it can't get stuck and will always return to main program if stuck in a loop.

updated code here https://github.com/OutOfTheBots/I2C_Slave-STM32f10x
User avatar
kwagyeman
Posts: 2045
Joined: Sun May 24, 2015 2:10 pm

Re: development enviroment used by OpenMV

Postby kwagyeman » Thu Jun 28, 2018 11:49 am

Cool, what are the mods to do this? Do you think you can sumbit a PR to MicroPython to enable this functionality for everyone?

Um, so, the machine module doesn't use the hardware I2C bus but instead does I2C using software. So, it should be possible to modify that module to work using an external interrupt and your code.

See it here:

https://github.com/openmv/micropython/b ... hine_i2c.c

Maybe only minimal changes to the C code need to be made and then the rest can be in python.
Nyamekye,
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: development enviroment used by OpenMV

Postby OutoftheBOTS » Thu Jun 28, 2018 5:16 pm

I will have the read the differences between registers for the STM32F1, STM32F4, STMF7 and STMH7 as I think for there might be some differences.
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: development enviroment used by OpenMV

Postby OutoftheBOTS » Thu Jun 28, 2018 6:18 pm

Looking at the code it seems atm that because the machine.I2C is a software driver that any pin can used this is also inline with the docs see http://docs.openmv.io/library/machine.I2C.html.

For me to create the interrupt I will need the SDA pin to be set. I see your using Port B pin 11 for your SDA2

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests