stm32 F401RE all pin

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
chipxx
Posts: 14
Joined: Mon Oct 21, 2019 8:55 am

stm32 F401RE all pin

Post by chipxx » Sat Nov 16, 2019 8:25 pm

Hello everyone, on the board F401RE core, is it possible to use in addition to the pinout of arduino also the pins of the board?
THX chippx

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

Re: stm32 F401RE all pin

Post by dhylands » Sat Nov 16, 2019 8:39 pm

You should be able to use all of the pins. Are you referring to the NUCLEO_F401RE board?

The pins.csv file: https://github.com/micropython/micropyt ... E/pins.csv defines the mapping between board pins and CPU pins. The first column defines the board pin name, and the second column defines the CPU pin names.

You can access the board pins using pyb.Pin.board.BOARD_PIN_NAME (or machine.Pin.board.BOARD_PIN_NAME) and you can access the CPU pins by using pyb.Pin.cpu.CPU_PIN_NAME (also in machine).

If you pass a string to the Pin constructor it will search the board pins first, and then search the machine pins.

chipxx
Posts: 14
Joined: Mon Oct 21, 2019 8:55 am

Re: stm32 F401RE all pin

Post by chipxx » Sat Nov 16, 2019 9:36 pm

Excuse me, does .pyb, which is part of the pyboard with the use of the board with Arduino, have anything to do with it?
Maybe I expressed myself wrongly...

chipxx

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

Re: stm32 F401RE all pi

Post by dhylands » Sat Nov 16, 2019 9:49 pm

I don't understand what you're asking. The pyb module is available on the pyboard. Using the machine module it probably preferred, since it's available on most of the boards.

This is the documentation for pyb.Pin: http://docs.micropython.org/en/latest/l ... b.Pin.html and this is the documentation for machine.Pin: http://docs.micropython.org/en/latest/l ... e.Pin.html

The "Arduino" pins have names like A0, D0, and the other pins have names like PA3.

For example, the Arduino pin A3 maps to pin PB0. This means that the following are all equivalent:

pyb.Pin.board.A3, pyb.Pin.cpu.B0, pyb.Pin.board.PB0

The board pins are named exactly as presented in the pins.csv file. The CPU pins have the leading P stripped off. You can examine the pin names from the REPL by using:

Code: Select all

dir(pyb.Pin.board)
and

Code: Select all

dir(pyb.Pin.cpu)

chipxx
Posts: 14
Joined: Mon Oct 21, 2019 8:55 am

Re: stm32 F401RE all pin

Post by chipxx » Sun Nov 17, 2019 12:38 pm

Hi, the question is simple: I want to use the entire board with Arduino. The Arduino pins and the Morpho pins. Is it possible?
Thank you very much.
Chipxx ;)

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

Re: stm32 F401RE all pin

Post by dhylands » Sun Nov 17, 2019 2:22 pm

I would think so but I’ve never used arduino on these devices. You’d be better off asking on an arduino forum.

chipxx
Posts: 14
Joined: Mon Oct 21, 2019 8:55 am

Re: stm32 F401RE all pin

Post by chipxx » Sun Nov 17, 2019 3:18 pm

Okay. I'll see you next time. Thank you
chipxx :P

Post Reply