Okay so for those who are interested I think I found the answer after about 10 hours.
I changed Max3421e.cpp from the following:
boolean MAX3421E::reset()
{
byte tmp = 0;
regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
regWr( rUSBCTL, 0x00 ); //Remove the reset
while(!(regRd( rUSBIRQ ) & bmOSCOKIRQ )) { //wait until the PLL is stable
tmp++; //timeout after 256 attempts
if( tmp == 0 ) {
return( false );
}
}
return( true );
}
To this:
boolean MAX3421E::reset()
{
regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
regWr( rUSBCTL, 0x00 ); //Remove the reset
while(!(regRd(rUSBIRQ) & bmOSCOKIRQ)) ;
}
So basically it stays in the loop until it stabilizes and then exists, also to ensure it does turn on and stabilize I stole this function from board_test.pde to ensure it works and the oscillator turns on and stabilizes:
void setup()
{
Serial.begin( 115200 );
//Serial.println("Start");
//Serial.println( SCK_PIN, DEC );
Max.powerOn();
check_OSCOKIRQ();
osctest();
printProgStr( startBanner );
printProgStr( anykey_msg );
//Serial.print( Max.getvar(), DEC);
}
void check_OSCOKIRQ()
{
if( Max.regRd( rUSBIRQ ) & bmOSCOKIRQ ) { //checking oscillator state
printProgStr(PSTR("ON"));
}
else {
printProgStr(PSTR("OFF"));
}
}
/* Oscillator test */
bool osctest()
{
printProgStr(PSTR("\r\nOscillator start/stop test."));
printProgStr( osctest_oscstate_msg );
check_OSCOKIRQ(); //print OSCOK state
printProgStr(PSTR("\r\nSetting CHIP RESET."));
Max.regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
printProgStr( osctest_oscstate_msg );
check_OSCOKIRQ(); //print OSCOK state
printProgStr(PSTR("\r\nClearing CHIP RESET. "));
Max.regWr( rUSBCTL, 0x00 ); //Chip reset release
for( word i = 0; i < 65535; i++) {
if( Max.regRd( rUSBIRQ ) & bmOSCOKIRQ ) {
printProgStr(PSTR("PLL is stable. Time to stabilize - "));
Serial.print( i, DEC );
printProgStr(PSTR(" cycles"));
printProgStr( testpassed_msg );
return( true );
}
}//for i =
return(false);
}
So in the end this is my output:
ON
Oscillator start/stop test. Oscillator state is ON
Setting CHIP RESET. Oscillator state is OFF
Clearing CHIP RESET. PLL is stable. Time to stabilize - 191 cycles
Test PASSED
Circuits At Home 2010
USB Host Shield QC test routine
Press any key to continue...