Hacking DEAD [Shutdown]DragonInjector - Game Cart Payload Injector (Trinket M0 Clone)

Status
Not open for further replies.

chippy

Well-Known Member
Member
Joined
Dec 21, 2017
Messages
321
Trophies
0
Age
124
XP
967
Country
Australia
So you basically put the sx pro on a little case that fits in the switch game card slot?
A lot of work has gone into this. They are using a trinket m0 board. Custom designed for the layout and what not on the board. Multi rounds of power solutions.
So to say "he put the sx pro in a smaller case" is insulting to the work the creator has done. He even looked into the game cart slot to charge the dingle but the switch turns off the power to the cart slot if the cart doesn't give the correct response
 

linuxares

The inadequate, autocratic beast!
Global Moderator
Joined
Aug 5, 2007
Messages
13,326
Trophies
2
XP
18,195
Country
Sweden
Hmm the plastic seems a bit flimsy, and easily breakable. Will you do other heavier/better quality plastic molds?
 

jscjml

Monster Hunter
Member
Joined
Jan 4, 2015
Messages
334
Trophies
0
Age
29
Location
Las Vegas
XP
256
Country
United States
So... does this work completely by itself? You said the jig is included in the cart, ok thats step 1. But how about injecting the payload to the switch? Is that done through the game cart? Sorry I couldnt understand fully reading the post.

If this is the case count me in. Would even consider buying my carts again digitally just to be able to have this inside the console 100% of the time.
 

nightweb

Well-Known Member
Member
Joined
Sep 16, 2009
Messages
268
Trophies
1
XP
2,267
Country
Ireland
So... does this work completely by itself? You said the jig is included in the cart, ok thats step 1. But how about injecting the payload to the switch? Is that done through the game cart? Sorry I couldnt understand fully reading the post.

If this is the case count me in. Would even consider buying my carts again digitally just to be able to have this inside the console 100% of the time.

