Skip to content

Commit

Permalink
Updated tester software
Browse files Browse the repository at this point in the history
  • Loading branch information
GideonZ committed Mar 21, 2018
1 parent fb11f96 commit aa25943
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 20 deletions.
37 changes: 27 additions & 10 deletions software/application/tester/dut_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ void hexword(uint32_t data)
outbyte('\n');
}

#define CLK_DIVIDER 9
#define CLK_DIVIDER 10
#define VCO_PHASE_STEPS 8
#define PHASE_STEPS (CLK_DIVIDER * VCO_PHASE_STEPS)

// EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE0000000000000000000000000000000000000000000EEEEEE
// EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE0000000000000000000000000000000000000000000EEEEEE

int main()
{
outbyte('@');
Expand Down Expand Up @@ -104,31 +107,31 @@ int main()
}
// alt_putstr("DDR2 Initialized!\n\r"); // delay!

outbyte('W');

DDR2_TESTLOC0 = TESTVALUE1;
DDR2_TESTLOC1 = TESTVALUE2;

int mode, phase, rep, good;
int last_begin, best_pos, best_length;
int state;
int best_mode = -1;
int final_pos = 0;
int best_overall = -1;

uint32_t testvalue1 = TESTVALUE1;
uint32_t testvalue2 = TESTVALUE2;

