Thanks to visit codestin.com
Credit goes to github.com

Skip to content

samd: A set of small changes and bug fixes. #11106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 22, 2023

Conversation

robert-hh
Copy link
Contributor

@robert-hh robert-hh commented Mar 23, 2023

  • Make some machine devices configurable by #defines. These include ADC, DAC, I2C, SoftI2C, SPI, SoftI2C, PWM, UART, pulse.

  • Drop support for SoftSPI max speed. Saves ~140 bytes and is not really needed, since for higher baud rates hard SPI is available.

  • Update pins.csv for the Mini SAM M4 board.

  • 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 raise an error if the code gets larger than the space dedicated to it.

  • Add default deploy instructions.

  • Enable MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF for SAMD51.

  • Fix a soft reset bug, which caused soft reset to stall if streams using e.g. UART or SPI had to be closed by it's finalizer.

  • Enable machine.deepsleep() as alias to machine.lightsleep(), providing consistency at least for the method set.

  • Rename two pins of the WIO terminal. The names started with a digit.

  • Reduce the startup time. At boards with a crystal, the startup wait time after power-up is reduced to 1 second. At boards using USB-sync, the code checks for USB registering instead of just waiting a fixed time.

@robert-hh robert-hh force-pushed the samd_sp4 branch 2 times, most recently from b0f38d1 to 255deb9 Compare April 7, 2023 16:01
@robert-hh robert-hh changed the title samd: A set of small changes and fixes. samd: A set of small changes and bug fixes. Apr 10, 2023
@robert-hh
Copy link
Contributor Author

@dpgeorge Updated by rewriting the respective commit. That method is indeed much more clear. Thank you for the hint.

@robert-hh robert-hh force-pushed the samd_sp4 branch 5 times, most recently from b0aa85b to b0eee0f Compare May 4, 2023 06:23
@robert-hh robert-hh force-pushed the samd_sp4 branch 3 times, most recently from 58e18a1 to 8a74722 Compare May 19, 2023 18:49
robert-hh added 10 commits May 22, 2023 18:35
Saves ~140 bytes and is not really needed, since for higher baud rates hard
SPI is available.

Signed-off-by: robert-hh <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
So the names don't start with a digit, which isn't allowed in Python.

Signed-off-by: robert-hh <[email protected]>
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 <[email protected]>
@dpgeorge dpgeorge merged commit 2a38531 into micropython:master May 22, 2023
@dpgeorge
Copy link
Member

Thanks for updating. This is now merged.

@robert-hh
Copy link
Contributor Author

Thank you very much. Next in queue for SAMD may be #10233, which helps. It increases both flash write speed and code execution speed at SAMD51 devices.

@robert-hh robert-hh deleted the samd_sp4 branch May 23, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants