jgriessen wrote:Do all of the pyb libraries work with the F401RE -- as far as the pins defined?
Can I write such as:
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.