STM32F407VET6 Development Board Cortex-M4

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Sniper
Posts: 21
Joined: Mon Jan 06, 2020 2:32 pm

STM32F407VET6 Development Board Cortex-M4

Post by Sniper » Mon Feb 10, 2020 11:26 pm

Hi guys,
I am new here and today i got my STM32F407VET6 Development Board Cortex-M4.
My OS is Manjaro and i have flashed the board in DFU mode.
Is it possible to use Pycharm IDE for writing the code in it?
I have Debugging tools here at home, but as far as i know Pycharm has no option for send the code trough a debugging tool via USB.
So if i am not wrong i have to save the code on to a sd card and place it on the board? Right?
Is there any IDE for this MicroPython that uses a external debugging tool or a programming board to burn the code on to the chip like Arduino and other IDEs out there.
My most important question is, okey i have got this board now, how and where do i start?
this is the link to my board.
https://github.com/mcauser/BLACK_F407VE

User avatar
jimmo
Posts: 1139
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: STM32F407VET6 Development Board Cortex-M4

Post by jimmo » Tue Feb 11, 2020 10:10 pm

You only need to do the DFU flash of the MicroPython firmware once.

From now on you just need to manage Python files on the filesystem, which you can do either with the command line tools (pyboard.py, rshell, etc), or with a MicroPython aware IDE like Thonny or uPyCraft.

http://docs.micropython.org/en/latest/r ... rd.py.html

Sniper
Posts: 21
Joined: Mon Jan 06, 2020 2:32 pm

Re: STM32F407VET6 Development Board Cortex-M4

Post by Sniper » Tue Feb 11, 2020 11:13 pm

jimmo wrote:
Tue Feb 11, 2020 10:10 pm
You only need to do the DFU flash of the MicroPython firmware once.

From now on you just need to manage Python files on the filesystem, which you can do either with the command line tools (pyboard.py, rshell, etc), or with a MicroPython aware IDE like Thonny or uPyCraft.

http://docs.micropython.org/en/latest/r ... rd.py.html
Thank you for your reply,
How do i know the Pins? there is PA pins, PC pins, PO pins, i can only see Pin in the code. how do i give the exact pin? example below

Code: Select all

relay = Pin(5, Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

User avatar
jimmo
Posts: 1139
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: STM32F407VET6 Development Board Cortex-M4

Post by jimmo » Wed Feb 12, 2020 1:34 am

If it's the same board as the photo then they're labelled with the CPU names (i.e. PA0, etc).

Code: Select all

p = machine.Pin('PA0', ...)

or

p = machine.Pin.cpu.PA0
p.init(...)

Sniper
Posts: 21
Joined: Mon Jan 06, 2020 2:32 pm

Re: STM32F407VET6 Development Board Cortex-M4

Post by Sniper » Wed Feb 12, 2020 11:53 am

jimmo wrote:
Wed Feb 12, 2020 1:34 am
If it's the same board as the photo then they're labelled with the CPU names (i.e. PA0, etc).

Code: Select all

p = machine.Pin('PA0', ...)

or

p = machine.Pin.cpu.PA0
p.init(...)
i dont know if this looks right, but i did this in main.py?

Code: Select all

# Relay Board

# Relay Nr.1

from machine import Pin
import time
p = machine.Pin.cpu.PE0
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.2
import time
p = machine.Pin.cpu.PE1
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.3
import time
p = machine.Pin.cpu.PE2
p.init(...)
relay = Pin(3, Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.4
import time
p = machine.Pin.cpu.PE3
p.init(...)
relay = Pin(4, Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.5
import time

p = machine.Pin.cpu.PE4
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.6
import time
p = machine.Pin.cpu.PE5
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.7
import time
p = machine.Pin.cpu.PE6
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.8
import time
p = machine.Pin.cpu.PE7
p.init(...)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on


Sniper
Posts: 21
Joined: Mon Jan 06, 2020 2:32 pm

Re: STM32F407VET6 Development Board Cortex-M4

Post by Sniper » Wed Feb 12, 2020 11:55 am

jimmo wrote:
Wed Feb 12, 2020 1:34 am
If it's the same board as the photo then they're labelled with the CPU names (i.e. PA0, etc).

Code: Select all

p = machine.Pin('PA0', ...)

or

p = machine.Pin.cpu.PA0
p.init(...)
this is from my boot.py file

Code: Select all

# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.country('US') # ISO 3166-1 Alpha-2 code, eg US, GB, DE, AU
#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('VCP+MSC') # act as a serial and a storage device
#pyb.usb_mode('VCP+HID') # act as a serial device and a mouse


User avatar
jimmo
Posts: 1139
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: STM32F407VET6 Development Board Cortex-M4

Post by jimmo » Wed Feb 12, 2020 9:22 pm

The ... in p.init(...) was supposed to be where you put the other arguments, like mode and pull.

i.e.

Code: Select all

p.init(mode=Pin.OUT)

Sniper
Posts: 21
Joined: Mon Jan 06, 2020 2:32 pm

Re: STM32F407VET6 Development Board Cortex-M4

Post by Sniper » Wed Feb 12, 2020 11:56 pm

jimmo wrote:
Wed Feb 12, 2020 9:22 pm
The ... in p.init(...) was supposed to be where you put the other arguments, like mode and pull.

i.e.

Code: Select all

p.init(mode=Pin.OUT)
I cant thank you enough Jimmo, you have thought me more over one night then i learned over 6 months from Arduino!
Now my code looks like this. is there any example codes for micropython? By the way doas any sesnor or any module work with this boards or do i need specific brand and typ?

Code: Select all

# Relay Nr.1

from machine import Pin
import time
p = machine.Pin.cpu.PE0
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.2

p = machine.Pin.cpu.PE1
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.3

p = machine.Pin.cpu.PE2
p.init(mode=Pin.OUT)
relay = Pin(3, Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.4

p = machine.Pin.cpu.PE3
p.init(mode=Pin.OUT)
relay = Pin(4, Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.5

p = machine.Pin.cpu.PE4
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.6

p = machine.Pin.cpu.PE5
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.7

p = machine.Pin.cpu.PE6
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

# Relay Nr.8

p = machine.Pin.cpu.PE7
p.init(mode=Pin.OUT)
relay.value(0) # to switch it off
time.sleep(2)
relay.value(1) # to switch it on

Post Reply