Wykres commitów

3446 Commity (48ffd6596e7a4c185a81be233b46d3c99a83a7ac)

Autor SHA1 Wiadomość Data
Takeo Takahashi 1f60841123 renesas-ra/boards/make-pins.py: Fix PA/PB pins support.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-06-01 13:00:24 +10:00
robert-hh 6c0af30e38 mimxrt/Makefile: Use a specific fsl_flexspi_nor_boot.c for mimxrt1062.
This one sets the flash image length properly for the teensy loader, such
that the file system is not erased.  It was already set in commit
8e54225140 but got lost when the MIMXRT1176
board was added.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-01 12:38:17 +10:00
robert-hh 8f6315a279 mimxrt/machine_pwm: Fix freq change, PWM print, and error checks.
Three bugs have been fixed in this commit:

1. When the duty was set with duty_u16(), changing the freq with pwm.freq()
   would not keep relative duty rate, but the absolute pulse duration.

2. Fix another inconsistency when displaying the PWM pin's properties of a
   QTMR channel.

3. Improve the error checks for the second channel being a PWM pin and pin
   pairs to be a FLEXPWM A/B pair.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-01 12:25:34 +10:00
robert-hh 73cc6b750e ports: Enable os.sync() for esp32, esp8266, rp2, mimxrt, samd51.
These have by default FAT support.  The SAMD21 build does not support FAT.
The nrf port also implements os.sync(), but has it's own copy of moduos.c.

Code size increases seen: 40 to 56 bytes.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-01 11:39:01 +10:00
robert-hh 1c53bda27f ports: Remove os.sync() implementation from stm32 and renesas-ra.
Now that this code was moved to extmod/moduos.c.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-01 11:39:01 +10:00
Damien George 324d01eb52 renesas-ra: Consolidate hal_entry.c code and remove hal_entry() func.
The hal_entry.c code is duplicated across all boards, so consolidate it to
a common ra_hal.c file.  And remove the hal_entry() function because it
simply calls main().

Signed-off-by: Damien George <damien@micropython.org>
2023-05-24 11:44:17 +10:00
Damien George b57b079bbe stm32/boards/NUCLEO_L4A6ZG: Add new board definition.
Signed-off-by: Damien George <damien@micropython.org>
2023-05-24 11:25:53 +10:00
Damien George 87cf439e0d stm32/adc: Add support for STM32L4A6 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-05-24 11:25:50 +10:00
Jim Mussared 0ba08e6299 stm32/boards/NUCLEO_G474RE: Make it easier to enable USB.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-24 11:13:23 +10:00
Jim Mussared f4b4d05e49 stm32/usb: Fix USB support on STM32G4.
Also fix MAX_ENDPOINT definition for G0, which follows G4.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-24 11:12:45 +10:00
robert-hh 5707fd74e5 mimxrt/boards/ADAFRUIT_METRO_M7: Add Adafruit Metro M7 board definition.
Support for WiFi and BLE is in progress.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-23 16:54:39 +10:00
iabdalkader 8d446b2ad5 mimxrt/led: Add support for up to four LEDs.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-23 10:54:23 +10:00
Yilin Sun 0f0dcec984 mimxrt/sdcard: Fix GCC 13 build error with sdcard_cmd_set_bus_width.
This updates the declaration of 'sdcard_cmd_set_bus_width()' to the same as
its definition.

Signed-off-by: Yilin Sun <imi415@imi.moe>
2023-05-23 10:38:13 +10:00
robert-hh c3f031afac samd/boards/ADAFRUIT_METRO_M4_EXPRESS: Add Metro M4 Express Airlift.
The board files can be used for both Adafruit Metro M4 variants.  The Wifi
support is in progress.
2023-05-23 10:17:16 +10:00
robert-hh 20fd22edad samd/machine_uart: Add support for UART hardware flow control.
By specifying rts=pin(x) and/or cts=Pin(x) in the constructor.  The pad
numbers for the UART pins are fix in this case: TX must be at pad 0, RX at
pad 1, RTS at pad 2 and CTS at pad 3.