the best way to know how this works is to watch it in action, MatinatorX (I'm probably butchering the spelling) posted a video to YouTube showing the first prototype in action.


Here's the video he posted today, showing changing the battery and using the Jig too :

it's basically a Jig, Injector all in the shape of a switch cartridge, it looks really good and the guy making has put a lot of work in ^^,
 
Last edited by nightweb,
  • Like
Reactions: jscjml

jscjml

Monster Hunter
Member
Joined
Jan 4, 2015
Messages
334
Trophies
0
Age
29
Location
Las Vegas
XP
256
Country
United States
Done!



--------------------- MERGED ---------------------------

For those wondering about the ArgonNX theme, I'll be providing clean (the one shown) and dirty versions if anyone is interested. Previews attached!


the best way to know how this works is to watch it in action, MaitinatorX (I'm probably butchering the spelling) posted a video to YouTube showing the first prototype in action.



it's basically a Jig, Injector all in the shape of a switch cartridge, it looks really good and the guy making has put a lot of work in ^^,


Very cool, just saw the video on the page before this also thanks as well. Day 1 buy for me guaranteed. Following this topic and the discord. Thank the lord I didnt shell out for the nx atmosphere usb dongle, this thing looks way better in comparison.
 
Last edited by jscjml,
  • Like
Reactions: MatinatorX

nightweb

Well-Known Member
Member
Joined
Sep 16, 2009
Messages
268
Trophies
1
XP
2,267
Country
Ireland
Very cool, just saw the video on the page before this also thanks as well. Day 1 buy for me guaranteed. Following this topic and the discord. Thank the lord I didnt shell out for the nx atmosphere usb dongle, this thing looks way better in comparison.

Yup me too, can't wait, already got the batteries ready ^^,
 
  • Like
Reactions: MatinatorX

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
Praise from the master themself, thanks buddy! :lol:

Pinout is as follows, but I had planned to modify your code instead of asking you to do the work so don't feel obligated in any way. :P

LED is a 1mm x 1mm RGB LED (bugger to hand solder) and is common anode, so lines must be pulled low to turn on and high to turn off.

D7 = Red
D8 = Green
D2 = Blue

I have D0 (the + button) accepting 3.3v through S1 whenever pressed which also turns on LDO to wake up the MCU. The idea is whenever the MCU starts, it checks to see if D0 is HIGH, and if so it increments the payload number, writes it to eeprom, skips injection, blinks blue to indicate the number of the payload selected then goes to sleep. The idea is to hold the button until the LED stops flashing.

Also have A0 reading battery voltage through a voltage divider. R1 is 2.5MΩ and R2 is 1MΩ, which converts 0-3.85v from battery to 0-1.1v at A0 to match the internal 1.1v reference of the ATSAMD21. The plan is to have a low battery LED indication of 0.5 seconds on boot. I have yet to map out the voltages I want to use for battery status, but colors would be green for healthy, yellow for warning and red for critical battery level. On red I would skip injection and just flash red a few times before putting MCU to sleep. Reason being, injection can fail if voltage is too low, which causes the Switch to freeze, requiring a 20sec power button shutdown. Advanced users who want to risk it for a few more injections can modify the firmware. ;)

Schemmy attached. I've been told my schematics look awful, so sorry about that. :lol:

Right... Been working on the battery code.

You are using a potential divider to chop the 3v to 1100mV, correct?

We have 10 bit resolution on the analogue pin, so it is approx

battvolt / 3 = 1000 - this is under 1024 1023 our maximum
2.7v / 3 = 900 - amber warning?
2.580v / 3 = 860 - red warning / shutdown?

Obviously needs testing...

EDIT: Something simple like this...

Code:
void battery_check() {
  pinMode (ONBOARD_LED, OUTPUT);
  pinMode (REDLED, OUTPUT);
  pinMode (GREENLED, OUTPUT);
  pinMode (BLUELED, OUTPUT);
  delayMicroseconds(500000);// allow to stabilise
  battvalue = analogRead (BATTERY_LEVEL_CHECK);
  if (battvalue >= 900) {
    digitalWrite(GREENLED, LOW);
    flatbatt = false;
  } else if (battvalue >= 860 && battvalue <= 899) {
    digitalWrite(REDLED, LOW);
    digitalWrite(GREENLED, LOW);
    flatbatt = false;
  } else {
    digitalWrite(REDLED, HIGH);
    flatbatt = true;
  }
  delayMicroseconds(500000);
  digitalWrite (REDLED, HIGH);
  digitalWrite (GREENLED, HIGH);
  digitalWrite (BLUELED, HIGH);
  if (!flatbatt) {
    return;
  } else sleep (-1);

instead of delayMicroseconds, going to use a

void pause (int pausetime){ }
with digitalReads on D0 pin

routine so we can detect if D0 is held and action accordingly.

Hope I am understandable :)
 
Last edited by mattytrog,

MatinatorX

Hardware Developer
OP
Developer
Joined
Jul 17, 2018
Messages
366
Trophies
1
Website
www.dragoninjector.com
XP
2,538
Country
Canada
Hmm the plastic seems a bit flimsy, and easily breakable. Will you do other heavier/better quality plastic molds?

Unfortunately I don't have the money for injection molding right now, as the DI would need 5 molds which would be over $10000. Right now I'm printing on a pair of Anycubic Photon DLP printers. The resin is quite strong once cured. The downside is that it's quite brittle and can't take as much flex as plastic can before breaking.

I look like I'm treating it delicately on the video because I have a camera in my face and can't see very well what I'm doing. :P

Right... Been working on the battery code.

You are using a potential divider to chop the 3v to 1100mV, correct?

We have 10 bit resolution on the analogue pin, so it is approx

battvolt / 3 = 1000 - this is under 1024 1023 our maximum
2.7v / 3 = 900 - amber warning?
2.580v / 3 = 860 - red warning / shutdown?

Obviously needs testing...

EDIT: Something simple like this...

Code:
void battery_check() {
  pinMode (ONBOARD_LED, OUTPUT);
  pinMode (REDLED, OUTPUT);
  pinMode (GREENLED, OUTPUT);
  pinMode (BLUELED, OUTPUT);
  delayMicroseconds(500000);// allow to stabilise
  battvalue = analogRead (BATTERY_LEVEL_CHECK);
  if (battvalue >= 900) {
    digitalWrite(GREENLED, LOW);
    flatbatt = false;
  } else if (battvalue >= 860 && battvalue <= 899) {
    digitalWrite(REDLED, LOW);
    digitalWrite(GREENLED, LOW);
    flatbatt = false;
  } else {
    digitalWrite(REDLED, HIGH);
    flatbatt = true;
  }
  delayMicroseconds(500000);
  digitalWrite (REDLED, HIGH);
  digitalWrite (GREENLED, HIGH);
  digitalWrite (BLUELED, HIGH);
  if (!flatbatt) {
    return;
  } else sleep (-1);

instead of delayMicroseconds, going to use a

void pause (int pausetime){ }
with digitalReads on D0 pin

routine so we can detect if D0 is held and action accordingly.

Hope I am understandable :)

Looks pretty easy to read at first glance, I'll poke at it tonight once I get home from work.

Thanks so much for your help! :D
 
Last edited by MatinatorX,

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
Unfortunately I don't have the money for injection molding right now, as the DI would need 5 molds which would be over $10000. Right now I'm printing on a pair of Anycubic Photon DLP printers. The resin is quite strong once cured. The downside is that it's quite brittle and can't take as much flex as plastic can before breaking.



Looks pretty easy to read at first glance, I'll poke at it tonight once I get home from work.

Thanks so much for your help! :D

No worries. Just a couple of points I`d like to mention (tell me to bugger off, I don`t mind!)

