Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 // using a led 00004 DigitalOut myled(LED1); 00005 00006 void DisconnectPLL0(){ 00007 // good practice to disable before feeding 00008 __disable_irq(); 00009 // disconnect 00010 LPC_SC->PLL0CON = 0x1; 00011 LPC_SC->PLL0FEED = 0xAA; 00012 LPC_SC->PLL0FEED = 0x55; 00013 while (LPC_SC->PLL0STAT&(1<<25)); 00014 // power down 00015 LPC_SC->PLL0CON = 0x0; 00016 LPC_SC->PLL0FEED = 0xAA; 00017 LPC_SC->PLL0FEED = 0x55; 00018 while (LPC_SC->PLL0STAT&(1<<24)); 00019 // This is the default flash read/write setting for IRC 00020 LPC_SC->FLASHCFG &= 0x0fff; 00021 LPC_SC->FLASHCFG |= 0x5000; 00022 LPC_SC->CCLKCFG = 0x0; 00023 // Select the IRC as clk 00024 LPC_SC->CLKSRCSEL = 0x00; 00025 // not using XTAL anymore 00026 LPC_SC->SCS = 0x00; 00027 } 00028 00029 // IAP address 00030 #define IAP_LOCATION 0x1FFF1FF1 00031 // variable for command and result 00032 unsigned int command[5]; 00033 unsigned int result[5]; 00034 // function pointer with 2 array parameters 00035 typedef void (*IAP)(unsigned int[5],unsigned int [5]); 00036 // declaration of the fptr. 00037 IAP iap_entry = (IAP)IAP_LOCATION; 00038 00039 int main(){ 00040 00041 //! change clk to 4MHz - see below 00042 DisconnectPLL0(); 00043 //! stop all ISRs 00044 __disable_irq(); 00045 //!make IAP call 00046 command[0] = 57; 00047 iap_entry(command, result); 00048 00049 //! This should never get executed 00050 while(1) { 00051 myled = 1; 00052 wait(0.2); 00053 myled = 0; 00054 wait(0.2); 00055 } 00056 }
Generated on Sat Jul 16 2022 01:57:39 by
1.7.2