Currently on rp2 the time.time_ns() function has only seconds resolution.
This commit makes it have microsecond resolution, by using the output of
time_us_64() instead of the RTC.
Tested that it does not drift from the RTC over long periods of time.
Signed-off-by: Damien George <damien.p.george@gmail.com>
No other network-enabled board has urllib.urequest frozen in to the
firmware, and esp8266 is relatively low on flash, so remove this module.
And (u)requests is already included by bundle-networking.
Signed-off-by: Damien George <damien@micropython.org>
Also remove corresponding commented line from esp8266/boards/manifest.py.
It doesn't have enough flash to have this frozen by default.
Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Allows using gdb, addr2line, etc. on a "release" ELF file.
No impact to .bin or .uf2 size, only the .elf will get bigger.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The current code assumes all I2Cs are on the same peripheral bus, which is
not true for I2C4 and the same goes for the clock enable code.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
The IDF-provided version of TinyUSB defaults to Espressif's standard
VID:PID unless specific sdkconfig options are present. The numbers
already defined for the CUSTOM_* config options were ignored otherwise.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This removes the duplicate code in cyw43, esp32, esp8266 that implements
the same logic as network.hostname.
Renames the `mod_network_hostname` (where we store the hostname value in
`.data`) to `mod_network_hostname_data` to make way for calling the shared
function `mod_network_hostname`.
And uses memcpy for mod_network_hostname_data, because the length of source
is already known and removes reliance on string data being null-terminated.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This changes from the previous limit of 15 characters. Although DHCP and
mDNS allow for up to 63, ESP32 and ESP8266 only allow 32, so this seems
like a reasonable limit to enforce across all ports (and avoids wasting the
additional memory).
Also clarifies that `MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN` does not include
the null terminator (which was unclear before).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
By clearing the tamper bits and enabling access to the registers for all
code, just in case that this was set. It keeps the clock running on
battery and the calibration setting.
Signed-off-by: robert-hh <robert@hammelrath.com>
Not all boards or BLE extensions have the flow control signals for BLE
available at suitable pins. Actually none of the Adafruit extensions
match for flow control.
For consistency with the previous behaviour it is enabled by default.
Signed-off-by: robert-hh <robert@hammelrath.com>
Commit 552b0bbe12 did not define
MICROPY_PY_MACHINE_SDCARD properly, and thus building the firmware failed.
Signed-off-by: robert-hh <robert@hammelrath.com>
There is a single UART clock for all devices, so switching it for one will
affect all devices used at that time. This commit fixes that issue by
keeping the clock at a fixed value.
This fixed clock still supports the common baud rates between 300 and
921600 baud.
Signed-off-by: robert-hh <robert@hammelrath.com>
This is option is no longer needed as a Makefile option as the USDHC driver
is enabled for all supported series.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Changes are:
- Disable internal flash storage and use the external QSPI for storage.
- Disable default bootloader entry mode. The bootloader entry function
exists in board_init.c.
- Remove OSC enable/disable macros (this board doesn't have an OSC).
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This was previously hard-coded to "Micropy" / "Mass Storage" / "1.0".
Now allow it to be overridden by a board.
Also change "Micropy" to "MicroPy" and "1.0" to "1.00" to match stm32.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This was previously hard-coded to "MicroPy" / "pyboard Flash" / "1.00".
Now allow it to be overridden by a board.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Add "CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y" to
ports/esp32/boards/sdkconfig.base so that all micropython esp32 images
support OTA rollback in the bootloader. These images can then be converted
to OTA-capable images as required by user tools.
Also remove CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y from board-specific
sdkconfig files as this is now the default.
Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
While cyw43 is deinitialized, an interrupt occurs. That is handled with
these lines: ports/rp2/mpnetworkport.c#L59-L61 and as pendsv is disabled
while in network code, the poll function then just waits there.
When deinit has finished, the poll func is executed, but skipped:
src/cyw43_ctrl.c#L222-L225 this skips the `CYW43_POST_POLL_HOOK` which
would re-enable interrupts, but also reset `cyw43_has_pending`.
And in that state, the lightsleep code, will skip sleeping as it thinks
there is a network packet pending to be handled.
With this change applied, lightsleep works as expected when the wifi chip
is enabled, and when it's powered off.
Applies to newly-added ARDUINO_PORTENTA_C33 and UM_NANOS3.
Makes the list match the standard features defined in
24a6e951ec.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This was copied from minimal/mpconfigport.h, but it doesn't make sense
for general ports.
Add a comment to minimal/mpconfigport.h to explain why it specifically
overrides it.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This provides a way to build a non-DEBUG host binary that still has symbols
and debug information.
Document this for the unix port, and update a comment in the unix port
Makefile.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This gets the calculation working properly for H5 MCUs, and fixes the
switch statement to switch on csel&7 instead of csel&3.
Signed-off-by: Damien George <damien@micropython.org>
The include of HAL headers should come after the HAL configuration defines,
so that the headers can see whether the defines were made or not, to
provide defaults and configure various things.
Signed-off-by: Damien George <damien@micropython.org>
Integrate DAC support for STM32H5. Implement STM32H5 GPDMA driver. The DMA
driver is largely different from other STM32 variants. To support the DAC
circular mode, memory based linked list DMA descriptors are used.
Signed-off-by: Rene Straub <rene@see5.ch>
Changes are:
- Run ADC on PCLK/16.
- Verify and optimize timings (ADC_STAB_DELAY_US, ADC_SAMPLETIME_DEFAULT).
- Add support for STM32H5 VBAT and COREVDD channels on ADC2.
- Replace ADC constants in machine_adc_locals_dict_table.
- Convert STM32 literal to channel numbers in adc_config_channel with
corresponding STM32 LL library functions (__LL_ADC_IS_CHANNEL_INTERNAL(),
__LL_ADC_CHANNEL_TO_DECIMAL_NB()).
Reasoning for the second last point: the STM32 driver literals are uint32_t
that don't work with MP_ROM_INT() which handles signed 31 bit integers
only. Introduce enumerator machine_adc_internal_ch_t to define external
channels (0..19), internal channels (256..) and the special channel VREF
(0xffff). Values are converted to STM32 literals with adc_ll_channel()
when required in adc_config_and_read_u16().
Signed-off-by: Rene Straub <rene@see5.ch>
Select ADC instance based on pin information to support ADC2 inputs.
Display ADC instance number similar to machine_adc (STM32H5 only):
<ADC2 on Pin(Pin.cpu.F14, mode=Pin.ANALOG) channel=6>
Signed-off-by: Rene Straub <rene@see5.ch>
Fixed the preliminary STM32H5 ADC support for pyb.ADC:
- Run ADC on PCLK/16.
- Use STM32 ADC library channel literals (__HAL_ADC_DECIMAL_NB_TO_CHANNEL).
- Use correct temperature conversion for H5 (30C, 130C calibration points).
Signed-off-by: Rene Straub <rene@see5.ch>
To simulate a partial erase, the code reads a native block, erases it,
and writes back the data before and after the erased area. However, the
current logic was filling the area after the erased block with data
from the beginning of the native block-aligned data, instead of applying
the proper offset.
Fixes#12474.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
If a board needs these outputs then it can define MICROPY_HW_CLK_PLLQ/R.
It saves power to not enable them if they are not needed.
Signed-off-by: Damien George <damien@micropython.org>
Currently, check_esp_err() raises an exception without a location in the
source code, eg:
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
OSError: (-258, 'ESP_ERR_INVALID_ARG')
This commit allows additional error reporting (function, line and file) to
be enabled via detailed exceptions. Change the error reporting config to
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
and then exception messages from IDF errors look like:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: (-258, "0x0102 ESP_ERR_INVALID_ARG in function 'set_duty_u16'
at line 342 in file './machine_pwm.c'")
Signed-off-by: Ihor Nehrutsa <IhorNehrutsa@gmail.com>
Fixes are:
- The baudrate argument is a keyword arg, it was passed before as a
positional arg.
- Use the port and baudrate arguments passed from higher level code instead
of the hard-coded port ID and baudrate, which would allow HCI drivers to
change baudrates.
- Increase UART char timeout and RX buffer size.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>