Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
493f078
Setup files for busio
Brandon-Hurst Dec 26, 2024
f4c2171
Add default build for analog ports for apard32690 board.
Brandon-Hurst Jan 14, 2025
1380af7
Add preliminary busio.UART support
Brandon-Hurst Jan 14, 2025
451e152
Add tools files for debugging
Brandon-Hurst Jan 14, 2025
13fb8f3
Fixed most UART write issues.
Brandon-Hurst Jan 24, 2025
0f1d915
Fix issues with UART reads and unreliable UART writes.
Brandon-Hurst Jan 25, 2025
72c4d43
Add pre-commit changes to UART
Brandon-Hurst Jan 27, 2025
b741b3a
Resolve UART ISR naming issues
Brandon-Hurst Feb 1, 2025
aaeee4d
Add BUSIO.I2C and MAX32690 I2C structure
Brandon-Hurst Mar 7, 2025
00c53ea
Add hardware mapping for BUSIO.SPI for MAX32690
Brandon-Hurst Mar 7, 2025
1d30ce7
Add complete BUSIO driver structure for SPI & I2C.
Brandon-Hurst Mar 7, 2025
7cccb66
Add call to MXC_DelayHandler in SysTick ISR
Brandon-Hurst Mar 7, 2025
ebfbd01
Corrected I2C & SPI. Tested with example scripts; works with real per…
Brandon-Hurst Mar 7, 2025
558eb93
Add extra I2C options for MAX32690 non-TQFN packages
Brandon-Hurst Mar 18, 2025
479e0e1
Clean up MAX32 BUSIO drivers
Brandon-Hurst May 2, 2025
3a8e56d
Cleanup copy-paste comments in MAX32 busio files
Brandon-Hurst May 2, 2025
ba30115
Correct ringbuffer code for ports/analog BUSIO
Brandon-Hurst May 5, 2025
b9dd6a0
Update jlink script for ports/analog
Brandon-Hurst May 5, 2025
0ffcc78
Refactor ports/analog/common-hal/busio i2c probe function.
Brandon-Hurst May 6, 2025
94eafa5
Expand command in ports/analog/tools/flash_max32.jlink for clarity.
Brandon-Hurst May 6, 2025
4cb58b6
Fix i2c scan bug with ports/analog/ BUSIO.
Brandon-Hurst May 6, 2025
814047d
Add translations for ports/analog/busio
Brandon-Hurst May 6, 2025
b19a861
Fix error reporting on ports/analog BUSIO for PR 10413
Brandon-Hurst Jul 5, 2025
85410e2
Minor changes in ports/analog/ busio UART.
Brandon-Hurst Jul 5, 2025
f395fad
Fix UART malloc for ports/analog BUSIO
Brandon-Hurst Jul 5, 2025
e5437cd
Commit locale changes from ports/analog BUSIO updates
Brandon-Hurst Jul 5, 2025
ed92610
Reuse more existing error messages in ports/analog BUSIO
Brandon-Hurst Jul 11, 2025
183a517
Fix I2C bug in ports/analog/busio
Brandon-Hurst Sep 23, 2025
bb27b40
Use more explicit names for i2c_id and spi_id
dhalbert Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ update-frozen-libraries:

one-of-each: samd21 litex mimxrt10xx nordic stm

analog:
$(MAKE) -C ports/analog/ BOARD=apard32690

samd21:
$(MAKE) -C ports/atmel-samd BOARD=trinket_m0

Expand Down
42 changes: 40 additions & 2 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ msgstr ""
msgid "%q indices must be integers, not %s"
msgstr ""

#: ports/analog/common-hal/busio/SPI.c ports/analog/common-hal/busio/UART.c
#: shared-module/bitbangio/SPI.c
msgid "%q init failed"
msgstr ""
Expand Down Expand Up @@ -158,6 +159,10 @@ msgstr ""
msgid "%q length must be >= %d"
msgstr ""

#: py/runtime.c
msgid "%q moved from %q to %q"
msgstr ""

#: py/argcheck.c
msgid "%q must be %d"
msgstr ""
Expand Down Expand Up @@ -237,6 +242,7 @@ msgstr ""
msgid "%q out of bounds"
msgstr ""

#: ports/analog/common-hal/busio/SPI.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nordic/common-hal/pulseio/PulseIn.c
Expand Down Expand Up @@ -498,7 +504,8 @@ msgstr ""
msgid "All SPI peripherals are in use"
msgstr ""