The AP7331...

The EN pin seems momentary looking at the datasheet.

So as soon as you let go of S1, EN is no longer high and LDO thus MCU turns off.
How will we sense if D0 is pressed if we let go of it and MCU switches off?

You have D1 on USB line going to 3v. I`m wondering why, as according to the datasheet D1 (USB signal line) can`t provide the swing to keep LDO enabled. May be wrong!

Would it be better to send an unused pin high (for example D4) and use that to provide 3v to EN the LDO regulator?

This would free up D0 while keeping MCU switched on (so you can let go of it) because as soon as code starts, D4 is sent high, thus keeping regulator enabled.

Then we pull D4 low (or change to input) to switch MCU off.

I`m just looking at your schematic and sussing it out. It isn`t that bad! I can understand it!
 
Last edited by mattytrog,

MatinatorX

Hardware Developer
OP
Developer
Joined
Jul 17, 2018
Messages
366
Trophies
1
Website
www.dragoninjector.com
XP
2,538
Country
Canada
Unfortunately I don't have the money for injection molding right now, as the DI would need 5 molds which would be over $10000. Right now I'm printing on a pair of Anycubic Photon DLP printers. The resin is quite strong once cured. The downside is that it's quite brittle and can't take as much flex as plastic can before breaking.

I look like I'm treating it delicately on the video because I have a camera in my face and can't see very well what I'm doing. :P



Looks pretty easy to read at first glance, I'll poke at it tonight once I get home from work.

Thanks so much for your help! :D

No worries. Just a couple of points I`d like to mention (tell me to bugger off, I don`t mind!)

The AP7331...

The EN pin seems momentary looking at the datasheet.

So as soon as you let go of S1, EN is no longer high and LDO thus MCU turns off.
How will we sense if D0 is pressed if we let go of it and MCU switches off?

You have D1 on USB line going to 3v. I`m wondering why, as according to the datasheet D1 (USB signal line) can`t provide the swing to keep LDO enabled. May be wrong!

Would it be better to send an unused pin high (for example D4) and use that to provide 3v to EN the LDO regulator?

This would free up D0 while keeping MCU switched on (so you can let go of it) because as soon as code starts, D4 is sent high, thus keeping regulator enabled.

Then we pull D4 low (or change to input) to switch MCU off.