repr(uart) shows the pin names for rts and cts, if set.  In case of a RX
overflow, the rx interrupt will be disabled instead of just discarding the
data.  That allows RTS to act.

If RTS is inactive, still 2 bytes can be buffered in the FIFO.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-23 09:53:24 +10:00
robert-hh 2a38531d73 samd/mcu: Reduce the startup time after hard reset.
With Crystal: set the crystal startup wait time to 1 second.  It was 2
seconds before, and that seeemed too long.

With USB-Sync: scan for up to 1 second for the USB to be registered and
carry on with boot as soon as it it.  Before, the code just waited for
500ms.

Side change: improve related comments.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:41:48 +10:00
robert-hh 984456731b samd/boards/SEEED_WIO_TERMINAL: Rename two pins starting with a digit.
So the names don't start with a digit, which isn't allowed in Python.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:40:23 +10:00
robert-hh 47fa723586 samd/modmachine: Make some machine classes configurable by #defines.
These include ADC, DAC, I2C, SoftI2C, SPI, SoftI2C, PWM, UART, pulse.  This
is useful for devices like the Adafruit Trinket series which have almost no
accessible GPIO pins.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:39:07 +10:00
robert-hh b2df094bf8 samd/modmachine: Add machine.deepsleep as alias of machine.lightsleep.
Just for coverage.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:38:51 +10:00
robert-hh 7a847bab1e samd/main: Fix sercom deinit ordering in soft-reset.
If sockets were open when calling soft reset, gc_sweep_all() would try to
close them.  In case of e.g. the NINA WiFi handler, connected through SPI,
spi_transfer() would be called for command exchange with the NINA module.
But at that time SerCom was already disabled.

Moving sercom_deinit_all() behind gc_sweep_all() solves this issue.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:37:35 +10:00
robert-hh b7180d53f0 samd/boards: Add default deploy instructions.
Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:37:24 +10:00
robert-hh 05e684dc07 samd/mcu/samd51: Enable MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF.
Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:37:11 +10:00
robert-hh 315eb949da samd: Rearrange the MCU-specific loader files.
Such that they are easier to adapt.  The maximum code size is set by:

    MICROPY_HW_CODESIZE=xxxK

in mpconfigmcu.mk for the MCU family as default or in mpconfigboard.mk for
a specific board.  Setting the maximum code size allows the loader to error
out if the code gets larger than the space dedicated for it.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:36:29 +10:00
robert-hh 457d9ee68a samd/boards/MINISAM_M4: Update pins.csv for the Mini SAM M4 board.
Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:36:07 +10:00
robert-hh 267d1ab2ba samd/mpconfigport: Drop support for SoftSPI max speed.
Saves ~140 bytes and is not really needed, since for higher baud rates hard
SPI is available.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22 18:35:45 +10:00
patrick a802f71908 esp32/uart: Use xtal as UART clock source on S3 and C3.
Change UART clock source on S3/C3 so the UART can operate when CPU
frequency is below 80MHz.  This allows the UART to remain operational when
using Dynamic Frequency Scaling (DFS).

Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2023-05-22 10:11:24 +10:00
patrick 05e143dbdd esp32/esp32_ulp: Enable FSM ULP for S2 and S3 chips.
This commit enables the ULP for the S2 and S3 chips.

Note this is the FSM (Finite State Machine) ULP.

Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2023-05-19 22:37:25 +10:00
UnexpectedMaker 3a7ad64267 esp32/boards: Add some missing board configs for two UM boards. 2023-05-19 22:30:42 +10:00
iabdalkader bfcaf39197 stm32/irq: Fix typo in comment about priorities.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-19 22:23:33 +10:00
iabdalkader 70b60fe24e renesas-ra/irq: Fix typo in comment about IRQ priorities.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-19 22:23:10 +10:00
Andrew Leech f03ac04321 stm32/mboot: Fix alignment of packed final buffer.
Once all the firmware has been flashed and the final signatures checked,
mboot writes the "all good" byte into the header of the application.  This
step uses the buffer firmware_head which, if unaligned in the build, fails
when cast to a uint64_t* in flash.c.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-05-19 22:16:53 +10:00
brave ulysses ad216be5f1 stm32/boards/stm32h723_af.csv: Fix ADC AF definitions.
These were incorrectly added in d995c01042.
The fix here includes the full differential ADC definitions.

