1. 26 Jun, 2024 4 commits
  2. 25 Jun, 2024 4 commits
    • Angus Gratton's avatar
      rp2: Don't disable USB if going to DORMANT mode. · f60c71d1
      Angus Gratton authored
      In this mode, XOSC is stopped so can't really keep
      the USB PLL enabled.
      Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
      f60c71d1
    • Angus Gratton's avatar
      rp2: Fix USB PLL glitch during wake from light sleep. · 068d9bf2
      Angus Gratton authored
      Follow-up to a84c7a0e, this commit works most of the time but has an
      intermittent bug where USB doesn't resume as expected after waking from
      light sleep.
      
      Turns out waking calls clocks_init() which will re-initialise the USB PLL.
      Most of the time this is OK but occasionally it seems like the clock
      glitches the USB peripheral and it stops working until the next hard reset.
      
      Adds a machine.lightsleep() test that consistently hangs in the first
      two dozen iterations on rp2 without this fix. Passed over 100 times in a
      row with this fix.
      
      The test is currently rp2-only as it seems similar lightsleep USB issues
      exist on other ports (both pyboard and ESP32-S3 native USB don't send any
      data to the host after waking, until they receive something from the host
      first.)
      
      This work was funded through GitHub Sponsors.
      Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
      068d9bf2
    • Angus Gratton's avatar
      rp2/clocks_extra: Implement custom clocks_init function. · 5dcffb53
      Angus Gratton authored
      Adapts pico-sdk clocks_init() into clocks_init_optional_usb() which takes
      an argument to initialise USB clocks or not.
      
      To avoid a code size increase the SDK clocks_init() function is linker
      wrapped to become clocks_init_optional_usb(true).
      
      This work was funded through GitHub Sponsors.
      Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
      5dcffb53
    • Angus Gratton's avatar
      rp2: Fix recursive atomic sections when core1 is active. · cfa55b4c
      Angus Gratton authored
      mp_thread_begin_atomic_section() is expected to be recursive (i.e. for
      nested machine.disable_irq() calls, or if Python code calls disable_irq()
      and then the Python runtime calls mp_handle_pending() which also enters an
      atomic section to check the scheduler state).
      
      On rp2 when not using core1 the atomic sections are recursive.
      
      However when core1 was active (i.e. _thread) then there was a bug that
      caused the core to live-lock if an atomic section recursed.
      
      Adds a test case specifically for mutual exclusion and recursive atomic
      sections when using two threads. Without this fix the test immediately
      hangs on rp2.
      
      This work was funded through GitHub Sponsors.
      Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
      cfa55b4c
  3. 24 Jun, 2024 2 commits
    • Angus Gratton's avatar
      py/objint: Fix int.to_bytes() buffer size checks. · 908ab1ce
      Angus Gratton authored
      Fixes and improvements to `int.to_bytes()` are:
      - No longer overflows if byte size is 0 (closes #13041).
      - Raises OverflowError in any case where number won't fit into byte length
        (now matches CPython, previously MicroPython would return a truncated
        bytes object).
      - Document that `micropython int.to_bytes()` doesn't implement the optional
        signed kwarg, but will behave as if `signed=True` when the integer is
        negative (this is the current behaviour).  Add tests for this also.
      
      Requires changes for small ints, MPZ large ints, and "long long" large
      ints.
      
      Adds a new set of unit tests for ints between 32 and 64 bits to increase
      coverage of "long long" large ints, which are otherwise untested.
      
      Tested on unix port (64 bit small ints, MPZ long ints) and Zephyr STM32WB
      board (32 bit small ints, long long large ints).
      
      This work was funded through GitHub Sponsors.
      Signed-off-by: default avatarAngus Gratton <angus@redyak.com.au>
      908ab1ce
    • Angus Gratton's avatar
  4. 21 Jun, 2024 13 commits
  5. 19 Jun, 2024 3 commits
  6. 18 Jun, 2024 5 commits
  7. 17 Jun, 2024 3 commits
  8. 11 Jun, 2024 2 commits
  9. 07 Jun, 2024 3 commits
  10. 06 Jun, 2024 1 commit