Reply to thread
GBAtemp.net - The Independent Video Game Community
Search
Search titles only
By:
Search titles only
By:
Reply to thread
GBAtemp.net - The Independent Video Game Community
Home
Log in
Terms & Rules
Donate
Forums
New posts
Search forums
Groups
Public Events
New
New posts
New resources
New blog entries
New profile posts
New blog entry comments
New threadmarks
Latest activity
Cheats
Cheat Codes Add and Request group
The Legend of Zelda: Tears of the Kingdom cheat codes
Pokémon Legends: Arceus cheat codes
Xenoblade Chronicles 3 cheat codes
Fire Emblem Engage cheat codes
Request a cheat...
Tutorials
Nintendo Switch tutorials
Nintendo 3DS tutorials
Nintendo Wii U tutorials
Reviews
Overview
Official reviews
User reviews
Downloads
Latest reviews
Search resources
Blogs
New entries
New comments
Blog list
Search blogs
Chat
Top chatters
Search
Search titles only
By:
Search titles only
By:
Log in
Register
New posts
Search forums
Log in
Register
Home
Forums
PC, Console & Handheld Discussions
Nintendo DS
Gathering DS flashcard knowledge - DIY "opencard" idea
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NathaanTFM" data-source="post: 10400922" data-attributes="member: 440562"><p>If you want to write your own program for your microcontroller, I think the best I can do is to explain how mine currently works? I'm not an expert in this field so there are most likely some parts that are wrong.</p><p></p><p>The DS cartridge protocol is documented <a href="https://problemkaputt.de/gbatek-ds-cartridge-protocol.htm" target="_blank">on GBATEK</a>. It works like SPI but with 8 bits of data: you have a Chip Select (CS1) pin, a Clock (CLK, driven by the DS), and input/output. CLK and CS1 are initially high ; when the DS wants to receive or send data to the cartridge (which is a proprietary ROM in official cartridges, and in mine it's a STM32 microcontroller), it firsts drives CS1 low. Then, when CLK becomes low, the console/cartridge drives the pins I/O7 to I/O0 depending on the byte it wants to send. I/O7 is bit 7 (MSB), I/O0 is bit 0 (LSB). High means 1, low means 0. Quick and dirty drawing for the timings. The DS doesn't care when you toggle the pins as long as it gets the value when CLK goes low.</p><p></p><p>[ATTACH=full]431723[/ATTACH]</p><p></p><p>So when a transfer begins, CS1 goes low, and the console transmits 8 bytes (CLK goes low 8 times) ; that's the command. The commands are documented on the page I linked above. After those 8 bytes, there might or might not be a gap, then the transfer reverses ; it's now the cartridge that drives the IO pins. The console still drives the clock, and every time the clock goes down, the console reads a new byte. Retail cartridges drives the I/O pins when the clock goes low, but due to timing issues with my microcontroller, I drive them when the clock goes high. The transfer ends when the console drives CS1 high.</p><p></p><p>The transfer's clock is initially at 4.2MHz, then goes up to 6.7MHz for (all?) retail games. This depends on the cartridge header. There's also encryption (KEY1/KEY2, also documented on GBATEK) and don't forget that there's a whitelist on non-homebrew DSi/3DS units.</p><p></p><p>Don't underestimate the clock rate. I'm using a STM32G431CBU6 which is clocked at 150 MHz, has many DMA channels I'm abusing, and DMA request generators for external interrupts/events. With the transfer rate, I can run *at most* 150/6.7 = 23 cpu instructions between two CLK falling-edges (not counting multi-cycles instructions and the time it takes to read the instruction from the internal flash). I am also using a NOR flash chip which are fast enough for retail games but somewhat expensive.</p><p></p><p>Sorry if that's hard to understand, this is my first time dealing with these and my vocabulary isn't really good (and english isn't my native language). I don't have much free time rn, so I'll try putting my current code for the STM32 cartridge on GitHub soon without bothering to clean it up.</p><p></p><p>EDIT: <a href="https://github.com/NathaanTFM/stm32cart" target="_blank">https://github.com/NathaanTFM/stm32cart</a>. Haven't tested the few edits I've made.</p></blockquote><p></p>
[QUOTE="NathaanTFM, post: 10400922, member: 440562"] If you want to write your own program for your microcontroller, I think the best I can do is to explain how mine currently works? I'm not an expert in this field so there are most likely some parts that are wrong. The DS cartridge protocol is documented [URL='https://problemkaputt.de/gbatek-ds-cartridge-protocol.htm']on GBATEK[/URL]. It works like SPI but with 8 bits of data: you have a Chip Select (CS1) pin, a Clock (CLK, driven by the DS), and input/output. CLK and CS1 are initially high ; when the DS wants to receive or send data to the cartridge (which is a proprietary ROM in official cartridges, and in mine it's a STM32 microcontroller), it firsts drives CS1 low. Then, when CLK becomes low, the console/cartridge drives the pins I/O7 to I/O0 depending on the byte it wants to send. I/O7 is bit 7 (MSB), I/O0 is bit 0 (LSB). High means 1, low means 0. Quick and dirty drawing for the timings. The DS doesn't care when you toggle the pins as long as it gets the value when CLK goes low. [ATTACH type="full" alt="1713115419994.png"]431723[/ATTACH] So when a transfer begins, CS1 goes low, and the console transmits 8 bytes (CLK goes low 8 times) ; that's the command. The commands are documented on the page I linked above. After those 8 bytes, there might or might not be a gap, then the transfer reverses ; it's now the cartridge that drives the IO pins. The console still drives the clock, and every time the clock goes down, the console reads a new byte. Retail cartridges drives the I/O pins when the clock goes low, but due to timing issues with my microcontroller, I drive them when the clock goes high. The transfer ends when the console drives CS1 high. The transfer's clock is initially at 4.2MHz, then goes up to 6.7MHz for (all?) retail games. This depends on the cartridge header. There's also encryption (KEY1/KEY2, also documented on GBATEK) and don't forget that there's a whitelist on non-homebrew DSi/3DS units. Don't underestimate the clock rate. I'm using a STM32G431CBU6 which is clocked at 150 MHz, has many DMA channels I'm abusing, and DMA request generators for external interrupts/events. With the transfer rate, I can run *at most* 150/6.7 = 23 cpu instructions between two CLK falling-edges (not counting multi-cycles instructions and the time it takes to read the instruction from the internal flash). I am also using a NOR flash chip which are fast enough for retail games but somewhat expensive. Sorry if that's hard to understand, this is my first time dealing with these and my vocabulary isn't really good (and english isn't my native language). I don't have much free time rn, so I'll try putting my current code for the STM32 cartridge on GitHub soon without bothering to clean it up. EDIT: [URL]https://github.com/NathaanTFM/stm32cart[/URL]. Haven't tested the few edits I've made. [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
PC, Console & Handheld Discussions
Nintendo DS
Gathering DS flashcard knowledge - DIY "opencard" idea
General chit-chat
Help
Users
Settings
Notifications
Miscellaneous
Inverse message direction
Display editor on top
Enable maximized mode
Display images as links
Hide bot messages
Hide statuses
Hide chatter list
Show messages from ignored users
Temporarily disable chat
Receive mention alerts
Sound notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Desktop notifications
Normal messages
Private messages
Whisper messages
Mention messages
Bot messages
Options
Options
View top chatters
No one is chatting at the moment.
@
BakerMan
:
whale-come to gbatemp
+3
Today at 1:44 AM
@
Sonic Angel Knight
:
Why do we have a baker man when he don't bake stuff? GBATemp cookies, or cake, or something.
Today at 1:46 AM
@
Sonic Angel Knight
:
PIZZA
Today at 1:46 AM
@
K3Nv2
:
Smokies came out gud
Today at 1:46 AM
D
@
diamondsofmayhem
:
Something tells me posting pics of the stuff that comes out of my smoker might go over well here
Today at 1:47 AM
D
@
diamondsofmayhem
:
anyway, I could use a hand, if anyone can point me in the right direction
Today at 1:48 AM
@
Xdqwerty
:
https://www.youtube.com/watch?v=VKqmsCtbKA8
Today at 1:50 AM
D
@
diamondsofmayhem
:
I'll take that as a "no" then...
Today at 1:51 AM
@
Xdqwerty
:
@diamondsofmayhem
, ?
Today at 1:53 AM
@
Xdqwerty
:
@Sonic Angel Knight
, he does bake stuff
Today at 1:54 AM
D
@
diamondsofmayhem
:
sorry, beein trying to find this file that's been right in front of me for a month now, only to find broken links, and google to prove that it's completely worthless.
Today at 1:55 AM
D
@
diamondsofmayhem
:
It's proven quite frustrating.
Today at 1:55 AM
D
@
diamondsofmayhem
:
don't get me wrong, it's just a cheat plugin, but one for a game I want to absolutely destroy
Today at 1:59 AM
@
Xdqwerty
:
@diamondsofmayhem
, what game?
Today at 2:00 AM
D
@
diamondsofmayhem
:
Hyrule Warriors legends
Today at 2:00 AM
D
@
diamondsofmayhem
:
The only link I've been able to find for my version is here:
https://gbatemp.net/threads/release-hyrule-warriors-legends-save-editor-ntr-plugin.411349/
the US/EUR version, but the link is dead.
Today at 2:06 AM
D
@
diamondsofmayhem
:
and, I'll be honest, I don't even know if I'm in the right spot to be asking for help.
Today at 2:08 AM
@
Xdqwerty
:
@diamondsofmayhem
, try making a thread
Today at 2:09 AM
D
@
diamondsofmayhem
:
in which forum? there's several.
Today at 2:09 AM
@
Psionic Roshambo
:
Having every channel is fun lol
Today at 2:09 AM
D
@
diamondsofmayhem
:
Actually, finally found someone who was looking for the same thing.
https://gbatemp.net/threads/lost-hyrule-warriors-legends-v1-6-0-ntr-plugin.628141/
to no avail.
Today at 2:14 AM
D
@
diamondsofmayhem
:
well, sorry for bugging yall with this.
Today at 2:15 AM
@
Xdqwerty
:
@diamondsofmayhem
, dont worry
Today at 2:15 AM
@
Xdqwerty
:
good night
Today at 2:19 AM
D
@
diamondsofmayhem
:
G'night!
Today at 2:20 AM
Submit
D
@
diamondsofmayhem
:
G'night!
Today at 2:20 AM
Chat
0