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
- Committer:
- liangzhen
- Date:
- 2012-09-20
- Revision:
- 3:764ccaf29ce9
- Parent:
- 2:42e8a4eb3c00
- Child:
- 4:fc56fa8aa794
File content as of revision 3:764ccaf29ce9:
#include "power_up.h"
#include "scan.h"
#include "master_i2c.h"
#include "JTAG.h"
using namespace std;
DigitalOut RESET (p21);
Serial s(USBTX, USBRX);
DigitalOut finish_flag (LED3);
int main()
{
s.printf("DDRO_software starts ...\r\n");
double voltage = 1;
PLL clk;
JTAG jtag;
int* ro_readings = new int [64];
FILE *outFile = fopen("/local/test.out", "a");
for (int i=0; i<7; i++) {
voltage = 1 - 0.05*i;
powerReset();
powerUp(voltage);
fprintf(outFile, "Voltage: %f\n", voltage);
RESET = 0;
wait_us(10);
RESET = 1;
master_write();
master_read(ro_readings);
for (int ii=0; ii<64; ii++) {
fprintf(outFile, "RO %d %d\n", ii, ro_readings[ii]);
}
int fmax;
int lower = 51;
int higher = 199;
int frequency = (lower+higher)/2;
clk.setPLL(frequency))
RESET = 0;
wait_us(10);
RESET = 1;
while (higher - lower >1) {
if(jtag.JTAG_test()) {
lower = frequency;
frequency = (lower+higher)/2;
clk.setPLL(frequency);
RESET = 0;
wait_us(10);
RESET = 1;
} else {
higher = frequency;
frequency = (lower+higher)/2;
clk.setPLL(frequency);
RESET = 0;
wait_us(10);
RESET = 1;
}
}
fprintf(outFile, "fmax %d\n", lower*5);
powerDown();
}
fclose(outFile);
s.printf("DDRO_software ends.\r\n");
while(1) {
finish_flag = !finish_flag;
wait(1);
}
}