mirror of
https://github.com/sanni/cartreader.git
synced 2025-01-23 10:21:10 +01:00
Make clockgen calibration optional
This commit is contained in:
parent
0c42af0941
commit
a981bb0c3e
@ -4,8 +4,8 @@
|
|||||||
This project represents a community-driven effort to provide
|
This project represents a community-driven effort to provide
|
||||||
an easy to build and easy to modify cartridge dumper.
|
an easy to build and easy to modify cartridge dumper.
|
||||||
|
|
||||||
Date: 02.10.2021
|
Date: 14.10.2021
|
||||||
Version: 6.7
|
Version: 6.8
|
||||||
|
|
||||||
SD lib: https://github.com/greiman/SdFat
|
SD lib: https://github.com/greiman/SdFat
|
||||||
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
LCD lib: https://github.com/adafruit/Adafruit_SSD1306
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
**********************************************************************************/
|
**********************************************************************************/
|
||||||
|
|
||||||
char ver[5] = "6.7";
|
char ver[5] = "6.8";
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Libraries
|
Libraries
|
||||||
|
@ -421,13 +421,18 @@ void setup_N64_Cart() {
|
|||||||
|
|
||||||
#ifdef clockgen_installed
|
#ifdef clockgen_installed
|
||||||
// Adafruit Clock Generator
|
// Adafruit Clock Generator
|
||||||
// last number is the clock correction factor which is custom for each clock generator
|
|
||||||
|
#ifdef clockgen_calibration
|
||||||
int32_t clock_offset = readClockOffset();
|
int32_t clock_offset = readClockOffset();
|
||||||
if (clock_offset > INT32_MIN) {
|
if (clock_offset > INT32_MIN) {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
||||||
} else {
|
} else {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// last number is the clock correction factor which is custom for each clock generator
|
||||||
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set Eeprom clock to 2Mhz
|
// Set Eeprom clock to 2Mhz
|
||||||
clockgen.set_freq(200000000ULL, SI5351_CLK1);
|
clockgen.set_freq(200000000ULL, SI5351_CLK1);
|
||||||
@ -1713,7 +1718,7 @@ int strcicmp(char const * a, char const * b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef slowcrc
|
#ifndef fastcrc
|
||||||
// Calculate dumped rom's CRC32
|
// Calculate dumped rom's CRC32
|
||||||
inline uint32_t updateCRC64(uint8_t ch, uint32_t crc) {
|
inline uint32_t updateCRC64(uint8_t ch, uint32_t crc) {
|
||||||
uint32_t idx = ((crc) ^ (ch)) & 0xff;
|
uint32_t idx = ((crc) ^ (ch)) & 0xff;
|
||||||
@ -2908,7 +2913,7 @@ redumpsamefolder:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dumping rom slow
|
// dumping rom slow
|
||||||
#ifdef slowcrc
|
#ifndef fastcrc
|
||||||
// get current time
|
// get current time
|
||||||
unsigned long startTime = millis();
|
unsigned long startTime = millis();
|
||||||
|
|
||||||
|
@ -606,12 +606,17 @@ void setup_SFM() {
|
|||||||
//PORTH &= ~(1 << 1);
|
//PORTH &= ~(1 << 1);
|
||||||
|
|
||||||
// Adafruit Clock Generator
|
// Adafruit Clock Generator
|
||||||
|
#ifdef clockgen_calibration
|
||||||
int32_t clock_offset = readClockOffset();
|
int32_t clock_offset = readClockOffset();
|
||||||
if (clock_offset > INT32_MIN) {
|
if (clock_offset > INT32_MIN) {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
||||||
} else {
|
} else {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
clockgen.set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
|
clockgen.set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
|
||||||
clockgen.set_pll(SI5351_PLL_FIXED, SI5351_PLLB);
|
clockgen.set_pll(SI5351_PLL_FIXED, SI5351_PLLB);
|
||||||
clockgen.set_freq(2147727200ULL, SI5351_CLK0);
|
clockgen.set_freq(2147727200ULL, SI5351_CLK0);
|
||||||
|
@ -436,13 +436,17 @@ void setup_Snes() {
|
|||||||
//PORTJ &= ~(1 << 0);
|
//PORTJ &= ~(1 << 0);
|
||||||
|
|
||||||
// Adafruit Clock Generator
|
// Adafruit Clock Generator
|
||||||
// last number is the clock correction factor which is custom for each clock generator
|
#ifdef clockgen_calibration
|
||||||
int32_t clock_offset = readClockOffset();
|
int32_t clock_offset = readClockOffset();
|
||||||
if (clock_offset > INT32_MIN) {
|
if (clock_offset > INT32_MIN) {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, clock_offset);
|
||||||
} else {
|
} else {
|
||||||
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// last number is the clock correction factor which is custom for each clock generator
|
||||||
|
clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set clocks to 4Mhz/1Mhz for better SA-1 unlocking
|
// Set clocks to 4Mhz/1Mhz for better SA-1 unlocking
|
||||||
clockgen.set_freq(100000000ULL, SI5351_CLK1); // CPU
|
clockgen.set_freq(100000000ULL, SI5351_CLK1); // CPU
|
||||||
|
@ -10,9 +10,17 @@
|
|||||||
#define enable_OLED
|
#define enable_OLED
|
||||||
// Skip OLED start-up animation
|
// Skip OLED start-up animation
|
||||||
// #define fast_start
|
// #define fast_start
|
||||||
|
|
||||||
// Enable the second button
|
// Enable the second button
|
||||||
#define enable_Button2
|
#define enable_Button2
|
||||||
|
|
||||||
|
// Setup RTC if installed.
|
||||||
|
// remove // if you have an RTC installed
|
||||||
|
// #define RTC_installed
|
||||||
|
|
||||||
|
// Use calibration data from snes_clk.txt
|
||||||
|
// #define clockgen_calibration
|
||||||
|
|
||||||
//******************************************
|
//******************************************
|
||||||
// ENABLED MODULES
|
// ENABLED MODULES
|
||||||
//******************************************
|
//******************************************
|
||||||
@ -35,14 +43,10 @@
|
|||||||
//******************************************
|
//******************************************
|
||||||
// Read N64 Eeprom with Adadruit clockgen, CLK1 switch needs to be switch to ON
|
// Read N64 Eeprom with Adadruit clockgen, CLK1 switch needs to be switch to ON
|
||||||
// add // and disable CLK1 switch if you don't have the clockgen installed or if you want to read a repros save
|
// add // and disable CLK1 switch if you don't have the clockgen installed or if you want to read a repros save
|
||||||
#define clockgen_installed
|
// #define clockgen_installed
|
||||||
|
|
||||||
// Define CRC method for dumping N64 ROMs, slow seems to be more compatible with some SD cards
|
// The CRC for N64 Roms will be calculated during dumping from memory instead of after dumping from SD card, not compatible to all Cart Readers
|
||||||
#define slowcrc // crc will be calculated after dumping from SD card instead of during dumping from memory
|
// #define fastcrc
|
||||||
|
|
||||||
// saves a n64log.txt file with rom info in /N64/ROM
|
// saves a n64log.txt file with rom info in /N64/ROM
|
||||||
#define savesummarytotxt
|
// #define savesummarytotxt
|
||||||
|
|
||||||
// Setup RTC if installed.
|
|
||||||
// remove // if you have an RTC installed
|
|
||||||
// #define RTC_installed
|
|
||||||
|
@ -3,7 +3,5 @@
|
|||||||
|
|
||||||
#include "SdFat.h"
|
#include "SdFat.h"
|
||||||
#include "atoi32.h"
|
#include "atoi32.h"
|
||||||
|
|
||||||
int32_t readClockOffset();
|
int32_t readClockOffset();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user