VCC-GND STM32F407VET6 dev board

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

VCC-GND STM32F407VET6 dev board

Post by mcauser » Thu Jan 12, 2017 6:12 am

So, I've purchased one of the STM32f407VET6 dev boards from a company called vcc-gnd with a goal to porting MicroPython to it.
I have a pyboard 1.0 with a STM32f405, which is in the same family, so it shouldn't be too hard to port across.

Image

Does anyone else have one of these boards?
Same provider also sells STM32F103C8T6 "Blue Pill" boards, which I am also interested in experimenting with.

Why not just get another pyboard? Because they are like $60-80 AUD incl. shipping and this board is only $11 USD with free shipping!
I'll run the risky code on the cheap board and if it breaks, no big deal. It's also a learning experience in the uncharted world of STM32.

https://www.aliexpress.com/item/STM32F4 ... 85751.html
$11 USD

The board I purchased was from TaoBao, and thanks to a Chinese-English translation error, I had to pay $15 in shipping... twice! Once from the supplier to their Chinese warehouse and again over to Australia. I'll stick to AliExpress now.
https://world.taobao.com/item/523361737493.htm
¥53 ($11 USD)

Specs:
STM32f407VET6 ARM Cortex M4
168MHz, 210 DMIPS / 1.25 DMIPS / MHz
1.8V - 3.6V operating voltage
25MHz system crystal (NX5032GA)
32.768KHz RTC crystal
AT24C08 I2C EEPROM 1024 Byte x 8, 400KHz
2.54mm pitch pins
JTAG/SWD header
512KByte Flash, 192 + 4 KByte SRAM
3x SPI, 3x USART, 2x UART, 2x I2S, 3x I2C
1x FSMC, 1x SDIO, 2x CAN
1x USB 2.0 FS / HS controller (with dedicated DMA)
1x USB HS ULPI (for external USB HS PHY)
Micro SD
1x 10/100 Ethernet MAC
1x 8 to 12-bit Parallel Camera interface
3x ADC (12-bit / 16-channel)
2x DAC (12-bit)
12x general timers, 2x advanced timers
RT9193-3.3V: 3.3V LDO voltage regulator, max current 300mA
Micro USB for power and comms
User LED (PB9)
2x DIP switch for bootloader selection
Reset button
2x18 side pins + 2x10 top pins + 1x4 debug pins

Modifications:
change HSE_VALUE from 8000000 to 25000000
change PLL_M from 8 to 25

So far I have a butchered version of 1.8.6 running, based on OLIMEX_E407 and STM32F4DISC.
Will keep you posted with my progress and make a PR once it's reasonably stable.

Is VCC_GND_STM32F407VET6 a reasonable board name in /stmhal/boards/?
Last edited by mcauser on Thu Jan 12, 2017 7:30 am, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: VCC-GND STM32F407VET6 dev board

Post by dhylands » Thu Jan 12, 2017 6:44 am

Looks like a nice little board. It's cheaper than I can buy the raw processor.

I've previously bought a few of the STMF103 boards to play with. They aren't big enough to run MicroPython on, but you can program them in C. If you're interested, I have a sample project here: https://github.com/dhylands/stm32-test that includes some files to build a simple LED blinker.

You'll find some more information (including how to flash a USB DFU bootloader onto the '103 here: https://github.com/dhylands/stm32-test/ ... 2F103-Mini

I'd probably simplify the board name to just VCC_GND_F407 (but that's just my personal preference).

User avatar
marfis
Posts: 215
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: VCC-GND STM32F407VET6 dev board

Post by marfis » Thu Jan 12, 2017 9:07 pm

Why not just get another pyboard?
yeah - well then at least support Damien with a couple of stickers:
https://www.adafruit.com/product/3270
;)

it's definetly a nice board. Although the seller seems to think it's a voltage regulator (???)

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: VCC-GND STM32F407VET6 dev board

Post by mcauser » Thu Jan 12, 2017 11:02 pm

AliExpress product listings are well known to be incomplete, incorrect or missing. It's best to find at least 3 vendors selling the same thing and average the descriptions :)

I'm more likely to send Damien, Paul and the team cold hard cash or bitcoins than to buy stickers from a 3rd party vendor.
I am supporting the team, with contributions, promotion and community engagement. And later, I'll most likely back their next kickstarter.

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: VCC-GND STM32F407VET6 dev board

Post by mcauser » Fri Jan 13, 2017 3:54 am

It Works!

Instructions for OS X:

Install packages
$ brew install stlink
$ brew cask install gcc-arm-embedded

Check if ST-LINK V2 device is found
(plug it into USB port)
$ st-info --probe
Found 1 stlink programmers

Connect ST-LINK V2 to VCC-GND STM32F407VET6 dev board
3.3V --- 3v3
SWDIO -- DIO
SWCLK -- SCK
GND ---- GND

Open two terminals, one for st-util and the other to compile and upload.

Open the first terminal and run
$ st-util
It should say "Listening at *:4242..."

Open the second terminal and run:
$ cd micropython
$ git remote add mcauser git@github.com:mcauser/micropython.git
$ git fetch mcauser
$ git checkout vcc-gnd-stm32f407
$ cd stmhal
$ make BOARD=VCC_GND_F407
$ arm-none-eabi-gdb build-VCC_GND_F407/firmware.elf