Signed-off-by: brave ulysses <brave_ulysses@email.com>
2023-05-19 22:12:05 +10:00
Damien George 53cb073571 esp32,esp8266: Change network.WLAN from a function to a type.
When the network module was first introduced in the esp8266 port in
ee3fec3167 there was only one interface (STA)
and, to save flash, the WLAN object was aliased to the network module,
which had just static methods for WLAN operations.  This was subsequently
changed in 9e8396accb when the AP interface
was introduced, and the WLAN object became a true class.

But, network.WLAN remained a function that returned either the STA or AP
object and was never upgraded to the type itself.  This scheme was then
copied over to the esp32 port when it was first introduced.

This commit changes network.WLAN from a function to a reference to the WLAN
type.  This makes it consistent with other ports and network objects, and
allows accessing constants of network.WLAN without creating an instance.

Signed-off-by: Damien George <damien@micropython.org>
2023-05-18 14:52:28 +10:00
Ondrej Wisniewski 29401a719f rp2/mphalport: Only use CYW43 MAC for WLAN0 interface.
Building the Pico-W needs the MICROPY_PY_NETWORK_CYW43 flag to be set in
order to include building the CYW43 Wifi driver.  But then mp_hal_get_mac()
handles the MAC assignment for all nics the "CYW43 way", copying the real
MAC provided by the WiFi hardware.  This will fail for all other NIC types,
resulting in an invalid MAC address.

The solution in this commit is to add a check for the NIC type parameter
idx and handle the MAC address respectively.
2023-05-18 13:06:06 +10:00
Phil Howard 4ce360fa83 rp2/CMakeLists: Allow relative MICROPY_BOARD_DIR when invoking cmake.
Convert to an absolute path to always reliably locate manifest.py.  This is
already done in Makefile, but is also needed in CMakeLists.txt if cmake is
invoked directly.

Signed-off-by: Phil Howard <phil@pimoroni.com>
2023-05-18 12:51:36 +10:00
Adam Green f9958417d8 rp2: Make rp2_state_machine_exec accept integers.
Currently rp2.StateMachine.exec(instr_in) requires that the instr_in
parameter be a string representing the PIO assembly language instruction
to be encoded by rp2.asm_pio_encode(). This commit allows the parameter
to also be of integral type. This is useful if the exec() method is
being called often where the use of pre-encoded machine code is
desireable.

This commit still supports calls like:
    sm.exec("set(0, 1)")

It also now supports calls like:
    # Performed once earlier, maybe in __init__()
    assembled_instr = rp2.asm_pio_encode("out(y, 8)", 0)
    # Performed multiple times later as the PIO state machine is
    # configured for its next run.
    sm.exec(assembled_instr)

The existing examples/rp2/pio_exec.py and examples/rp2/pio_pwm.py that
exercise the rp2.StateMachine.exec() method still work with this change.

