summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-26extmod/modbluetooth: Make all HCI transports trace in the same format.Jim Mussared
- Use HCI_TRACE macro consistently. - Use the same colour formatting. - Add a tool to convert to .pcap for Wireshark. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth: Use multitest.broadcast instead of sleep.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26examples/bluetooth/ble_temperature_central.py: Remove service tuple.Jim Mussared
This is unused in the client, only needed in the server. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth/ble_characteristic.py: Add write-no-response.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth: Add test for descriptors.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/nimble: Fix flags for descriptor registration.Jim Mussared
The att_flags for descriptors does not use the same bitfield as for characteristics. This was leading to NimBLE descriptors getting the wrong flags set. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/btstack: Add support for CCCD to allow client subscriptions.Jim Mussared
This allows gatts_write(..., send_update=True) to work, which will send notifications/indications to subscribed clients. btstack already created the CCCD but writes to it were ignored. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth/ble_subscribe: Use end_handle in desc discovery.Jim Mussared
Obtaining the end_handle was added in cacc96d9. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/btstack: Fix MTU handling.Jim Mussared
There was no event handler for central-initiated MTU exchange. Fix truncation of notify/indicate to match NimBLE. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth/ble_mtu: Split peripheral/central-initiated.Jim Mussared
btstack only supports central-initiated, so this allows us to have a test that works on both (ble_mtu.py), and then another one for just the NimBLE supported behavior (ble_mtu_peripheral.py). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26tests/multi_bluetooth: Use time.sleep_ms instead of time.sleep.Jim Mussared
On unix, time.sleep is implemented as select(timeout=<time>) which means that it does not run the poll hook during sleeping. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/btstack: Include value handle in client read/write events.Jim Mussared
This replaces the previous pending operation queue (that used to also be shared with pending server notify/indicate ops) with a single pending operation per connection. This allows the value handle to be correctly passed to the Python-level events. Also re-structure GATT client event handling to simplify the packet handler functions. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/btstack: Fix indicate/notify queuing.Jim Mussared
This adds a mechanism to track a pending notify/indicate operation that is deferred due to the send buffer being full. This uses a tracked alloc that is passed as the content arg to the callback. This replaces the previous mechanism that did this via the global pending op queue, shared with client read/write ops. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26extmod/modbluetooth: Merge gatts_notify/indicate implementation.Jim Mussared
Makes gatts_notify and gatts_indicate work in the same way: by default they send the DB value, but you can manually override the payload. In other words, makes gatts_indicate work the same as gatts_notify. Note: This removes support for queuing notifications and indications on btstack when the ACL buffer is full. This functionality will be reimplemented in a future commit. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-22extmod/btstack: Switch to use hci_dump_init instead of hci_dump_open.Damien George
The latter is no longer available in the version of BTstack now in use by this repository. Signed-off-by: Damien George <damien@micropython.org>
2023-04-21shared/tinyusb: Revert setting of CFG_TUD_CDC_EP_BUFSIZE to 256.Damien George
This reverts commit 0613d3e3561a82fffa36594647ef916b19bc912b. The value of CFG_TUD_CDC_EP_BUFSIZE should match the endpoint size, otherwise data may stay in the lower layers of the USB stack (and not passed up to the higher layers) until a total of CFG_TUD_CDC_EP_BUFSIZE bytes have been received, which may not happen for a long time. Fixes issue #11253. Signed-off-by: Damien George <damien@micropython.org>
2023-04-21rp2/machine_i2c: Add timeout parameter for machine.I2C().David (Pololu)
This commit adds support for the `timeout` keyword argument to machine.I2C on the rp2 port, following how it's done on other ports. The main motivation here is avoid the interpreter crashing due to infinite loops when SDA is stuck low, which is quite common if the board gets reset while reading from an I2C device. A default timeout of 50ms is chosen because it's consistent with: - Commit a707fe50b085ec83722106609f6fd219faf9f030 which used a timeout of 50,000us for zero-length writes on the rp2 port. - The machine.SoftI2C class which uses 50,000us as the default timeout. - The stm32 port's hardware I2C, which uses 50,000us for I2C_POLL_DEFAULT_TIMEOUT_US. This commit also fixes the default timeout on the esp32 port to be consistent with the above, and updates the documentation for machine.I2C to document this keyword argument.
2023-04-15tools/mpremote: Add ctrl-x as additonal mpremote disconnect shortcut.Jonas Scharpf
The mpremote REPL can now be closed with either ctrl+] or ctrl+x, which gives users a choice, useful if the ']' key is difficult to access. Fixes issue #11197. Signed-off-by: Jonas Scharpf <jonas@brainelectronics.de>
2023-04-12mimxrt: Fix the build for boards without ROM API.iabdalkader
2023-04-11mimxrt/modmachine: Implement machine.bootloader().iabdalkader
If a board defines a custom bootloader entry function it will be called first, if not and the ROM API supports RUN bootloader API, then `machine.bootloader()` will jump to the ROM serial downloader in USB mode.
2023-04-11mimxrt/mpconfigport: Allow configuring different network interfaces.iabdalkader
This commit allows boards to disable Ethernet and keep the networking stack enabled, to use an alternate networking interface, such as WiFi. Note that the `network` and `socket` modules are now enabled by default for a board.
2023-04-11mimxrt/boards/MIMXRT1064_EVK: Fix board config to use internal flash.iabdalkader
This commit is necessary to make MicroPython work on this eval kit out of the box, as the eval kit ships with the HyperFlash physically disconnected from the bus (refer to the schematics or the user guide) and the QSPI connected instead, but the fuses/board/pins are configured to boot from internal flash (on FlexSPI2). Note that enabling the HyperFlash is not trivial, as it requires soldering and desoldering of many small footprint resistors and changing fuses.
2023-04-11mimxrt/Makefile: Fix internal flash configuration and build.iabdalkader
2023-04-11py/makeqstrdefs.py: Fix handling GreenHills C/C++ preprocessor output.Alex Riesen
The GreenHills preprocessor produces #line directives without a file name, which the regular expression used to distiguish between "# <number> file..." (GCC and similar) and "#line <number> file..." (Microsoft C and similar) does not match, aborting processing. Besides, the regular expression was unnecessarily wide, matching lines containing a "#", followed by any number of 'l','i','n', and 'e' characters. Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>
2023-04-07tools/manifestfile.py: Add support for publishing packages to PyPI.Jim Mussared
This adds a new MODE_PYPROJECT, which gives basic support to allow packaging a small subset of micropython-lib packages to PyPI. This change allows a package in micropython-lib to: - Add a "pypi" name to its metadata indicating that it's based on a PyPI package. - Add "stdlib" to its metadata indicating that it's a micropython version of a stdlib package. - Add a "pypi_publish" name to its metadata to indicate that it can be published to PyPI (this can be different to the package name, e.g. "foo" might want to be published as "micropython-foo"). When a package requires() another one, if it's in MODE_PYPROJECT then if the package is from pypi then it will record that as a pypi dependency instead (or no dependency at all if it's from stdlib). Also allows require() to explicitly specify the pypi name. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-05shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code.David Grayson
Helps prevent the filesystem from getting formatted by mistake, among other things. For example, on a Pico board, entering Ctrl+D and Ctrl+C fast many times will eventually wipe the filesystem (without warning or notice). Further rationale: Ctrl+C is used a lot by automation scripts (eg mpremote) and UI's (eg Mu, Thonny) to get the board into a known state. If the board is not responding for a short time then it's not possible to know if it's just a slow start up (eg in _boot.py), or an infinite loop in the main application. The former should not be interrupted, but the latter should. The only way to distinguish these two cases would be to wait "long enough", and if there's nothing on the serial after "long enough" then assume it's running the application and Ctrl+C should break out of it. But defining "long enough" is impossible for all the different boards and their possible behaviour. The solution in this commit is to make it so that frozen start-up code cannot be interrupted by Ctrl+C. That code then effectively acts like normal C start-up code, which also cannot be interrupted. Note: on the stm32 port this was never seen as an issue because all start-up code is in C. But now other ports start to put more things in _boot.py and so this problem crops up. Signed-off-by: David Grayson <davidegrayson@gmail.com>
2023-04-05mimxrt/pendsv: Clean up PendSV code.iabdalkader
The dispatch active flag is only set once and never reset, so it will always call the dispatch handler (once enabled), and it's not really needed because it doesn't make things more efficient. Also remove unused included headers.
2023-04-05nrf/modules/machine/uart: Prevent UART lock-up after a receive error.robert-hh
Like frame error, overrun, etc. Fix is provided by @ricksorensen.
2023-04-05nrf/nrfx_config: Use UARTE for nrf52xxx devices.robert-hh
It was incomplete.
2023-04-05nrf/modules/machine/pwm: Fix resource conflict, and change id to device.robert-hh
Changes in this commit: - Move the pwm_seq array to the p_config data structure. That prevents potential resource collisions between PWM devices. - Rename the keyword argument 'id' to 'device'. That's consistent with the SAMD port as the other port allowing to specify it.
2023-04-05extmod/network_ninaw10: Add missing raw socket type to socket().iabdalkader
This regression was introduced by 3d46fe67bf0bfc848741a76e945b16b2e45e74cb.
2023-04-04extmod/network_cyw43: Add support to get STA RSSI using status() method.Oliver Joos
This enables the use of WLAN(0).status('rssi') to get current RSSI of the AP that the STA is connected to. Signed-off-by: Damien George <damien@micropython.org>
2023-04-04extmod/network_cyw43: Fix setting hostname using config() method.Oliver Joos
This bug is probably a typo. args[0] is the cyw43 object itself. While the value of a kwargs is in e->value.
2023-04-04extmod/network_ninaw10: Check socket types when creating new sockets.iabdalkader
The NINA socket types have the same values as modnetwork, but that may change in the future. So check the socket types passed to socket() and convert them (if needed) to their respective Nina socket types. Also remove the unnecessary socket type check code from bind(), as pointed out by @robert-hh.
2023-04-04drivers/ninaw10: Fix ESP32 input-only pins.iabdalkader
ESP32 pins 34, 35, 36 and 39 are input only, and should not be configured as output.
2023-04-04stm32/flash: Fix get_bank function for STM32H750.Jan Hrudka
STM32H750 has only 1 flash bank so function get_bank should always return FLASH_BANK_1.
2023-04-04tools/pyboard.py: Fix ESPxx boards hanging in bootloader after reset.Jos Verlinde
This is a follow up to d263438a6e365d3199494498a9b734cda29dde52, which solved one problem (reset on disconnect) but introduced a second one (hang in bootloader). To solve both probles, False/False is needed for DTR/RTS for ESPxx, but that would then block stm32 and others. Any unconditional combination of DTR/RTS ends up blocking normal operation on some type of board or another. A simple overview (for windows only): DTR CTS ESP8266/ESP32 STM32/SAMD51/RP2040 unspecified unspecified Reset on disconnect OK True False Hang in bootloader OK False False OK No Repl True True Reset on disconnect No Repl False True Reset on disconnect No Repl serial.manufacturer: wch.cn/Silicon Labs Microsoft serial.description: USB-SERIAL CH340 / USB Serial Device CP210x USB to UART Bridge The updated logic will only set the DTR/RTS signals for boards that do not use standard Microsoft drivers (based on the manufacturer). It would also be possible to check against a list of known driver manufactures (like wch.cn or Silicon Labs) but this would require a list of known drivers for all ports. Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
2023-04-04shared/tinyusb: Allow max USB descriptor string to be configured.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-03-31stm32/boards/ARDUINO_NICLA_VISION: Fix incorrect bootloader PID.Sebastian Romero
2023-03-29tests/extmod/vfs_fat_ilistdir_del.py: Use 512-byte erase block size.Damien George
Following other vfs_fat tests, so the test works on ports like stm32 that only support 512-byte block size. Signed-off-by: Damien George <damien@micropython.org>
2023-03-28py/obj: Fix spelling of staticmethod.David Lechner
Signed-off-by: David Lechner <david@pybricks.com>
2023-03-23ports: Implement simple write polling for stdout.Damien George
This is a best-effort implementation of write polling. It's difficult to do correctly because if there are multiple output streams (eg UART and USB CDC) then some may not be writeable while others are. A full solution should also have a return value from mp_hal_stdout_tx_strn(), returning the number of bytes written to the stream(s). That's also hard to define. The renesas-ra and stm32 ports already implement a similar best-effort mechanism for write polling. Fixes issue #11026. Signed-off-by: Damien George <damien@micropython.org>
2023-03-23tests/multi_bluetooth: Use multitest.output_metric in BLE perf tests.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-03-23tests/run-multitests.py: Support outputting test metrics.Damien George
If a multitest calls `multitest.output_metric(...)` then that output will be collected separately, not considered as part of the test verification output, and instead be printed at the end. This is useful for tests that want to output performance/timing metrics that may change from one run to the next. Signed-off-by: Damien George <damien@micropython.org>
2023-03-22stm32/boards/NUCLEO_G0B1RE: Add config for USB and mboot.Damien George
But leave these disabled. Signed-off-by: Damien George <damien@micropython.org>
2023-03-22stm32/mboot: Add support for G0 MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-03-22stm32: Add support for USB on G0 MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-03-22rp2/machine_uart: Fix setting of UART LCR parameters.robert-hh
Prior to this change, setting of UART parameters like parity, stop bits or data bits did not work correctly. As suggested by @iabdalkader, adding __DSB() fixes the problem, making sure that changes to the UART LCR_H register are seen by the peripheral. Note: the FIFO is already enabled in the call to uart_init(), so the call to uart_set_fifo_enabled() is not required, but kept for visibility. Fixes issue #10976.
2023-03-22tools/pyboard.py: Fix joining of path in filesystem_command.Damien George
This was broken by 5327cd1021dc92cad428ff44cb114c4a94c0bc45 Signed-off-by: Damien George <damien@micropython.org>
2023-03-21py/scheduler: Implement VM abort flag and mp_sched_vm_abort().Damien George
This is intended to be used by the very outer caller of the VM/runtime. It allows setting a top-level NLR handler that can be jumped to directly, in order to forcefully abort the VM/runtime. Enable using: #define MICROPY_ENABLE_VM_ABORT (1) Set up the handler at the top level using: nlr_buf_t nlr; nlr.ret_val = NULL; if (nlr_push(&nlr) == 0) { nlr_set_abort(&nlr); // call into the VM/runtime ... nlr_pop(); } else { if (nlr.ret_val == NULL) { // handle abort ... } else { // handle other exception that propagated to the top level ... } } nlr_set_abort(NULL); Schedule an abort, eg from an interrupt handler, using: mp_sched_vm_abort(); Signed-off-by: Damien George <damien@micropython.org>