summaryrefslogtreecommitdiffstatshomepage
path: root/ports/stm32/boards/make-pins.py
Commit message (Collapse)AuthorAge
* stm32/boards: Support 'FDCAN' in board pin CSVs.Angus Gratton2025-01-17
| | | | | | | | | | | | | | | | | | | | | Previously micros with the 'FDCAN' peripheral (as opposed to the older 'CAN' peripheral) needed to rename these pins in the CSVs for the CAN driver to work. The following CSVs in MicroPython still had FDCAN in them: $ rg -t csv -l FDCAN boards boards/stm32h7b3_af.csv boards/stm32h743_af.csv boards/stm32h573_af.csv boards/stm32h723_af.csv boards/stm32g0b1_af.csv Confirmed that this allows CAN to work on NUCLEO_H723ZG board, and that at least one board based on each of the other chips can still compile. Some of these boards could possibly have MICROPY_HW_ENABLE_CAN set and work, now. Signed-off-by: Angus Gratton <angus@redyak.com.au>
* stm32: Add support for dual-analog-pad "_C" pins on H7 MCUs.Damien George2024-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for the dual-analog-pads on STM32H7 parts. These pads/pins are called PA0_C/PA1_C/PC2_C/PC3_C in the datasheet. They each have an analog switch that can optionally connect them to their normal pin (eg PA0). When the switch is open, the normal and _C pin are independent pins/pads. The approach taken in this commit to make these _C pins available to Python is: - put them in their own, independent row in the stm32h7_af.csv definition file, with only the ADC column defined (they are separate machine.Pin entities, and doing it this way keeps make-pins.py pretty clean) - allow a board to reference these pins in the board's pins.csv file by the name PA0_C etc (so a board can alias them, for example) - these pins (when enabled in pins.csv) now become available like any other machine.Pin through both machine.Pin.board and machine.Pin.cpu - BUT these _C pins have a separate pin type which doesn't have any methods, because they don't have any functionality - these _C pins can be used with machine.ADC to construct the appropriate ADC object, either by passing the string as machine.ADC("PA0_C") or by passing the object as machine.ADC(machine.Pin.cpu.PA0_C) - if a board defines both the normal and _C pin (eg both PA0 and PA0_C) in pins.csv then it must not define the analog switch to be closed (this is a sanity check for the build, because it doesn't make sense to close the switch and have two separate pins) Signed-off-by: Damien George <damien@micropython.org>
* stm32/boards/make-pins.py: Only support ADC1-3.Jim Mussared2023-11-05
| | | | | | | e.g. The STM32G4 includes ADC4 & ADC5 which is not currently supported by the stm32 driver. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32/boards/make-pins.py: Fix H7 ADC generation.Jim Mussared2023-11-03
| | | | | | | | | Fixes are: - Only emit ADC table entries for pins that aren't cpu-hidden (i.e. ignore `X,-Y` rows). - Only use the P channels on H7. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32/boards/make-pins.py: Add initial support for H7 dual-pad pins.Jim Mussared2023-11-03
| | | | | | | | | | | | | This fixes the H7 af.csv files to include the dual-pad information, by listing the ADCs supported on the _C pad with a C_ADC prefix. Minimal change to make-pins.py to ignore these entries. This will be implemented later to emit constants (similar to ADC.CORE_TEMP) to access these channels. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32/boards/make-pins.py: Update to use tools/boardgen.py.Jim Mussared2023-11-03
| | | | | | | | Requires additions to tools/boardgen.py for stm32 pin generation. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32: Rename pin_obj_t to machine_pin_obj_t.Jim Mussared2023-11-03
| | | | | | | | | | | This is now consistent with other ports. Also renamed `pin_{board/cpu}_pins_locals_dict` to `machine_pin_{board/cpu}_pins_locals_dict`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* ports: Standardise arguments and output for make-pins.py script.Jim Mussared2023-11-03
| | | | | | | | | | | | | | | | | | | | | | All ports now use `--board-csv`, `--prefix`, `--output-souce`, `--output-header` and no longer write to stdout. This matches the esp32 implementation. Ports that have an AF input use `--af-csv` (to match `--board-csv`). Any additional output files are now prefixed with `output-` (e.g. `--output-af-const`). Default arguments are removed (all makefiles should always specify all arguments, using default values is likely an error). Replaced the `af-defs-cmp-strings` and `hdr-obj-decls` args for stm32 with just `mboot-mode`. Previously they were set on the regular build, now the logic is reversed so mboot sets it. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* examples/pins.py: Remove this pins printing example.Jim Mussared2023-11-03
| | | | | | | | | | | | It's not supported on all ports, adds complexity to the build to generate pins_af.py, and can mostly be replicated just by printing the pin objects. Remove support for generating pins_af.py from all ports (nrf, stm32, renesas-ra, mimxrt, rp2). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32/boards/make-pins.py: Don't generate qstrs.Jim Mussared2023-11-03
| | | | | | | | | | | Qstrs are picked up from the generated pin source files in the usual qstr processing stage. Similarly for the stm constant qstrs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* all: Fix spelling mistakes based on codespell check.Damien George2023-04-27
| | | | Signed-off-by: Damien George <damien@micropython.org>
* top: Update Python formatting to black "2023 stable style".Jim Mussared2023-02-02
| | | | | | See https://black.readthedocs.io/en/stable/the_black_code_style/index.html Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* stm32: Add support for G4 MCUs, and add NUCLEO_G474RE board defn.Herwin Grobben2022-02-01
| | | | | | This commit adds support for the STM32G4 series of MCUs, and a board definition for NUCLEO_G474RE. This board has the REPL on LPUART1 which is connected to the on-board ST-link USB-UART.
* stm32/boards/make-pins.py: Generate empty ADC table if needed.iabdalkader2021-12-20
| | | | If ADCx pins are hidden, print an empty table to prevent linker errors.
* stm32/boards/make-pins.py: Use cpu pins to define static alt-fun macros.Damien George2021-11-30
| | | | | | | Instead of board pins, so that pins which have only the CPU specified in pins.csv can still be used with mp_hal_pin_config_alt_static(). Signed-off-by: Damien George <damien@micropython.org>
* stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv.Damien George2021-09-16
| | | | Signed-off-by: Damien George <damien@micropython.org>
* stm32/boards/make-pins.py: Allow a CPU pin to be hidden.Damien George2021-09-16
| | | | | | | | This change allows a CPU pin to be hidden from the user by prefixing it with a "-" in the pins.csv file for a board. It will still be available in C code, just not exposed to Python. Signed-off-by: Damien George <damien@micropython.org>
* esp32,stm32: Add new machine.I2S class for I2S protocol support.Mike Teachman2021-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds I2S protocol support for the esp32 and stm32 ports, via a new machine.I2S class. It builds on the stm32 work of blmorris, #1361. Features include: - a consistent I2S API across the esp32 and stm32 ports - I2S configurations supported: - master transmit and master receive - 16-bit and 32-bit sample sizes - mono and stereo formats - sampling frequency - 3 modes of operation: - blocking - non-blocking with callback - uasyncio - internal ring buffer size can be tuned - documentation for Pyboards and esp32-based boards - tested on the following development boards: - Pyboard D SF2W - Pyboard V1.1 - ESP32 with SPIRAM - ESP32 Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
* stm32/adc: Simplify and generalise how pin_adcX table is defined.Damien George2021-07-05
| | | | | | | | | | | | The ADC_FIRST_GPIO_CHANNEL and ADC_LAST_GPIO_CHANNEL macros are no longer needed. Instead the pin_adcX table (X = 1, 2, 3) is now generated to be the exact size needed for a given MCU, and MP_ARRAY_SIZE(pin_adcX) is used to determine the upper bound. This commit also allows CPU pins to be excluded from ADC configuration if they are hidden by prefixing their name with a "-". Signed-off-by: Damien George <damien@micropython.org>
* stm32/uart: Add support for LPUART1 on L0, L4, H7 and WB MCUs.Chris Mason2021-02-21
| | | | | | | | | | | | | | | | | Add LPUART1 as a standard UART. No low power features are supported, yet. LPUART1 is enabled as the next available UART after the standard U(S)ARTs: STM32WB: LPUART1 = UART(2) STM32L0: LPUART1 = UART(6) STM32L4: LPUART1 = UART(6) STM32H7: LPUART1 = UART(9) On all ports: LPUART1 = machine.UART('LP1') LPUART1 is enabled by defining MICROPY_HW_LPUART1_TX and MICROPY_HW_LPUART1_RX in mpconfigboard.h. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
* all: Update Python code to conform to latest black formatting.Damien George2020-08-29
| | | | | | | | | | | | | Updating to Black v20.8b1 there are two changes that affect the code in this repository: - If there is a trailing comma in a list (eg [], () or function call) then that list is now written out with one line per element. So remove such trailing commas where the list should stay on one line. - Spaces at the start of """ doc strings are removed. Signed-off-by: Damien George <damien@micropython.org>
* all: Reformat C and Python source code with tools/codeformat.py.Damien George2020-02-28
| | | | This is run with uncrustify 0.70.1, and black 19.10b0.
* stm32/boards/make-pins.py: Allow pins.csv to skip or hide board-pin nameDamien George2019-05-31
| | | | | | If the board-pin name is left empty then only the cpu-pin name is used, eg ",PA0". If the board-pin name starts with a hyphen then it's available as a C definition but not in the firmware, eg "-X1,PA0".
* stm32/boards/make-pins.py: Add cmdline options to support use by mboot.Damien George2019-02-14
|
* stm32/boards/make-pins.py: Add basic support for STM32H7 ADC periphs.Damien George2019-02-06
|
* stm32: Add method for statically configuring pin alternate function.Andrew Leech2018-07-20
| | | | | | | | | Works with pins declared normally in mpconfigboard.h, eg. (pin_XX), as well as (pyb_pin_XX). Provides new mp_hal_pin_config_alt_static(pin_obj, mode, pull, fn_type) function declared in pin_static_af.h to allow configuring pin alternate functions by name at compile time.
* stm32/can: Allow CAN pins to be configured per board.Damien George2018-04-11
| | | | | | | | | | | | | | This patch allows a given board to configure which pins are used for the CAN peripherals, in a similar way to all the other bus peripherals (I2C, UART, SPI). To enable CAN on a board the mpconfigboard.h file should define (for example): #define MICROPY_HW_CAN1_TX (pin_B9) #define MICROPY_HW_CAN1_RX (pin_B8) #define MICROPY_HW_CAN2_TX (pin_B13) #define MICROPY_HW_CAN2_RX (pin_B12) And the board config file should no longer define MICROPY_HW_ENABLE_CAN.
* stm32: Change pin_X and pyb_pin_X identifiers to be pointers to objects.Damien George2018-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than pin objects themselves. The actual object is now pin_X_obj and defines are provided so that pin_X is &pin_X_obj. This makes it so that code that uses pin objects doesn't need to know if they are literals or objects (that need pointers taken) or something else. They are just entities that can be passed to the map_hal_pin_xxx functions. This mirrors how the core handles constant objects (eg mp_const_none which is &mp_const_none_obj) and allows for the possibility of different implementations of the pin layer. For example, prior to this patch there was the following: extern const pin_obj_t pin_A0; #define pyb_pin_X1 pin_A0 ... mp_hal_pin_high(&pin_A0); and now there is: extern const pin_obj_t pin_A0_obj; #define pin_A0 (&pin_A0_obj) #define pyb_pin_X1 pin_A0 ... mp_hal_pin_high(pin_A0); This patch should have minimal effect on board configuration files. The only change that may be needed is if a board has .c files that configure pins.
* stm32: Use STM32xx macros instead of MCU_SERIES_xx to select MCU type.Damien George2018-03-17
| | | | | | The CMSIS files for the STM32 range provide macros to distinguish between the different MCU series: STM32F4, STM32F7, STM32H7, STM32L4, etc. Prefer to use these instead of custom ones.
* ports: Make new ports/ sub-directory and move all ports there.Damien George2017-09-06
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.