Signed-off-by: Adam Green <adamgrym@yahoo.com>
2023-05-18 12:33:02 +10:00
Takeo Takahashi 3229791b60 renesas-ra: Add a macro definition to avoid compile error of FSP v4.4.0.
FSP v4.4.0 refers to CMSIS V5.4.1, and __COMPILER_BARRIER() is used in bsp.
On the other hand, lib/cmsis is V5.1.0 and the macro is not defined.
Therefore, compile error happens.
As the workaround, the macro definition is added.
If lib/cmsis is updated in the future, this addition can be removed.

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11 16:18:39 +10:00
Takeo Takahashi b4834e5cba renesas-ra: Update boards and ra directory files to support FSP v4.4.0.
* Update boards and ra files
* Remove unreferenced files, board_init.c and board_leds.c, from Makefile
* Remove unreferenced FSP instances from ra_gen/*.[ch]
* Remove unreferenced FSP config files ra_cfg/*.h
* e2 studio generates FSP instances but renesas-ra uses only followings:
  lpm, flash, ioport

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11 16:18:39 +10:00
David Lechner 6a4a9bc147 windows/Makefile: Allow variants to add QSTR_DEFS.
This modifies the windows port Makefile to use += for QSTR_DEFS and
QSTR_GLOBAL_DEPENDENCIES so that variants can add additional files if
needed (similar to stm32 port).

Signed-off-by: David Lechner <david@pybricks.com>
2023-05-11 14:34:15 +10:00
David Lechner 6836acf3dc unix/Makefile: Allow variants to add QSTR_DEFS.
This modifies the unix port Makefile to use += for QSTR_DEFS and
QSTR_GLOBAL_DEPENDENCIES so that variants can add additional files if
needed (similar to stm32 port).

Signed-off-by: David Lechner <david@pybricks.com>
2023-05-11 14:34:01 +10:00
robert-hh 65d376b11d mimxrt/machine_pin: Perform full configuration in machine_pin_set_mode.
machine_pin_set_mode() is used by the internal mp_hal_pin_xxx() set of
functions to configure pins.
2023-05-09 16:15:05 +10:00
robert-hh 14b862f70f mimxrt/machine_spi: Ignore transfers with len=0.
It was treated as an error before.  The error surfaced when using the
NINAW10 drivers for WiFi support.  Even if this is a bad behavior of the
NINA driver, machine_spi can be forgiving in that situation.
2023-05-09 16:14:40 +10:00
robert-hh d2a02dcee3 mimxrt: Add missing UART defintion and remove obsolete config.
Changes in this commit:
- Add a missing UART defintion for MIMXRT1010_EVK.
- Remove an obsolete line from mpconfigport.h.
2023-05-09 16:13:51 +10:00
robert-hh facc51f3ea mimxrt/mpconfigport: Add back lost uos.urandom().
It got lost in a clean-up session recently.
2023-05-09 16:13:27 +10:00
Philipp Ebensberger a3f3b9045c mimxrt/flash: Separate low level driver code from flash object.
Separate low level flash access from mimxrt flash driver object.  Allows
better abstraction from hardware for testing and reuse in other areas (e.g.
bootloader).

Signed-off-by: Philipp Ebensberger <philipp.ebensberger@3bricks-software.de>
2023-05-09 15:18:36 +10:00
Jim Lipsey 7333c06d05 stm32/boards/ARDUINO_PORTENTA_H7: Enable FDCAN.
Add pin definitions to enable FDCAN support using the pyb.CAN() class.
2023-05-09 13:25:03 +10:00
glenn20 1093dea709 esp32,esp8266: Add support to set/get power saving mode of WLAN.
For esp32 and esp8266 this commit adds:
- a 'pm' option to WLAN.config() to set/get the wifi power saving mode; and
- PM_NONE, PM_PERFORMANCE and PM_POWERSAVE constants to the WLAN class.

This API should be general enough to use with all WLAN drivers.

Documentation is also added.
2023-05-06 13:51:00 +10:00
Damien George 38243cd8e0 extmod/machine_pwm: Remove PWM_INIT and PWM_DUTY_U16_NS config options.
All ports that enable MICROPY_PY_MACHINE_PWM now enable these two
sub-options, so remove these sub-options altogether to force consistency in
new ports that implement machine.PWM.

Signed-off-by: Damien George <damien@micropython.org>
2023-05-04 13:19:19 +10:00
robert-hh 7952694a3c rp2/machine_pwm: Add duty_x() checks and return 0 if PWM is not started.
Changes in this commit:
- Limit duty_u16() to 65535 and duty_ns() to the period duration.
- Return 0 for pwm.freq() if the frequency has not been set yet.
- Return 0 for pwm.duty_us16() and duty_ns() unless both frequency and
  duty cycle have been set.
- Initialize the pin to PWM at the very end of the constructor, to avoid
  possible glitches on the pin when setting up the PWM.
2023-05-04 13:18:58 +10:00
robert-hh 0b3b508d1d rp2/machine_pwm: Add support for inverting a PWM channel output.
Using the invert=True|False keyword option with the constructor or init().
2023-05-04 13:18:47 +10:00