#: ports/espressif/common-hal/busio/UART.c ports/nordic/common-hal/busio/UART.c
#: ports/analog/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c
#: ports/nordic/common-hal/busio/UART.c
msgid "All UART peripherals are in use"
msgstr ""

Expand Down Expand Up @@ -649,6 +656,7 @@ msgstr ""
msgid "Boot device must be first (interface #0)."
msgstr ""

#: ports/analog/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Both RX and TX required for flow control"
msgstr ""
Expand Down Expand Up @@ -991,7 +999,7 @@ msgid ""
"Failed to add service TXT record; non-string or bytes found in txt_records"
msgstr ""

#: shared-module/rgbmatrix/RGBMatrix.c
#: ports/analog/common-hal/busio/UART.c shared-module/rgbmatrix/RGBMatrix.c
msgid "Failed to allocate %q buffer"
msgstr ""

Expand Down Expand Up @@ -1049,6 +1057,10 @@ msgstr ""
msgid "Failed to release mutex, err 0x%04x"
msgstr ""

#: ports/analog/common-hal/busio/SPI.c
msgid "Failed to set SPI Clock Mode"
msgstr ""

#: ports/zephyr-cp/common-hal/wifi/Radio.c
msgid "Failed to set hostname"
msgstr ""
Expand Down Expand Up @@ -1251,6 +1263,10 @@ msgstr ""
msgid "Interrupted by output function"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
#: ports/analog/peripherals/max32690/max32_i2c.c
#: ports/analog/peripherals/max32690/max32_spi.c
#: ports/analog/peripherals/max32690/max32_uart.c
#: ports/espressif/common-hal/_bleio/Service.c
#: ports/espressif/common-hal/espulp/ULP.c
#: ports/espressif/common-hal/microcontroller/Processor.c
Expand Down Expand Up @@ -1343,6 +1359,7 @@ msgstr ""
msgid "Invalid socket for TLS"
msgstr ""

#: ports/analog/common-hal/busio/SPI.c
#: ports/espressif/common-hal/espidf/__init__.c
#: ports/nordic/common-hal/_bleio/__init__.c
msgid "Invalid state"
Expand Down Expand Up @@ -1902,6 +1919,7 @@ msgstr ""
msgid "ROS topic failed to initialize"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
#: ports/nordic/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "RS485"
Expand Down Expand Up @@ -1994,6 +2012,10 @@ msgstr ""
msgid "SPI init error"
msgstr ""

#: ports/analog/common-hal/busio/SPI.c
msgid "SPI needs MOSI, MISO, and SCK"
msgstr ""

#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "SPI peripheral in use"
msgstr ""
Expand Down Expand Up @@ -2125,6 +2147,10 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
msgid "Timeout must be < 100 seconds"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Too many channels in sample"
msgstr ""
Expand Down Expand Up @@ -2168,6 +2194,10 @@ msgstr ""
msgid "UART init"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
msgid "UART needs TX & RX"
msgstr ""

#: ports/raspberrypi/common-hal/busio/UART.c
msgid "UART peripheral in use"
msgstr ""
Expand All @@ -2176,6 +2206,14 @@ msgstr ""
msgid "UART re-init"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
msgid "UART read error"
msgstr ""

#: ports/analog/common-hal/busio/UART.c
msgid "UART transaction timeout"
msgstr ""

#: ports/stm/common-hal/busio/UART.c
msgid "UART write"
msgstr ""
Expand Down
31 changes: 24 additions & 7 deletions ports/analog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
#
# SPDX-License-Identifier: MIT

BOARD ?= apard32690
CROSS_COMPILE = arm-none-eabi-

# Includes mpconfigboard.mk & mpconfigport.mk,
# along with numerous other shared environment makefiles.
include ../../py/circuitpy_mkenv.mk

CROSS_COMPILE = arm-none-eabi-

# MCU_SERIES e.g. "max32"
# MCU_VARIANT e.g. "max32690"
# defined in mpconfigboard.mk
Expand All @@ -20,6 +21,7 @@ MCU_SERIES_UPPER := $(shell echo $(MCU_SERIES) | tr '[:lower:]' '[:upper:]')
MCU_VARIANT_LOWER := $(shell echo $(MCU_VARIANT) | tr '[:upper:]' '[:lower:]')
MCU_VARIANT_UPPER := $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]')


# *******************************************************************************
#### MSDK INCLUDES ####
# Necessary for msdk makefiles
Expand Down Expand Up @@ -59,6 +61,7 @@ DIE_TYPE=me18
endif

