Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add busio support for ADI MAX32xxx port#10413

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Brandon-Hurst wants to merge29 commits intoadafruit:main
base:main
Choose a base branch
Loading
fromBrandon-Hurst:ports/analog/add-busio

Conversation

Brandon-Hurst
Copy link

@Brandon-HurstBrandon-Hurst commentedJun 10, 2025
edited
Loading

Add BUSIO Support for supported MAX32xxx devices. Not all capable MAX32 devices are supported yet; more support for MAX32650/MAX32666/MAX78002 boards may be added in a future PR. This module was tested on a MAX32690 board, the AD-APARD32690-SL. I used a ADT7140 I2C and MAX31723 SPI temperature sensor, and also tested the UART via the debug port serial connection.

  • BUSIO support added for MAX32 devices
  • Peripherals enumerated in peripherals/max32690 for MAX32690 MCU, including helper functions for mapping a set of pins to the associated on-chip peripheral
  • common-hal/busio contains the implementation of the BUSIO port functions

MAX31723 (SPI):
image

ADT7420 (I2C):
image

A simple echo test was done with UART as well with no issues:

fromboardimport*frombusioimportUART# init uart with timeout of 10 secondsuart=UART(P2_12,P2_11,baudrate=115200,timeout=10.0)# Write 'hello' to another serial portuart.write('hello\n')# Read 5 charactersuart.read(5)# Read until newlineuart.readline()

Brandon-Hurstand others added23 commitsJune 10, 2025 10:52
- Enabled BUSIO in mpconfigport.mk- Stubs added for busio.I2C & busio.SPI- Implemented busio.UART to basic working functionality- Added MCU-specific UART data in peripherals/<mcu>/max32_uart.c & max32_uart.h- Still have a couple issues where UART generates garbage characters or  does not respond to timeouts / generate asynchronous IRQs
- Add debug-dap.sh to spawn OpenOCD process & gdb-multiarch process for debugging.  Requires MaximSDK install & path settings inside this script.  Also depends on gdb-multiarch and connected CMSIS-DAP probe over USB.- debug-dap.gdb simply holds the gdb commands for this script+ small style fix on common-hal/microcontroller/Pin.c
- Graceful recovery from timeouts added- Remaining issue still exists where a timeout occurs after a while
- No ISR for UART writes, but uses timeouts- Reads use ISRs, but also incorporate timeouts
- Formatting & codespell fixes from pre-commit
- Call NVIC_SetRAM in supervisor/port.c to move NVIC table to RAM, enabling ISR RAM remapping.- Rename UART ISR to be generic for any UART IRQn.- Remove background led writes from background.c.
- Data structure and constructor for I2C (tested)- Lock and probing functions complete and testedTODO: Implement I2C Write, Read, Wr/RdSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
Currently coupled a bit to APARD32690-SL board. Will refactor after testing BUSIO.SPISigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
TODO:- Figure out assigning CS Pins for SPI- Test & Debug SPI / I2CSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
Signed-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
…ipherals.Signed-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
Also reformatted pinmaps for SPI/I2C/UART on MAX32690Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
- Fixed errors with peripheral bus hardware descriptions in MAX32690 "peripherals/"- Resolved all FIXME comments- Removed unused ringbuf API from common-hal/busio/UART.cSigned-off-by: Brandon Hurst <brandon.hurst@analog.com>
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
- Add correct ringbuffer handling code to ports/analog/common-hal/UART.cSigned-off-by: Brandon Hurst <brandon.hurst@analog.com>
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
- Used direct hardware values to rely on common HW implementation- Accounted for TX Lockout conditions in Transmit FIFO causing errorsSigned-off-by: Brandon Hurst <brandon.hurst@analog.com>
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
- Probe function caused infinite loops / unreliable ACK values- Replaced with probe-function with low-level routinesSigned-off-by: Brandon Hurst <brandon.hurst@analog.com>
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
Copy link
Collaborator

@dhalbertdhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for continuing to flesh this out. The changes here are stylistic, to match how we do error messages, etc. elsewhere.

- Use existing error messages from locale/circuitpython.pot for  most error messages- Replace ConnectionError (networking specific) calls with others  (usually RuntimeError)- Remove '\n' from mp error calls (since they add it already)- Remove some redundant validation code that repeats checks done  by shared-bindings/common-hal/busio code. e.g. pin validationSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
- Use m_malloc_without_collect storage API change from CircuitPython- Remove err number for asynchronous read error; just report itSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
- Remove excess argument from UART ringbuf malloc call- Remove unused err and intfl0 in I2C driver to remove warningsSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
@Brandon-Hurst
Copy link
Author

Thanks for the comments, Dan! Helpful stuff. I have implemented the requested changes to the error reporting -- should be ready for another review now.

Signed-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
Copy link
Collaborator

@dhalbertdhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the error message cleanup! I found a few more cases that could be changed or I had questions about. Thanks for your patience on the review.

- Reuse more messages in locales/circuitpython.pot in BUSIO- Remove UART write timeout- Refine some error handling for SPI initializationSigned-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
@Brandon-Hurst
Copy link
Author

Sure thing, I appreciate the thorough feedback :) latest round should be cleaned up now.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dhalbertdhalbertdhalbert requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Brandon-Hurst@dhalbert

[8]ページ先頭

©2009-2025 Movatter.jp