This project demonstrates a simple user-interface application for the Analog Devices MAX32690EVKIT. It counts presses of the onboard SW2 push button, displays the count on the onboard TFT display, and generates an audible feedback tone through GPIO P2.26.
- Counts presses of the onboard
SW2push button. - Displays the current count on the onboard TFT.
- Uses a royal-blue background with white text.
- Shows the title
SW2 Count. - Generates an approximately 1 kHz beep for 60 ms after every valid button press.
- Uses GPIO
P2.26as the buzzer output. - Waits for the button to be released before accepting the next press.
- Demonstrates GPIO, push-button, TFT, clock, cache, and delay APIs from the MSDK.
- Analog Devices MAX32690EVKIT
- MAX32625PICO CMSIS-DAP debugger
- USB cable for the debugger
- USB cable or power supply for the MAX32690EVKIT
- Piezo buzzer connected to GPIO
P2.26, if an onboard buzzer is not available
| Function | MAX32690EVKIT resource |
|---|---|
| Push button | SW2 |
| TFT display | Onboard ST7735-based TFT |
| Buzzer output | GPIO P2.26 |
| Debugging/programming | MAX32625PICO through the SWD header |
For an external piezo buzzer, connect its positive terminal to P2.26 and its negative terminal to GND. Do not connect a high-current speaker or magnetic buzzer directly to the GPIO. Use a transistor or MOSFET driver when additional current is required.
After startup, the firmware waits for two seconds, initializes the board, enables the instruction cache, selects the internal precision oscillator, and initializes the TFT display. GPIO P2.26 is configured as a digital output and initially driven low so that the buzzer remains off.
The display starts with the following content:
SW2 Count
0
Whenever SW2 is pressed, the program increments the counter, updates the value on the TFT, and calls the beep() function. The program then waits until the button is released before checking for another press.
The buzzer tone is generated by rapidly toggling GPIO P2.26 between logic high and low:
#define BEEP_FREQUENCY_HZ 1000
#define BEEP_DURATION_MS 60The pin is driven high for 500 microseconds and low for 500 microseconds. This creates a 1 kHz square wave. The cycle is repeated for approximately 60 milliseconds, producing a short audible beep.
- Visual Studio Code
- Analog Devices CodeFusion Studio
- MAX32690 MSDK support
- MAX32690EVKIT board support package
- MAX32625PICO CMSIS-DAP debugger
- OpenOCD, included with CodeFusion Studio/MSDK
- Open the project folder in Visual Studio Code.
- Configure the workspace as a CodeFusion Studio project.
- Select the following target settings:
Device: MAX32690
Board: EvKit_V1 / MAX32690EVKIT
Platform: MSDK
Core: Arm Cortex-M4
Debugger: CMSIS-DAP
Interface: SWD
- Build the project:
Ctrl + Shift + B
Select:
CFS: build
- Connect the MAX32625PICO to the MAX32690EVKIT SWD header.
- Power the MAX32690EVKIT.
- Flash and run the program using:
CFS: flash and run
From the project directory, run:
make TARGET=MAX32690 BOARD=EvKit_V1To flash the generated firmware through OpenOCD, run:
make flash.openocdThe exact command may vary depending on the installed MSDK version and project configuration.
| Function | Description |
|---|---|
main() |
Initializes the board, clock, cache, TFT, and buzzer GPIO |
TFT_test() |
Runs the counter application and monitors SW2 |
TFT_Print() |
Prints text on the TFT using the selected font |
beep() |
Generates the 1 kHz, 60 ms buzzer tone |
PB_Get(0) |
Reads the onboard SW2 push button |
Power on or reset
↓
Wait two seconds
↓
Initialize board, cache, clock, TFT, and buzzer GPIO
↓
Display “SW2 Count” and the initial value
↓
Wait for SW2 press
↓
Increment the counter
↓
Update the TFT display
↓
Generate a short beep
↓
Wait for button release
↓
Repeat forever
- The buzzer waveform is generated in software using blocking delays.
- The CPU remains occupied while the 60 ms tone is generated.
- The push button is polled rather than handled using a GPIO interrupt.
- The button-release loop prevents repeated counting during a long press but is not a complete hardware-debounce solution.
- The entire TFT screen is cleared and redrawn after each press.
- A timer or PWM peripheral would be more suitable for generating the buzzer tone in a production application.
This project uses components from the Analog Devices/Maxim Integrated MSDK. Refer to the original source files and the MSDK license terms before redistributing modified versions.