GHI Electronics G30 Development 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.
Post Reply
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

GHI Electronics G30 Development Board

Post by dhylands » Sun Jul 24, 2016 5:58 am

I put together a board definition file for the GHI Electronics G30 Development board (aka G30DEV)
https://www.ghielectronics.com/catalog/product/555

It uses an STM32F401RET6 (84 MHz, 512K Flash, 96K RAM).

You can find the board definition files here: https://github.com/dhylands/G30DEV (as much as I've implemented so far).

I got the piezo speaker working - see this thread: http://forum.micropython.org/viewtopic.php?f=14&t=2172

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: GHI Electronics G30 Development Board

Post by jgriessen » Fri Jul 29, 2016 7:56 pm

Do all of the pyb libraries work with the F401RE -- as far as the pins defined?
Can I write such as:

Code: Select all

servo_pin = pyb.Pin.board.X1
?

I'll be turning on my G30 TH soon.
John Griessen blog.kitmatic.com

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

Re: GHI Electronics G30 Development Board

Post by dhylands » Fri Jul 29, 2016 8:38 pm

jgriessen wrote:Do all of the pyb libraries work with the F401RE -- as far as the pins defined?
Can I write such as:

Code: Select all

servo_pin = pyb.Pin.board.X1
All of the peripherals, like TIM, SPI, I2C, etc that exist (the 401 doesn't have CAN) work the same.

The pin names are different.

Lets take a look at the pyboard: https://github.com/micropython/micropyt ... 0/pins.csv
X1 maps to pin PA0 on the CPU, which corresponds to the pin labelled 'X1' on the board.

On the G30TH board, since labels printed on the board are the CPU pins, I used the pin names from the schematic when assigning the board pins: https://github.com/dhylands/G30HDR/blob/master/pins.csv

You can see this reflected on the board itself as well:

Code: Select all

MicroPython v1.8.2-42-g5a38694-dirty on 2016-07-29; G30TH with STM32F401CE
Type "help()" for more information.
>>> 
>>> dir(pyb.Pin.board)
['JP3', 'JP4', 'JP5', 'JP6', 'JP7', 'JP8', 'JP9', 'JP10', 'JP11', 'JP12', 'JP13', 'JP14', 'JP15', 'JP16', 'JP17', 'JP18', 'JP19', 'JP21', 'JP22', 'JP23', 'JP24', 'JP25', 'JP26', 'JP27', 'JP28', 'JP29', 'JP30', 'JP31', 'JP32', 'JP33', 'JP34', 'JP35', 'SD', 'SC', 'B1']
Now, having said that, if you want to add X1 you can create a mapping dict:

Code: Select all

>>> pyb.Pin.dict({'X1':  pyb.Pin('A0'), 'X2': pyb.Pin('A1')})
>>> pyb.Pin('X1')
Pin(Pin.cpu.A0, mode=Pin.IN)
>>> pyb.Pin('X2')
Pin(Pin.cpu.A1, mode=Pin.IN)
>>> pyb.Pin('X3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: pin 'X3' not a valid pin identifier
To figure out which functionality is on which pins (i.e. UART1), you really need to look at the mpconfigboard.h file:
https://github.com/dhylands/G30TH/blob/ ... figboard.h

and/or the alternate function file (which is extracted from the datasheet):
https://github.com/micropython/micropyt ... 401_af.csv

Note that those alternate functions cover all of the various chip sizes (48, 64, or 100 pin) so not all of the CPU pins will be present.

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: GHI Electronics G30 Development Board

Post by jgriessen » Fri Jul 29, 2016 9:16 pm

you really need to look at the mpconfigboard.h file: . . . and/or the alternate function file
Thanks for the explanation Dave. I'll just use the chip pin names and numbers without a mapping file for this lower pin count package since the alt names get used a lot as you choose which peripheral to enable.
John Griessen blog.kitmatic.com

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: GHI Electronics G30 Development Board

Post by jgriessen » Fri Jan 27, 2017 1:15 am

I noticed the G30TH board definition is still not part of the main repo. I'm making something similar to the g30th with different connectors and will be adding an sd card. What is a good way to handle that when making a new board definition?

Is it better to keep a git repo of your micropython/stmhal/boards/board-x separately, and copy it in to cross compile, or make a repo of micropython with it merged in and maintain that?

I'm not very experienced with versioning and don't want to get in over my head with version control complexity, so I was thinking separate. Until my board definition gets added to micropython, I guess there would be no merge conflicts at all, so either way could be good...
John Griessen blog.kitmatic.com

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

Re: GHI Electronics G30 Development Board

Post by dhylands » Fri Jan 27, 2017 1:24 am

I have a board definition for the G30TH over here:
https://github.com/dhylands/G30TH

Note that the G30TH doesn't have an on-board 3.3v regulator, so you'll need to provide that. I did up a blog post that shows how I did it:
http://blog.davehylands.com/2016/07/bri ... n-ghi.html

You can find all of the board definitions I've created which aren't part of the official repository here:
https://github.com/dhylands/wiki/wiki/M ... oard-files

As you may have noticed, I keep my board definitions in their own repositories. You can then just cd into the stmhal/boards directory and checkout your board definition.

To enable sdcard access compare the differences between the G30DEV board defintiion files and the G30TH files.
If you search for SDCARD in the G30DEV/mpconfigboard.h you'll find these 3 lines:

Code: Select all

// SD card detect switch
#define MICROPY_HW_SDCARD_DETECT_PIN        (pin_A6)
#define MICROPY_HW_SDCARD_DETECT_PULL       (GPIO_NOPULL)   // Board has external pullup
#define MICROPY_HW_SDCARD_DETECT_PRESENT    (0)
You'll need to make sure that the detect pin and the other SD card pins are defined in your pins.csv file (see the SD_xxx pins from G30DEV's pins.csv file)

Also check the mpconfigboard.mk to ensure you have the correct .ld file selected (based on your chip).

Post Reply