Hallo,
ich habe ein ARM Starter KIT von IAR System. Das läuft mit dem LPC1786 von NXP. Also Cortex M3. Als Entwicklungsumgebung verwende ich die IAR Embeded Workbench. Nun habe ich versucht ein simples Programm zu schreiben, dass einfach nur eine led einschalten soll. Allerdings tut sich einfach überhaupt nichts.
Hier einmal mein Code. Ich hoffe es kann mir jemand helfen.
mfgCode:#include <nxp/iolpc1768.h> #include <intrinsics.h> #include <assert.h> #include #include <stdio.h> void InitClock(void) { // 1. Init OSC SCS_bit.OSCRANGE = 0; SCS_bit.OSCEN = 1; // 2. Wait for OSC ready while(!SCS_bit.OSCSTAT); // 3. Disconnect PLL PLL0CON_bit.PLLC = 0; PLL0FEED = 0xAA; PLL0FEED = 0x55; // 4. Disable PLL PLL0CON_bit.PLLE = 0; PLL0FEED = 0xAA; PLL0FEED = 0x55; // 5. Select source clock for PLL CLKSRCSEL_bit.CLKSRC = 1; // Selects the main oscillator as a PLL clock source. PCLKSEL0 = PCLKSEL1 = 0; // other peripherals 100/4 = 25MHz // 6. Set PLL settings 300 MHz PLL0CFG_bit.MSEL = 25-1; PLL0CFG_bit.NSEL = 2-1; PLL0FEED = 0xAA; PLL0FEED = 0x55; // 7. Enable PLL PLL0CON_bit.PLLE = 1; PLL0FEED = 0xAA; PLL0FEED = 0x55; // 8. Wait for the PLL to achieve lock while(!PLL0STAT_bit.PLOCK); // 9. Set clk divider settings CCLKCFG = 3-1; // 1/3 Fpll // 10. Connect the PLL PLL0CON_bit.PLLC = 1; PLL0FEED = 0xAA; PLL0FEED = 0x55; } int main() { InitClock(); FLASHCFG=(1<<14); FIO1DIR=(1<<25); FIO1SET=(1<<25); while(1); }
Erik







Zitieren

Lesezeichen