for (mode = 0; mode < 4; mode ++) {
outbyte('\n');
DDR2_READMODE = mode;
state = 0;
best_pos = -1;
best_length = 0;
for (phase = 0; phase < (2 * PHASE_STEPS); phase ++) { // 720 degrees
DDR2_TESTLOC0 = testvalue1;
DDR2_TESTLOC1 = testvalue2;
good = 0;
// hexword(DDR2_TESTLOC0);
for (rep = 0; rep < 7; rep ++) {
if (DDR2_TESTLOC0 == TESTVALUE1)
if (DDR2_TESTLOC0 == testvalue1)
good++;
if (DDR2_TESTLOC1 == TESTVALUE2)
if (DDR2_TESTLOC1 == testvalue2)
good++;
}
DDR2_PLLPHASE = 0x33; // move read clock
Expand All @@ -147,8 +150,9 @@ int main()
best_pos = last_begin + (best_length >> 1);
}
}
if (testvalue1 & 0x80000000) testvalue1 = (testvalue1 << 1) | 1; else testvalue1 <<= 1;
if (testvalue2 & 0x80000000) testvalue2 = (testvalue2 << 1) | 1; else testvalue2 <<= 1;
}
// printf(": %d\n\r", best_pos);
if (best_length > best_overall) {
best_overall = best_length;
best_mode = mode;
Expand All @@ -168,7 +172,20 @@ int main()
outbyte('\r');
outbyte('\n');

while(1) {
int errors = 0;
for (i=0;i<2000;i++)
ram[i] = 0xABCDE000 + i;
for (i=0;i<2000;i++)
if (ram[i] != 0xABCDE000 + i)
errors++;

if (errors) {
puts("RAM ERROR");
while(1)
;
}

while(1) {
puts("Waiting for JTAG download");
JUMP_LOCATION = 0;
while(!JUMP_LOCATION)
Expand Down
4 changes: 3 additions & 1 deletion software/application/tester/tester_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,11 @@ int checkUsbHub(JTAG_Access_t *target, int timeout, char **log)
{
uint32_t powerBits = (IORD_ALTERA_AVALON_PIO_DATA(PIO_1_BASE) & 0x700) >> 8;
printf("Before turning on USB power: Power bits: %2x\n", powerBits);
/*
if (powerBits != 0x00) {
printf("-> There seems to be power on the USB sticks, while they have not yet been turned on. (Check VR6)\n");
}
*/
// Now, let's start the USB stack on the DUT
int usb = executeDutCommand(target, 11, timeout, log);
if (usb) {
Expand Down Expand Up @@ -1352,7 +1354,7 @@ void usage()
char date[48];
char time[48];

printf("\n** Ultimate 2+ Tester *** V1.6 *** ");
printf("\n** Ultimate 2+ Tester *** V1.7 *** ");
printf("%s %s ***\n", rtc.get_long_date(date, 40), rtc.get_time_string(time, 40));
printf("Press 'j' or left button on Tester to run test on JIG.\n");
printf("Press 's' or right button on Tester to run test in Slot.\n");
Expand Down
4 changes: 3 additions & 1 deletion software/io/usb/usb_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ extern "C" {

UsbBase usb2;

// #define printf(...)
#if DISABLE_USB_DEBUG
#define printf(...)
#endif

UsbBase :: UsbBase()
{
Expand Down
4 changes: 3 additions & 1 deletion software/io/usb/usb_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ extern "C" {
#include <string.h>
#include "task.h"

// #define printf(...)
#if DISABLE_USB_DEBUG
#define printf(...)
#endif

__inline uint16_t le16_to_cpu(uint16_t h)
{
Expand Down
4 changes: 3 additions & 1 deletion software/io/usb/usb_hub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ extern "C" {
#include "usb_hub.h"
#include "FreeRTOS.h"

// #define printf(...)
#if DISABLE_USB_DEBUG
#define printf(...)
#endif

__inline uint32_t cpu_to_32le(uint32_t a)
{
Expand Down
4 changes: 2 additions & 2 deletions target/fpga/testexec/nios_tester.sopcinfo
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<EnsembleReport name="nios_tester" kind="nios_tester" version="1.0" fabric="QSYS">
<!-- Format version 15.1 185 (Future versions may contain additional information.) -->
<!-- 2018.03.19.22:37:55 -->
<!-- 2018.03.21.22:23:39 -->
<!-- A collection of modules and connections -->
<parameter name="AUTO_GENERATION_ID">
<type>java.lang.Integer</type>
<value>1521495474</value>
<value>1521667419</value>
<derived>false</derived>
<enabled>true</enabled>
<visible>false</visible>
Expand Down
4 changes: 2 additions & 2 deletions target/fpga/testexec/virtual_jtag.sopcinfo
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<EnsembleReport name="virtual_jtag" kind="virtual_jtag" version="1.0" fabric="QSYS">
<!-- Format version 15.1 185 (Future versions may contain additional information.) -->
<!-- 2018.03.19.22:37:41 -->
<!-- 2018.03.21.22:23:29 -->
<!-- A collection of modules and connections -->
<parameter name="AUTO_GENERATION_ID">
<type>java.lang.Integer</type>
<value>1521495461</value>
<value>1521667409</value>
<derived>false</derived>
<enabled>true</enabled>
<visible>false</visible>
Expand Down
2 changes: 1 addition & 1 deletion target/software/nios2_dut/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SRCS_IEC =
SRCS_NANO = nano_phytest.nan nano_minimal.nan

PATH_INC = $(addprefix -I, $(VPATH))
OPTIONS = -g -ffunction-sections -O0 -Wno-write-strings -mno-hw-div -mno-hw-mul -mno-hw-mulx -DRECOVERY=0 -DNIOS=1
OPTIONS = -g -ffunction-sections -O0 -Wno-write-strings -mno-hw-div -mno-hw-mul -mno-hw-mulx -DRECOVERY=0 -DNIOS=1 -DDISABLE_USB_DEBUG=1
COPTIONS = $(OPTIONS) -std=gnu99
CPPOPT = $(OPTIONS) -fno-exceptions -fno-rtti -fno-threadsafe-statics -fpermissive
BSP = $(PATH_SW)/nios_dut_bsp
Expand Down
2 changes: 1 addition & 1 deletion target/software/nios2_tester/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SRCS_IEC =
SRCS_NANO = nano_minimal.nan

PATH_INC = $(addprefix -I, $(VPATH))
OPTIONS = -g -ffunction-sections -O0 -Wno-write-strings -mno-hw-div -mno-hw-mul -mno-hw-mulx -DOS=1 -DNIOS=1
OPTIONS = -g -ffunction-sections -O0 -Wno-write-strings -mno-hw-div -mno-hw-mul -mno-hw-mulx -DOS=1 -DNIOS=1 -DDISABLE_USB_DEBUG=1
COPTIONS = $(OPTIONS) -std=gnu99
CPPOPT = $(OPTIONS) -fno-exceptions -fno-rtti -fno-threadsafe-statics -fpermissive
BSP = $(PATH_SW)/nios_tester_bsp
Expand Down

0 comments on commit aa25943

Please sign in to comment.