gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > How to detect a DS phat from a DS Lite

#169283 - sonny_jim - Sat Jun 27, 2009 8:54 pm

I'm currently writing a driver for DSLinux to change the backlight brightness, but I've found this in gbatek:

Quote:

On Old-DS, registers 4..7Fh are mirrors of 0..3. On DS-Lite, registers 5,6,7 are mirrors of 4, register 8..7Fh are mirrors of 0-7.


This means if I try and change the brightness on a DS phat, it turns the speakers off. How does homebrew that uses backlight controls detect if it's running on a DS Lite? By comparing registers?

Apologies if this is a common question, a quick search didn't throw up anything useful.
_________________
Quote:

Would that be the internet driver for the program?

#169285 - Ludo6431 - Sat Jun 27, 2009 10:35 pm

Quote:
[...]
<mukunda> Ludo6431, the spi registers have some stuff that's different
<Ludo6431> mukunda, yep, but what ? :)
<mukunda> "Bit4-7 Unknown (Always 4) (Read-Only)"
<mukunda> in the register that controls the backlight brightness
<mukunda> on phat ds it wont be 4, since it will be a mirror of register 0
<Ludo6431> oh yes !
<mukunda> and 4 of register 0 is the shutdown bit
<Ludo6431> thanks a lot !
<mukunda> np

_________________
Sorry for my poor english, I'm french.

#169288 - AxemRed - Sun Jun 28, 2009 8:12 am

I use this on the ARM7 side:
Quote:
isOldDS = !(readPowerManagement(4) & BIT(6));
backlight = isOldDS ? 3 : readPowerManagement(4);

#169291 - SteveH - Sun Jun 28, 2009 6:03 pm

I've just done a little experiment on my DSL and DSi (I no longer have a DSphat to play with)

My little app I wrote just gets the values from the 8 power management registers and outputs the results.

DSlite:

0 - 0d
1 - 00
2 - 00
3 - 01
4 - 43
5 - 43
6 - 43
7 - 43

As per the docs - Registers 5-7 are mirroring register 4, and the high nibble is 4.

Now onto the DSi:

0 - 0f
1 - 00
2 - 00
3 - 01
4 - 41
5 - 00
6 - 00
7 - 00

As you can see registers 5-7 are not mirroring register 4...

So from the above the following test could be ran on an arm7:

Code:

u8 dsGen = 0;

if( readPowerManagement(4) & BIT(6) )
  dsGen++;

if( readPowerManagement(4) == readPowerManagement(5) )
  dsGen++;


If the above code was ran on the ARM7 the value of dsGen would be:

phat - 0
DSi - 1
lite - 2

Another thing I spotted is that the Sound Amplifier Mute (bit 1 of register 0) is 1 on the DSi, but it is always 0 on a lite (again from the GBAtec docs).

I can not say that the above is 100% correct as I only have access to one DSi and one DSlite, I used the Ez Flash Vi cart for my testing, so again this may be down to a cart issue.

#169292 - dantheman - Sun Jun 28, 2009 9:08 pm

If you can find the source to Lick's "LoveLite" program, that may be useful. On my DS Phat, it merely toggles the backlight, while on a DS Lite it changes the brightness settings.

#169303 - sonny_jim - Tue Jun 30, 2009 12:48 pm

Cool, thanks for the replies. Once I've got this backlight driver working I'm going to try and get my DSerial working with DSLinux (*gulp*).
_________________
Quote:

Would that be the internet driver for the program?