Inside gdb run:
(gdb) target extended localhost:4242
(gdb) load
(gdb) exit
LEDs will blink as the firmware is uploaded.

Switch back to the st-util terminal
Look for "Flash written and verified! jolly good!"
Ctrl+C to exit

Disconnect ST-LINK from USB
Disconnect ST-LINK from dev board (3V3,SWDIO,SWCLK,GND)

Run MicroPython on the board
Connect to the dev board using USB cable (make sure ST-LINK is disconnected to avoid blue smoke)
$ screen /dev/tty.usbmodem1422 115200
to exit: Ctrl+a Ctrl+\ y

Code: Select all

MicroPython v1.8.7-4-g51a4473-dirty on 2017-01-13; VCC-GND STM32F407 with STM32F407
Type "help()" for more information.
>>> 
WIN!

Code: Select all

>>> machine.info()
ID=30003500:06473332:32333338
S=168000000
H=168000000
P1=42000000
P2=84000000
_etext=80650e4
_sidata=80650e4
_sdata=20000000
_edata=20000164
_sbss=20000164
_ebss=200027fc
_estack=20020000
_ram_start=20000000
_heap_start=200027fc
_heap_end=2001c000
_ram_end=20020000
qstr:
  n_pool=0
  n_qstr=0
  n_str_data_bytes=0
  n_total_bytes=0
GC:
  102016 total
  432 : 101584
  1=14 2=5 m=3
LFS free: 86528 bytes

The AT24C08 EEPROM on I2C1
>>> i2c = machine.I2C(1)
>>> i2c.scan()
[80, 81, 82, 83]

Toggle blue led
>>> led = pyb.LED(1)
>>> led.on()
>>> led.off()

>>> import gc
>>> gc.mem_free()
97456
>>> gc.mem_alloc()
4640

>>> pyb.rng()
780383225

>>> pyb.millis()
1708543

>>> rtc = pyb.RTC()
>>> rtc.datetime((2017, 1, 13, 14, 45, 0, 0, 0))
>>> rtc.datetime()
(2017, 1, 13, 6, 5, 0, 1, 204)

>>> adc = pyb.ADC(pyb.Pin.board.PA1)
>>> adc.read()
Don't forget to eject the PYBFLASH USB device before unplugging.

Feedback welcome: https://github.com/micropython/micropython/pull/2788

lmamakos
Posts: 3
Joined: Sun Jan 22, 2017 6:37 am

Re: VCC-GND STM32F407VET6 dev board

Post by lmamakos » Sun Jan 22, 2017 7:18 am

I was just playing around with this a bit, and it seems to be working pretty well.

I did notice, however, that the first UART is needlessly unavailable. Turns out that the VCC-GND board apparently doesn't connect up power or ID pins to A9 and A10, thus freeing them up for use with UART1. So, uncomment these lines:

#define MICROPY_HW_UART1_TX (pin_A9) // PA9,PB6
#define MICROPY_HW_UART1_RX (pin_A10) // PA10,PB7

and comment (or delete) these at the bottom of the mpconfigboard.h file:

// USB config
// #define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
// #define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: VCC-GND STM32F407VET6 dev board

Post by loboris » Wed Jan 25, 2017 12:38 am

Many similar boards are now available on ebay for ~ 12 US$ with added 2MBytes SPI Flash, RTC Battery and more ...

http://www.ebay.com/sch/i.html?_odkw=ST ... t&_sacat=0

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: VCC-GND STM32F407VET6 dev board

Post by mcauser » Wed Jan 25, 2017 5:30 am

Most of which unbranded / clones / hard to find the manufacturer or documentation / inconsistently (re)sold from random shops.
I was focusing on the vcc-gnd branded ones, as they have around 20 boards in their range, a reliable shop and a reasonable number of sales.

Can't argue with $12 though! You can get STM32F103C8T6 boards for even cheaper, $1.70 USD.

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: VCC-GND STM32F407VET6 dev board

Post by loboris » Wed Jan 25, 2017 6:04 pm

There are even better boards with STM32F407ZET6 for ~13-17 US$ with optional external SDRAM (1 MByte IS62WV51216BLL, ~2-5 US$)
http://www.ebay.com/sch/i.html?_from=R4 ... T6&_sop=15
https://www.aliexpress.com/w/wholesale- ... 0125100625
https://www.aliexpress.com/w/wholesale- ... 0125100822

I'm not shure if MicroPython suppports external SDRAM :?: , but it would be fantastic to run MicroPython with more than 1MB of free RAM on 15-20 US$ board :D

Links to documentation for many of those boards can be found in this forum:
http://www.stm32duino.com/viewtopic.php?t=1369
Most interesting:
http://www.dragonwake.com/download/down ... T6_sch.pdf (STM32F407ZET6 schematic)
https://translate.google.com/translate? ... &sandbox=1
http://loboris.eu/STM32/STM32F407VET6_schematics.jpg (STM32F407VET6 schematic)

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: VCC-GND STM32F407VET6 dev board

Post by mcauser » Fri Feb 03, 2017 2:08 pm

You're right @lmamakos. Thanks for that. I added that to my vcc-gnd-stm32f407 branch. Also tested UARTs 1-6 and I2C 1-3. All working.

@loboris - I bought two of the black stm32f407s (with the coin cell in the corner). A VET6 and a ZET6. My next two board definitions. :D

Post Reply