summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-06samd/boards: Add missing/lost board config and pin definitions.robert-hh
Fixes are: - Pin definitions for ADAFRUIT_FEATHER_Mx_EXPRESS and ADAFRUIT_ITSYBITSY_M4_EXPRESS. - For ADAFRUIT_ITSYBITSY_M0_EXPRESS, change the MISO/MOSI name. - For MINISAM_M4, add the default SPI pins. - For boards with 32k crystal, add the XOSC32K setting.
2022-10-06samd/machine_uart: Support buffered TX for UART.robert-hh
It can be enabled/disabled by a configuration switch. The code size increase is 308 bytes, but it requires RAM space for buffers, the larger UART object and root pointers.
2022-10-06samd/modutime: Enable time.time() based on systick_ms().robert-hh
Allowing to set a time and retrieve the time. It is based on systick_ms() with the precision of the MCU clock. Unless that is based on a crystal, the error seen was about 0.5% at room temperature.
2022-10-06samd/mphalport: Add a mp_hal_ticks_ms_64() function.robert-hh
Returning a 64 bit number. This will be used by the utime module and the machine.UART module for timeout avoiding overflow.
2022-10-06samd/mcu: Factor out MCU policy for SAMD21 and SAMD51.robert-hh
Which contains a mpconfigmcu.h, mpconfigmcu.mk and manifest.py file for each MCU group. That looks better than the previous choice.
2022-10-06samd/modmachine: Add machine.time_pulse_us.robert-hh
Software based. Resolution: - +/-2 microseconds on SAMD51. - +/-4 microseconds on SAMD21.
2022-10-06samd/machine_dac: Add the machine.DAC class.robert-hh
It suuports 1 channel @ 10 bit for SAMD21, 2 channels @ 12 bit for SAMD51. Instantiation by: dac = machine.DAC(ch) # 0 or 1 Method write: dac.write(value) The output voltage range is 0..Vdd.
2022-10-06samd/machine_led: Optimise size of the machine.LED class.robert-hh
By reducing the methods to on(), off(), toggle() and call, and using the method implementation of the machine.Pin class. The code size reduction is 756 byte.
2022-10-06samd/modsamd: Add pininfo() function to the samd module.robert-hh
samd.pininfo() returns the data stored in the pin af table for a pin. Using a small script, a nice representation of the table can be created.
2022-10-06samd/machine_wdt: Add the machine.WDT class.robert-hh
2022-10-06samd/machine_timer: Add machine.Timer based on the shared soft-timer.robert-hh
2022-10-06samd/samd_isr: Change the way a Sercom ISR is registered and called.robert-hh
Code size diff: +12 Bytes BSS diff: -12 Bytes RAM usage: +16 Bytes Speed increase: a few clock cycles per call Style improvement: ++
2022-10-06samd/mpconfigport: Enable a few more MicroPython features.robert-hh
Additional features are: - Support executing .mpy files. - Allow const(). - Enable auto-indent in REPL. - Enable enumerate, min/max, attrtuple, input.
2022-10-06samd/main: Use the common execution mode of boot.py and main.py.robert-hh
Behaviour is: - Do not execute main.py if boot.py failed. - On a forced exit, do a soft reset.
2022-10-06samd/moduos: Add uos.urandom() for SAMD51.robert-hh
Based on the hardware RNG.
2022-10-06samd/moduos: Add uos.dupterm().robert-hh
2022-10-06samd/machine_i2c: Add the machine.I2C class.robert-hh
Using the common API. Tested with SAMD21 and SAMD51 boards.
2022-10-06samd/machine_spi: Add the machine.SPI class.robert-hh
Suported by both SAMD21 and SAMD51. It follows the generic API, except for the bits=nn option, which is not implemented (yet).
2022-10-06samd/machine_uart: Add the machine.UART class.robert-hh
All board pins that have UART's assigned can be used. Baud rate range is 75 Baud to ~2 MBaud. No flow control yet, and only RX is buffered. TX buffer and flow control may be added later for SAMD51 with its larger RAM and Flash.
2022-10-06samd/modmachine: Add disable_irq(), enable_irq() and idle() to machine.robert-hh
No specific features.
2022-10-06samd/machine_pin: Add pin.irq() to the machine.Pin class.robert-hh
Its API conforms to the docs. There are 16 IRQ channels available, which will be used as assignable to the GPIO numbers. In most cases, the irq channel is GPIO_no % 16.
2022-10-06samd/samd_isr: Rework the interrupt tables.robert-hh
Changes are: - Have two separate tables for SAM21 and SAMD51. - Use a short table for SAMD21. - Add a comment to each line telling what it's for, making further use easier. - Add preliminary handlers/entries for PendSV, EIC and Sercom. These will be replaced later when the respecitve modules are added.
2022-10-06samd/machine_pwm: Add the machine.PWM class.robert-hh
Features are: - 3 to 5 different frequency groups. - Freq range of 1Hz - 24 MHz. - Duty rate stays stable on freq change. Keyword options to the PWM constructor: - device=n Select a specific PWM device. If no device is specified, a free device is chosen, if available at that pin. - freq=nnnn - duty_u16=nnnn - duty_ns=nnnn - invert=True/False Allowing two outputs on the same device/channel to have complementary signals. If both freq and duty are provided, PWM output will start immediately. Pins at the same device have the same frequency. If the PWM output number exceeds the number of channels at the PWM device, the effctive channel_no is output_no % channel_count. So with a channel count of 4, output 7 is assigned to channel 3. Pins at a certain channel have the same frequency and duty rate, but may be seperately inverted.
2022-10-06samd/machine_adc: Add the machine.ADC class.robert-hh
With the method read_u16(). Keyword arguments of the constructor are: - bits=n The resolution; default is 12. - average=n The average of samples, which are taken and cumulated. The default value is 16. Averaging by hw is faster than averaging in code. The ADC runs at a clock freq 1.5 MHz. A single 12 bit conversion takes 8 microseconds.
2022-10-06samd/pin_af: Add the pin af table and its helper functions.robert-hh
The pin af table is a representation of the MUX table from the data sheet. It provides information for each pin about the supported device functions. That information is needed by pin.irq, machine.ADC, machine.PWM, machine.UART, machine.SPI and machine.I2C. For each of these, the table tells for each pin, which device number, af number and pad number is assigned. Using the table gives a straight, uniform access to the information, where the benefit outweights the size of the table, which is not that large. The tables are MCU-specific. It is not required to tell for each board, which and where each of the above devices is available. That makes addding boards easy. Note: The information for DAC and I2S was not included, since it affects only a few pins.
2022-10-06samd/boards: Create pin_af_table.c from pin_af_table_SAMDxx.csv files.robert-hh
This step just creates the table. The firmware cannot be built at this commit. The next commit will complete the pin-af mechanism.
2022-10-06samd/modmachine: Enable SoftSPI and SoftI2C.robert-hh
2022-10-06samd/machine_pin: Allow specifying a pin or LED by its name as a string.robert-hh
The names are defined in pins.csv.
2022-10-06samd/machine_pin: Add OPEN_DRAIN mode for pins.robert-hh
Changes in this commit are: - Use mphal_xx functions whenever possible. - Remove obsolete includes. - Clean up traces of a non-functional pin.irq() from earlier builds. Pin.irq() will be added in further commits in a working manner.
2022-10-06samd/samd_isr: Extend systick_ms to 64 bit.robert-hh
By adding a 32 bit overflow counter. This allows it to be used for the time functions.
2022-10-06samd/mphalport: Add pin open-drain funcs, and improve delay and ticks.robert-hh
The changes in this commit are: - Add an interface for pin open-drain mode. - Improve ticks_us() by using the us-counter. - Improve ticks_cpu() by using the CPU's SysTick.
2022-10-06samd/modmachine: Allow changing the CPU freq with machine.freq(f).robert-hh
SAMD51 only. Accepted values are 48_000_000 to 200_000_000. The range specified by Atmel is 96_000_000 to 120_000_000.
2022-10-06samd/clock_config: Set up the clock configuration.robert-hh
Clock settings: - GCLK0: 48 MHz (SAMD21) or 120 MHz(SAMD51). - GCLK1: 32768 Hz for driving the PLL. - GCLK2: 48 MHz for tzhe peripheral clock. - GCLK3: 1 MHz (SAMD21) or 8 MHz (SAMD51) for the µs ticks timer. - GCLK8: 1 kHz for WDT (SAMD21 only). If a 32 kHz crystal is present, it will be used as clock source. Otherwise the DFLL48M in open-loop mode is used. GCLK0 for SAM51 can be changed between 48 MHz and 200 MHz. The specified range is 96 MHz - 120 MHz.
2022-10-06samd/boards: Add ADAFRUIT_FEATHER_M4_EXPRESS and _ITSYBITSY_M0_EXPRESS.robert-hh
These two boards are used for testing, so it is favorable to have them added early. The full test set is: - ADAFRUIT_FEATHER_M4_EXPRESS: SAMD51 with 32kHz crystal. - ADAFRUIT_ITSYBITSY_M0_EXPRESS: SAMD21 without crystal. - ADAFRUIT_ITSYBITSY_M4_EXPRESS: SAMD51 without crystal. - SEEED_XIAO: SAM21 with 32kHz crystal.
2022-10-06samd/Makefile: Alphabetically sort the source code files in Makefile.robert-hh
2022-10-06samd/boards: Move mcu-specific settings into a mpconfig_samdXX.h file.robert-hh
Located at the boards directory. That way, the mpconfigboard.h files are almost empty, just setting the board name and the MCU name.
2022-10-06samd/boards: Replace pins.c and pins.h by pins.csv.robert-hh
The files pins.c and pins.h are generated during the build process from pins.csv, using a make-pins.py script.
2022-10-06samd: Remove the existing provisional support for REPL on UART.robert-hh
It was only partially working and will be rpelaced later by a full machine.UART class implementation.
2022-10-06tools/mpremote: Bump version to 0.4.0.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-10-06tools/mpremote: Fix argument handling for follow and add help strings.Jim Mussared
Fixes in this commit are: - Make --follow the default for "run" (accidentally changed in 68d094358). - Add help strings for "repl": --capture --inject-file --inject-code - Update help strings for "run". - Fix encoding for --inject-code (accidentally broken in 68d094358). - Remove ability to --no-follow for "eval". It was there previously because it shared the same code path with "exec" and "run", but makes no sense for "eval", so might as well remove. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-04esp32/machine_hw_spi: Use auto DMA channel on S2, S3, C3 chips.Damien George
Auto DMA channel is supported in IDF v4.4, and is required to be used on S3 chips, so use this simpler configuration option where possible. Fixes issue #8634. Signed-off-by: Damien George <damien@micropython.org>
2022-10-04tools: Add pre-commit support.Angus Gratton
Tweak the existing codeformat.py and verifygitlog.py to allow them to be easily called by pre-commit. (This turned out to be easier than using any existing pre-commit hooks, without making subtle changes in the formatting.) This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-10-04tools: Add note about uncrustify versions.Angus Gratton
Uncrustify versions are not mutually compatible: 1. Version 0.73 or newer produce slightly different formatting. It may be possible to tweak these by adding more config items, but this will cause older versions to error out with 'Unknown option'. 2. Version 0.75 prints a range of deprecation warnings due to config file changes, and returns a non-zero exit code. These are actually fixable as most are the default value, and pp_indent has changed from 'true' to '1' which is backwards compatible. However issue 1 remains, so probably better to have it fail explicitly. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-10-04esp32/machine_i2s: Add I2S finaliser which calls deinit().Damien George
So that the FreeRTOS resources can be freed, eg on soft reset. Fixes issue #9366. Signed-off-by: Damien George <damien@micropython.org>
2022-10-01tools/pyboard.py: Handle unsupported fs command.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Add `mpremote mip install` to install packages.Jim Mussared
This supports the same package sources as the new `mip` tool. - micropython-lib (by name) - http(s) & github packages with json description - directly downloading a .py/.mpy file The version is specified with an optional `@version` on the end of the package name. The target dir, index, and mpy/no-mpy can be set through command line args. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Use argparse for command line parsing.Jim Mussared
No functional change other than to allow slightly more flexibility in how --foo arguments are specified. This removes all custom handling for --foo args in all commands and replaces it with per-command argparse configs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Simplify dispatch of commands.Jim Mussared
No functional change. This makes each built-in command defined by just a handler method and simplifies a lot of the logic around tracking the board state. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30tools/manifestfile.py: Replace recursive glob with os.walk.Jim Mussared
Recursive glob isn't supported before Python 3.5. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30top: Replace upip with mip everywhere.Jim Mussared
Updates all README.md and docs, and manifests to `require("mip")`. Also extend and improve the documentation on freezing and packaging. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>