Skip to content

Instantly share code, notes, and snippets.

View Aflecht's full-sized avatar

Kraku Aflecht

  • Helsinki
View GitHub Profile
@Aflecht
Aflecht / MIDI_IO_LPC43xx.cpp
Last active August 29, 2015 13:57
MIDI I/O with NXP LPC43xx micro controller (ARM Cortex M4 MCU)
#define CMSIS_BITPOSITIONS
#include <__cross_studio_io.h>
#include "lpc43xx.h"
//
// Configure LPC43xx ARM Cortex M4 microcontroller to 204 MHz using 12 MHz crystal
//
void Configure_Main_Clock_And_Busses()
@Aflecht
Aflecht / System_Configuration_LPC43xx.cpp
Last active June 22, 2021 11:41
Configure LPC43xx ARM Cortex M4 microcontroller to 204 MHz using 12 MHz crystal.
//
// Configure LPC43xx ARM Cortex M4 microcontroller to 204 MHz using 12 MHz crystal
//
#define CMSIS_BITPOSITIONS
#include "lpc43xx.h"
void Configure_Clocks()
{
@Aflecht
Aflecht / SysTick_Timer_Example_01.cpp
Created January 30, 2014 15:56
ARM Cortex microcontroller SysTick timer example.
// Initialize SysTick timer
uint32_t* p_systick = (uint32_t*) 0xE000E010; // SysTick memory address
p_systick[1] = 0x00FFFFFF; // This value will be loaded automatically into p_systick[2] everytime the counter hits zero
p_systick[2] = 0x00000000; // Set from which value we start counting down
p_systick[0] |= 1; // Start the SysTick timer
// Reset the SysTick counter to ANY 24bit value WHENEVER you want
// The timer instantly starts counting down from that value
// Here we reset it to its max value of 0x00FFFFFF
p_systick[2] = 0x00FFFFFF;
@Aflecht
Aflecht / System_Configuration.cpp
Last active January 18, 2024 10:06
How to configure STM32F37x ARM Cortex M4 microcontroller to 72 MHz? (using 8 MHz crystal)
//
// Clock STM32F37x to 72 MHz using 8 MHz crystal
//
#include <stm32f37x.h>
/*
AHB = max 72 MHz
APB2 = max 72 MHz
APB1 = max 36 MHz