This is my practice on an ARM Cortex-M4F processor (Tiva LaunchPad TM4C123G). Please kindly check sub-folders for more project details.
Board and peripherals:
Play music note on presure sensors: pressure_to_sound.mp4
This bringup project use SysTick interrupt as the main task which periodically check buttons states and drives LED. It also be used to refresh LCD, read inputs, send data. You can add conditions before starting any action in SysTick routine.
In the BringUp project, main loop calls WaitForInterrupt();
to enter sleep mode. Does it actually do what you want?
This project includes CpuUsage
module to monitor the number of clock cycles in which CPU actually does something. Between SYSTICK cycle, CPU only uses some of its clock cycle to do its jobs. TIMER2 will only count those clock cycle when CPU is working.
Shows you how to switch your board to USB Device Firmware Update mode with on-board ROM bootloader. While pressing and holding 2 buttons, press reset to enter bootloader.
To make your own bootloader, this project requires 2 parts: BootLoaderUsb
providing USB DFU, JumpToBootLoader
hooks user input to enter boot loader
In tm4c123gh6pm.cmd, you will add APP_BASE and RAM_BASE, re-config flash address, .intvers location.
You have to flash BOOT LOADER first, then flash APPLCATION later using LM Flash Programmer only, don't use CCS flasher, start address is 0x2800
This shows a menu to user with menu item and controllable settings. It's designed to easily add new item, make new property, run on Nokia 5110
or SH1106 OLED
. Each MenuItem has its own property which can be one of Label, Number, Switch or your Property inherited class. User input will send actions to MainMenu to select up/down, enter/exit menu, change value of selected item, with single click, double click, and long press. Screen is only updated when user interacts with buttons, this keesp CPU idle when not used.
This project uses MCP4921 12b DAC
to play sound. it also includes Audio Generator
to make waves. This project uses uDMA
for faster data transfer. MCP4921
is connected to SSI1 on TM4C123, running at 44.1kHz x 12b. uDMA
transfer data from audio buffer to SSI1, in ping-pong mode. You can play a piece of audio, please check AUDIO_TEST definition.
This project connects to multiple BMP280
sensors on I2C bus and filter received data to make musical note on speaker. You can see the data on graph by enabling PROBE_SENSOR_DATA
to output data on serial. if USE_MIDI_UART
is enabled, you can connect UART to any MIDI synthesizer.