Skip to content

About

Step counter using general purpose switch, TFT Display and Buzzer.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

MAX32690EVKIT SW2 Counter with TFT and Buzzer

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.

Features

  • Counts presses of the onboard SW2 push 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.26 as 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.

Hardware Required

  • 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

Hardware Connections

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.

How It Works

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.

Buzzer Generation

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  60

The 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.

Software Requirements

  • Visual Studio Code
  • Analog Devices CodeFusion Studio
  • MAX32690 MSDK support
  • MAX32690EVKIT board support package
  • MAX32625PICO CMSIS-DAP debugger
  • OpenOCD, included with CodeFusion Studio/MSDK

Build with CodeFusion Studio

  1. Open the project folder in Visual Studio Code.
  2. Configure the workspace as a CodeFusion Studio project.
  3. Select the following target settings:
Device: MAX32690
Board: EvKit_V1 / MAX32690EVKIT
Platform: MSDK
Core: Arm Cortex-M4
Debugger: CMSIS-DAP
Interface: SWD
  1. Build the project:
Ctrl + Shift + B

Select:

CFS: build
  1. Connect the MAX32625PICO to the MAX32690EVKIT SWD header.
  2. Power the MAX32690EVKIT.
  3. Flash and run the program using:
CFS: flash and run

Build with the MSDK Command Line

From the project directory, run:

make TARGET=MAX32690 BOARD=EvKit_V1

To flash the generated firmware through OpenOCD, run:

make flash.openocd

The exact command may vary depending on the installed MSDK version and project configuration.

Source Code Overview

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

Program Flow

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

Limitations

  • 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.

License

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.

About

Step counter using general purpose switch, TFT Display and Buzzer.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages