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.
Diff: main.cpp
- Revision:
- 7:b98d752b7b95
- Parent:
- 6:a27c0fd4f210
--- a/main.cpp	Tue Oct 02 01:16:03 2012 +0000
+++ b/main.cpp	Tue Oct 02 23:53:32 2012 +0000
@@ -4,7 +4,7 @@
 #include "JTAG.h"
 using namespace std;
 
-//#define FILE_OUTPUT
+#define FILE_OUTPUT
 
 DigitalOut RESET (p21);
 
@@ -40,12 +40,12 @@
     address = 0x44000004;
     jtag.writeMemory(address, value);
     //core is running......
-    
-    
+
+
     int* ro_readings = new int [70]; //0-63: Oscillator (DDRO), 64-65: SRAM/Core Power, 66-69: Leakage
     master_write();
     master_read(ro_readings);
-    
+
     if( some GPIO != 0) {powerDown();}
 }
 */
@@ -56,7 +56,7 @@
     double voltage = 1;
     PLL clk;
     JTAG jtag;
-    int* ro_readings = new int [70];
+    int* ro_readings = new int [68];
 #ifdef FILE_OUTPUT
     FILE *outFile = fopen("/local/test.out", "a");
 #endif
@@ -77,22 +77,16 @@
 #ifdef FILE_OUTPUT
                 fprintf(outFile, "RO %d %d\n", ii, ro_readings[ii]);
 #endif
-                s.printf("RO %d %d\n", ii, ro_readings[ii]);
             }
-#ifdef FILE_OUTPUT
-            fprintf(outFile, "CORE %X\nSRAM %X\n", ro_readings[64],ro_readings[65]);
-#endif
             double core_meas = 3.3*ro_readings[64]/0x10000;
             double sram_meas = 3.3*ro_readings[65]/0x10000;
-            s.printf("CORE %X\nSRAM %X\n", ro_readings[64],ro_readings[65]);
-            s.printf("CORE %f\nSRAM %f\n", core_meas, sram_meas);
-            double rvtp_meas = 3.3*ro_readings[66]/0x10000;
-            double hvtp_meas = 3.3*ro_readings[67]/0x10000;
-            double rvtn_meas = 3.3*ro_readings[68]/0x10000;
-            double hvtn_meas = 3.3*ro_readings[69]/0x10000;
 #ifdef FILE_OUTPUT
-            fprintf(outFile, "RVTP %X\nHVTP %X\nRVTN %X\nHVTN %X\n", ro_readings[66],ro_readings[67], ro_readings[68],ro_readings[69]);
-            fprintf(outFile, "RVTP %f\nHVTP %f\nRVTN %f\nHVTN %f\n", rvtp_meas, hvtp_meas, rvtn_meas, hvtn_meas);
+            fprintf(outFile, "CORE %f\nSRAM %f\n", core_meas,sram_meas);
+#endif
+            double hvtp_meas = 1.8*0.33/ro_readings[66]/0.001;
+            double hvtn_meas = 1.5*0.33/ro_readings[67]/0.001;
+#ifdef FILE_OUTPUT
+            fprintf(outFile, "HVTP %f\nHVTN %f\n", hvtp_meas, hvtn_meas);
 #endif
         }
         int fmax;
@@ -105,16 +99,7 @@
         wait_us(10);
         RESET = 1;
 
-        // power characterization
-        frequency = 151;
-        clk.setPLL(frequency);
-        clk.setPLL(frequency);
-        RESET = 0;
-        wait_us(10);
-        RESET = 1;
-        //jtag.JTAG_test();
-        /*
-        while (higher - lower >30) {
+        while (higher - lower >1) {
             s.printf("testing %d\n", frequency);
             if(jtag.JTAG_test()) {
                 lower = frequency;
@@ -134,12 +119,11 @@
                 RESET = 1;
             }
         }
-        */
         
+
 #ifdef FILE_OUTPUT
         fprintf(outFile, "fmax %d\n", lower*5);
 #endif
-        s.printf("fmax %d\n", lower*5);
         powerDown();
     }
 #ifdef FILE_OUTPUT