
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 0.70 KB | hits: 4 | expires: Never
#include "memorymap.h"
__asm__(".word 0x20001000");
__asm__(".word main");
main()
{
RCC_CR = 0x11030003;
RCC_CFGR = 0x06000009;
RCC_APB2RSTR = 0x1001;
//RCC_AHBENR = 0x400;
RCC_APB2ENR = 0x1005;
//RCC_APB1ENR = 0x10200000;
GPIOA_CRL = 0xB0B00000; // Alternate function Push Pull enable on PA7/5
GPIOA_CRH = 0xB; // MCO CLOCK ENABLE on PA8
//GPIOA_ODR = 0xA0;
//GPIOA_LCKR = 0x00000000;
//I2C1 setup
//I2C1_CR2 = 0x08;
//I2C1_CCR = 0x28;
//I2C1_TRISE = 0x09;
//I2C1_CR1 = 0x101;
SPI1_CR1 = 0x947;
SPI1_CR2 = 0x0;
SPI1_SR = 2;
// SPI1 setup
SPI1_DR = 0x33;
while(1)
{
if(!(SPI1_SR & (1 << 7)))
SPI1_DR = 0xFF;
}
}