I`m just looking at your schematic and sussing it out. It isn`t that bad! I can understand it!

The AP7331 is indeed momentary. My thinking for that is, I don't want the user to have to press any buttons to inject a payload. You just plug it in, D+ enables the LDO, and boom, injection. RCM stops, D+ goes low, DI shuts itself off. This greatly helped with battery life.

D+ actually has more than enough current capability to turn on the LDO. :D By my calculations D+ can supply about 2mA (full speed uses 1.5k pull up at ~3v) when set as USB slave, which is more than enough to enable the LDO. It's tested and working great as you can see from my videos. :)

It might be because I work automation by day and have seen some pretty shady code controlling life safety equipment, but I don't really like the idea of giving the MCU control of something as important as the LDO EN pin. Any programming error or abnormal condition that causes the MCU to freeze or keep that pin high means the potential for a dead battery and a very unhappy user with a Switch stuck in RCM. I know technically that should never happen, but I prefer to do it with passives.

Keeping the MCU on for D0 isn't really a big deal since injection shouldn't happen if it's pressed, so USB host would be a big battery drain for nothing. (11mA draw!) Instead use can just hold down the button until they get visual feedback of which payload is selected. Bootloader runs for well under a second so this shouldn't be inconvenient, and gives the user time to let go of the button if they only pressed it by mistake, instead of having to cycle back to the payload they were using (wasting even more battery).

Last advantage of using D+ is this: to get into firmware update mode, the user can hold + button (D0) and hit reset twice, and the MCU will then keep itself on with D+. Plug it in and update firmware, and once done, DI shuts itself off because no more USB slave mode. :D

It's all in the name of maximum battery life and minimum complexity for the user who just wants to kill some goombas.

Anyways, those are my thoughts and self-rationalizations, if I'm amiss in my thinking by all means throw some sense at me. :lol:
 
Last edited by MatinatorX,
  • Like
Reactions: Adran_Marit

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
The AP7331 is indeed momentary. My thinking for that is, I don't want the user to have to press any buttons to inject a payload. You just plug it in, D+ enables the LDO, and boom, injection. RCM stops, D+ goes low, DI shuts itself off. This greatly helped with battery life.

D+ actually has more than enough current capability to turn on the LDO. :D By my calculations D+ can supply about 2mA (full speed uses 1.5k pull up at ~3v) when set as USB slave, which is more than enough to enable the LDO. It's tested and working great as you can see from my videos. :)

It might be because I work automation by day and have seen some pretty shady code controlling life safety equipment, but I don't really like the idea of giving the MCU control of something as important as the LDO EN pin. Any programming error or abnormal condition that causes the MCU to freeze or keep that pin high means the potential for a dead battery and a very unhappy user with a Switch stuck in RCM. I know technically that should never happen, but I prefer to do it with passives.

Keeping the MCU on for D0 isn't really a big deal since injection shouldn't happen if it's pressed, so USB host would be a big battery drain for nothing. (11mA draw!) Instead use can just hold down the button until they get visual feedback of which payload is selected. Bootloader runs for well under a second so this shouldn't be inconvenient, and gives the user time to let go of the button if they only pressed it by mistake, instead of having to cycle back to the payload they were using (wasting even more battery).

Last advantage of using D+ is this: to get into firmware update mode, the user can hold + button (D0) and hit reset twice, and the MCU will then keep itself on with D+. Plug it in and update firmware, and once done, DI shuts itself off because no more USB slave mode. :D

It's all in the name of maximum battery life and minimum complexity for the user who just wants to kill some goombas.

Anyways, those are my thoughts and self-rationalizations, if I'm amiss in my thinking by all means throw some sense at me. :lol:

OK sir!

Understood. If the LDO remains powered like it obviously must do, I think that is ingenious!

I understand it better now. I was thinking you were pushing the button to send the payload.

So, under normal circumstances, if injecting the same payload, no buttons need to be touched. Plug in, it poweres up and pushes the payload. USBhost disconnects, removing power.


