Skip to content

Commit

Permalink
Add additional delays to properly initialize carts.
Browse files Browse the repository at this point in the history
Fixes detection issues for multiple carts.
Thanks profi200, for noticing that the delays were a bit low.
  • Loading branch information
kitlith committed Aug 12, 2017
1 parent 7d4e3f2 commit c397912
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ntrboot_flasher/source/gamecart/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@ void ResetCartSlot(void)
REG_CARDCONF2 = 0x8;
while(REG_CARDCONF2 != 0x8);

ioDelay(0xF000);

REG_NTRCARDROMCNT = 0x20000000;
REG_CARDCONF &= ~3;
REG_CARDCONF &= ~0x100;
REG_NTRCARDMCNTH = NTRCARD_CR1_ENABLE;

ioDelay(0xF000);
// ioDelay(0xF000);
//
// SwitchToNTRCARD();
//
// ioDelay(0xF000);
}

void SwitchToNTRCARD(void)
Expand All @@ -55,8 +52,11 @@ void Cart_NTRInit(void)
{
ResetCartSlot(); //Seems to reset the cart slot?

//SwitchToNTRCARD();
//ioDelay(0x30000);
REG_CTRCARDSECCNT &= 0xFFFFFFFB;
ioDelay(0x40000);

SwitchToNTRCARD();
ioDelay(0x40000);

//REG_CTRCARDCNT |= 0x10000000u;
//REG_CTRCARDCNT2 |= 0x10000000u;
Expand Down
3 changes: 3 additions & 0 deletions ntrboot_flasher/source/gamecart/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#define CARD_SPI_BUSY (1<<7)
#define CARD_SPI_HOLD (1<<6)

// for CTRCARD, but GM9 uses it in NTRCARD init.
#define REG_CTRCARDSECCNT (*(vu32*)0x10004008)

#define LATENCY 0x822C

void Cart_NTRInit(void);
Expand Down

0 comments on commit c397912

Please sign in to comment.