Skip to content

Commit 08a22f0

Browse files
committed
Uploaded 10_11_2024
1 parent 7def95c commit 08a22f0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

XTMax/Code/XTMax/XTMax.ino

+11-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Revision 2 10/5/2024
2222
// Added support for SD to Parallel interface
2323
//
24+
// Revision 3 10/11/2024
25+
// Added variable wait states for Expanded RAM
26+
// - For 4.77 Mhz, can be changed to zero wait states for Write cycles and two for Read cycles
27+
//
2428
//------------------------------------------------------------------------
2529
//
2630
// Copyright (c) 2024 Ted Fried
@@ -330,7 +334,7 @@ inline uint8_t PSRAM_Read(uint32_t address_in) {
330334
nibble_out = address_in >> 4; PSRAM_Write_Clk_Cycle();
331335
nibble_out = address_in; PSRAM_Write_Clk_Cycle();
332336

333-
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_HIGH + DATA_OE_n_LOW + CHRDY_OE_n_HIGH; // Two WAIT STATES
337+
//GPIO8_DR = sd_pin_outputs + MUX_DATA_n_HIGH + CHRDY_OE_n_HIGH + DATA_OE_n_LOW; // De-assert CHRDY early for 4.77 Mhz
334338

335339

336340
// Four clocks of hi-Z - Make PSRAM Data signals hi-Z during this time
@@ -376,7 +380,7 @@ inline uint8_t PSRAM_Write(uint32_t address_in , int8_t local_data) {
376380
nibble_out = address_in >> 4; PSRAM_Write_Clk_Cycle();
377381
nibble_out = address_in; PSRAM_Write_Clk_Cycle();
378382

379-
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_HIGH + CHRDY_OE_n_HIGH + DATA_OE_n_LOW; // de-assert wait state
383+
//GPIO8_DR = sd_pin_outputs + MUX_DATA_n_HIGH + CHRDY_OE_n_HIGH + DATA_OE_n_LOW; // De-assert CHRDY early for 4.77 Mhz
380384

381385

382386
// Send byte data in twp clock cycles
@@ -411,6 +415,8 @@ inline void Mem_Read_Cycle() {
411415

412416
isa_data_out = PSRAM_Read(psram_address);
413417
GPIO7_DR = GPIO7_DATA_OUT_UNSCRAMBLE + MUX_ADDR_n_LOW + CHRDY_OUT_LOW + trigger_out; // Output data
418+
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_HIGH + CHRDY_OE_n_HIGH + DATA_OE_n_LOW; // De-assert CHRDY
419+
414420

415421

416422
while ( (gpio9_int&0xF0) != 0xF0 ) { gpio9_int = GPIO9_DR; } // Wait here until cycle is complete
@@ -449,13 +455,15 @@ inline void Mem_Write_Cycle() {
449455
else if (page_base_address == 0xE0000) { psram_address = (reg_0x260<<14) | (isa_address & 0x03FFF); }
450456

451457
GPIO7_DR = GPIO7_DATA_OUT_UNSCRAMBLE + MUX_ADDR_n_HIGH + CHRDY_OUT_LOW + trigger_out;
452-
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_LOW + CHRDY_OE_n_HIGH + DATA_OE_n_HIGH; // Steer data mux to Data[7:0] and Assert CHRDY_n=0 to begin wait states
458+
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_LOW + CHRDY_OE_n_LOW + DATA_OE_n_HIGH; // Steer data mux to Data[7:0] and Assert CHRDY_n=0 to begin wait states
453459

454460
delayNanoseconds(10); // Wait some time for buffers to switch from address to data
455461

456462
gpio6_int = GPIO6_DR;
457463
data_in = 0xFF & ADDRESS_DATA_GPIO6_UNSCRAMBLE;
458464
PSRAM_Write(psram_address , data_in);
465+
GPIO8_DR = sd_pin_outputs + MUX_DATA_n_LOW + CHRDY_OE_n_HIGH + DATA_OE_n_HIGH; // De-assert CHRDY
466+
459467

460468
while ( (gpio9_int&0xF0) != 0xF0 ) { // Wait here until cycle is complete
461469
gpio6_int = GPIO6_DR; // Needed?

0 commit comments

Comments
 (0)