Holding D0 will prevent payload push and will flash while being held. Once flashing stops, payload changes.

About right?

Its good to see you went with the E18 without a crystal, rather than the G18 (with or without xtal)

Makes a nice change from the complete overkill ones I have been seeing. The internal oscillator is fine for what we need it for!

Will work more on it throughout the evening.
 

MatinatorX

Hardware Developer
OP
Developer
Joined
Jul 17, 2018
Messages
366
Trophies
1
Website
www.dragoninjector.com
XP
2,538
Country
Canada
OK sir!

Understood. If the LDO remains powered like it obviously must do, I think that is ingenious!

I understand it better now. I was thinking you were pushing the button to send the payload.

So, under normal circumstances, if injecting the same payload, no buttons need to be touched. Plug in, it poweres up and pushes the payload. USBhost disconnects, removing power.


Holding D0 will prevent payload push and will flash while being held. Once flashing stops, payload changes.

About right?

Its good to see you went with the E18 without a crystal, rather than the G18 (with or without xtal)

Makes a nice change from the complete overkill ones I have been seeing. The internal oscillator is fine for what we need it for!

Will work more on it throughout the evening.

Thanks! Thats' exactly right. :)

About the only thing I was debating on is when to save the new payload value to EEPROM; write before LED's flash and it might get changed unintentionally, but write after LED's flash and it might not write before user releases button. I think the latter is the best way as you suggested. Writing to EEPROM is quick, and I have a cap between EN and GND of the LDO that will keep it on a little bit longer (400ms ish).

Agreed on the E18 vs. G18. I didn't see the point of an external crystal. If the internal oscillator is good enough to keep USB happy, it's good enough for whatever I'd use it for. No need to build an atomic clock into a payload injector. :P
 
Last edited by MatinatorX,

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
Thanks! Thats' exactly right. :)

About the only thing I was debating on is when to save the new payload value to EEPROM; write before LED's flash and it might get changed unintentionally, but write after LED's flash and it might not write before user releases button. I think the latter is the best way as you suggested. Writing to EEPROM is quick, and I have a cap between EN and GND of the LDO that will keep it on a little bit longer (400ms ish).

Agreed on the E18 vs. G18. I didn't see the point of an external crystal. If the internal oscillator is good enough to keep USB happy, it's good enough for whatever I'd use it for. No need to build an atomic clock into a payload injector. :P
If it was me, I'd have a rapid blinking led and five the user the blinking window to save it.

I've done something similar with Simple-UF2
 

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
If it was me, I`d have the following behaviour...
Plug in > payload number blinks > sends > sleep

Hold D0 & plug in > 2 second solid LED (The let go or ill increase payload LED) > strobe LED to indicate pending payload increase > increase payload > indicate new payload via colour & blinks > strobe LED for 2 seconds to confirm > reboot > blink > send > sleep
 
Last edited by mattytrog,

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
Quick vid showing battery code. Forgive the crap quality.

Using a 50K pot to simulate different potentials.

Red (flat) will not boot.

 
  • Like
Reactions: Don Jon and Sno0t

mattytrog

You don`t want to listen to anything I say.
Member
Joined
Apr 27, 2018
Messages
3,708
Trophies
0
Age
48
XP
4,328
Country
United Kingdom
Anyone got a dragoninjector and wanna try this?

Hold D0 to change payload

Payloads will be counted out. Press D0 again to confirm
White LED confirms selection

Initial battery level indication when first powered up.

Triple-post.

:gun::gun::gun::gun::gun:MATTYTROG

EDIT: Pushed alpha2 as Simple-UF2 0.9.7.1

No UF2 files yet until confirmed it is all good for Dragon Injector.
https://github.com/mattytrog/Simple-UF2/tree/master/SIMPLE-UF2_v0971/main
 

Attachments

  • dragoninjector_alpha_0.1.zip
    104.9 KB · Views: 141
Last edited by mattytrog,
Status
Not open for further replies.

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=bgCjp3-rF_Y