PERIPH_SRC = $(ADI_PERIPH)/Source
PERIPH_INC = $(ADI_PERIPH)/Include/$(MCU_VARIANT_UPPER)

INC += -I.
INC += -I../..
Expand All @@ -75,7 +78,7 @@ INC += \
-I$(TOP)/lib/cmsis/inc \
-I$(CMSIS_ROOT)/Include \
-I$(CMSIS_ROOT)/Device/Maxim/$(MCU_VARIANT_UPPER)/Include \
-I$(ADI_PERIPH)/Include/$(MCU_VARIANT_UPPER) \
-I$(PERIPH_INC) \
-I$(PERIPH_SRC)/SYS \
-I$(PERIPH_SRC)/CTB \
-I$(PERIPH_SRC)/DMA \
Expand All @@ -85,7 +88,9 @@ INC += \
-I$(PERIPH_SRC)/TMR \
-I$(PERIPH_SRC)/RTC \
-I$(PERIPH_SRC)/UART \
-I$(PERIPH_SRC)/TRNG
-I$(PERIPH_SRC)/TRNG \
-I$(PERIPH_SRC)/I2C \
-I$(PERIPH_SRC)/SPI

INC += -I$(CMSIS_ROOT)/Device/Maxim/$(MCU_VARIANT_UPPER)/Source/GCC

Expand Down Expand Up @@ -120,13 +125,20 @@ SRC_MAX32 += \
$(PERIPH_SRC)/UART/uart_$(DIE_TYPE).c \
$(PERIPH_SRC)/UART/uart_revb.c \
$(PERIPH_SRC)/TRNG/trng_revb.c \
$(PERIPH_SRC)/TRNG/trng_$(DIE_TYPE).c
$(PERIPH_SRC)/TRNG/trng_$(DIE_TYPE).c \
$(PERIPH_SRC)/I2C/i2c_$(DIE_TYPE).c \
$(PERIPH_SRC)/I2C/i2c_reva.c \
$(PERIPH_SRC)/SPI/spi_$(DIE_TYPE).c \
$(PERIPH_SRC)/SPI/spi_reva1.c

SRC_C += $(SRC_MAX32) \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
peripherals/$(MCU_VARIANT_LOWER)/pins.c \
peripherals/$(MCU_VARIANT_LOWER)/gpios.c
peripherals/$(MCU_VARIANT_LOWER)/gpios.c \
peripherals/$(MCU_VARIANT_LOWER)/max32_uart.c \
peripherals/$(MCU_VARIANT_LOWER)/max32_i2c.c \
peripherals/$(MCU_VARIANT_LOWER)/max32_spi.c

# *******************************************************************************
### Compiler & Linker Flags ###
Expand Down Expand Up @@ -267,11 +279,16 @@ flash-msdk:
-f interface/cmsis-dap.cfg -f target/$(MCU_VARIANT_LOWER).cfg \
-c "program $(BUILD)/firmware.elf verify; init; reset; exit"

flash-openocd-jlink:
$(OPENOCD) -s $(OPENOCD_SCRIPTS) \
-f interface/jlink.cfg -f target/$(MCU_VARIANT_LOWER).cfg \
-c "program $(BUILD)/firmware.elf verify; init; reset; exit"

# flash target using JLink
JLINK_DEVICE = $(MCU_VARIANT_LOWER)

JLINKEXE ?= JLink.exe
JLINKEXE += -if SWD -device ${JLINK_DEVICE} -speed 10000
JLINKEXE += -if SWD -device ${JLINK_DEVICE} -speed 4000
COMMAND_FILE := tools/flash_max32.jlink

flash-jlink: $(BUILD)/firmware.bin
Expand Down
10 changes: 2 additions & 8 deletions ports/analog/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@ extern const mxc_gpio_cfg_t led_pin[];
extern const int num_leds;

/** NOTE: ALL "ticks" refer to a 1/1024 s period */
static int status_led_ticks = 0;
static int status_ticks = 0;

// This function is where port-specific background
// tasks should be performed
// Execute port specific actions during background tick. Only if ticks are enabled.
void port_background_tick(void) {
status_led_ticks++;

// Set an LED approx. 1/s
if (status_led_ticks > 1024) {
MXC_GPIO_OutToggle(led_pin[2].port, led_pin[2].mask);
status_led_ticks = 0;
}
status_ticks++;
}

// Execute port specific actions during background tasks. This is before the
Expand Down
Loading