Difference between revisions of "Cameras"

From DSiBrew
Jump to navigation Jump to search
(removed CEVA DSP info for now since that doesn't seem to be used for cameras, until proven otherwise.)
(document camera registers)
 
(5 intermediate revisions by 3 users not shown)
Line 6: Line 6:
  
 
[[Image:DSiCameraSampleImage.jpg|200px|thumb|right|A picture taken with the DSi's camera.]]
 
[[Image:DSiCameraSampleImage.jpg|200px|thumb|right|A picture taken with the DSi's camera.]]
 +
 +
Aptina MT9V113
  
 
* 0.3 Megapixel  
 
* 0.3 Megapixel  
 
* 640*480 VGA
 
* 640*480 VGA
 
* No zoom and no flash.
 
* No zoom and no flash.
* Photos saved in JPG format (saved in [[DCIM/]] folder on the SD/SDHC or in the internal memory)
 
  
 
== Applications/Games compatible ==
 
== Applications/Games compatible ==
Line 25: Line 26:
 
* Classic Word Games
 
* Classic Word Games
 
* Cooking Coach
 
* Cooking Coach
 +
* Foto Showdown (DSi Exclusive)
 
* Pop SuperStar : Road To Celebrity (DSiWare)
 
* Pop SuperStar : Road To Celebrity (DSiWare)
 
* Real Football 2009  (DSiWare)
 
* Real Football 2009  (DSiWare)
Line 33: Line 35:
 
* Photo Dojo (DSiWare)
 
* Photo Dojo (DSiWare)
  
== Camera registers ==
+
=== Homebrew ===
 +
* [[dsi-camera]]
 +
* [[dsidl]]
  
The cameras are controlled and initialized with [[I2C_Bus#Cameras|I2C]]. The below registers are accessed by the ARM9.
+
== Camera registers (ARM7) ==
 +
 
 +
The cameras are controlled and initialized with [[I2C_Bus#Cameras|I2C Bus]] on ARM7 side.
 +
 
 +
== Camera registers (ARM9) ==
 +
 
 +
The actual data transfers are done on ARM9 side with below registers.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 45: Line 55:
 
|  0x04004200
 
|  0x04004200
 
|  2
 
|  2
REG_CAMRST
+
REG_CAM_MCNT
 
|-
 
|-
 
|  0x04004202
 
|  0x04004202
 
|  2
 
|  2
REG_CAMCNT
+
REG_CAM_CNT
 
|-
 
|-
 
|  0x04004204
 
|  0x04004204
 
|  4
 
|  4
REG_CAMDATA
+
REG_CAM_DATA
 +
|-
 +
|  0x04004210
 +
|  4
 +
|  REG_CAM_SOFS
 +
|-
 +
|  0x04004214
 +
|  4
 +
|  REG_CAM_EOFS
 
|}
 
|}
  
=== REG_CAMRST ===
+
=== REG_CAM_MCNT ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 62: Line 80:
 
!  DESCRIPTION
 
!  DESCRIPTION
 
|-
 
|-
| 15-0
+
| 15-8
| ?
+
| unused
 +
|-
 +
| 7
 +
| INI
 +
|-
 +
| 6
 +
| V28 rail enable
 +
|-
 +
| 5
 +
| VIO (1.8V IO voltage) rail enable
 +
|-
 +
| 4
 +
| V18 (1.8V core voltage) rail enable
 +
|-
 +
| 3
 +
| IRCLK
 +
|-
 +
| 2
 +
| SYNC
 +
|-
 +
| 1
 +
| RST
 +
|-
 +
| 0
 +
| STDBY
 
|}
 
|}
  
Line 75: Line 117:
 
|-
 
|-
 
| 0-3
 
| 0-3
| ?
+
| NLINES
 
|-
 
|-
 
| 4
 
| 4
| IRQ error flag
+
| IRQ FIFO-error flag
 
|-
 
|-
 
| 5
 
| 5
| Resets cameras when set?
+
| flush
 
|-
 
|-
 
| 7-6
 
| 7-6
 
| ?
 
| ?
 
|-
 
|-
| 9-8
+
| 8-9
| Set to 2(bit9 set) during init, cleared to zero on shutdown
+
| IREQVS
 
|-
 
|-
 
| 10
 
| 10
| Set to 1 during init, 0 on cameras shutdown
+
| IREQBE: Set to 1 during init, 0 on cameras shutdown
 
|-
 
|-
 
| 11
 
| 11
| Set to 1 during init, 0 on cameras shutdown
+
| IE: Set to 1 during init, 0 on cameras shutdown
 
|-
 
|-
 
| 12
 
| 12
Line 99: Line 141:
 
|-
 
|-
 
| 13
 
| 13
| Set during initialization?
+
| YUV2RGB
 
|-
 
|-
 
| 14
 
| 14
| Cleared during initialization?
+
| TRIMEN
 
|-
 
|-
 
| 15
 
| 15
| Enable
+
| data transfer enable
 
|}
 
|}
  
Line 111: Line 153:
  
 
=== REG_CAMDATA ===
 
=== REG_CAMDATA ===
 +
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! BIT
+
!
! DESCRIPTION
+
! BIT
 +
! DESCRIPTION
 +
|-
 +
! rowspan=4 | YUV422
 +
| 0-7
 +
| First pixel's luminance (Y)
 +
|-
 +
| 8-15
 +
| Both pixels' blue (U)
 +
|-
 +
| 16-23
 +
| Second pixel's luminance (Y)
 +
|-
 +
| 24-31
 +
| Both pixels' red (V)
 +
|-
 +
! rowspan=8 | RGB555
 +
| 0-4
 +
| First pixel's red
 +
|-
 +
| 5-9
 +
| First pixel's green
 +
|-
 +
| 10-14
 +
| First pixel's blue
 +
|-
 +
| 15
 +
| First pixel's alpha (always 1)
 +
|-
 +
| 16-20
 +
| Second pixel's red
 +
|-
 +
| 21-25
 +
| Second pixel's green
 +
|-
 +
| 26-30
 +
| Second pixel's blue
 
|-
 
|-
| 31-0
+
| 31
| RGB555 video data converted by internal-cameras DSP
+
| Second pixel's alpha (always 1)
 
|}
 
|}
  
For retrieving camera video data, [[NDMA]] with arm9 startup mode 11(camera) is used with this src register. The NDMA frame transfer is started when the cameras [[Interrupts|IRQ]] was thrown. Supported internal-cameras DSP final resolutions are 256x192 and 640x480, the corresponding frame transfer lengths are 0x18000 and 0x96000.(The 256x192 final resolution is converted by the internal-cameras DSP from the camera resolution)
+
For retrieving camera video data, [[NDMA]] with arm9 startup mode 11(camera) is used with this src register. The NDMA frame transfer is started when the cameras [[Interrupts|IRQ]] was thrown. Supported internal-cameras DSP final resolutions are 256x192 and 640x480, the corresponding frame transfer lengths are 0x18000 and 0x96000. (The 256x192 final resolution is converted by the internal-cameras DSP from the camera resolution)
 +
 
 +
The video data can be transferred as the camera's native YUV422 for higher quality or automatically converted to the same RGB555 as the 2D engine bitmap format. No official program uses the YUV mode, but it has been used in the homebrew [[dsi-camera]].
  
 
== See also ==
 
== See also ==

Latest revision as of 21:03, 9 August 2023

The Nintendo DSi contains two cameras. The cameras can be used in the Nintendo DSi Camera application or DSi games that are compatible.

Specifications

A picture taken with the DSi's camera.

Aptina MT9V113

  • 0.3 Megapixel
  • 640*480 VGA
  • No zoom and no flash.

Applications/Games compatible

Applications

Games

  • Asphalt 4 : Elite Racing (DSiWare)
  • Brain Challenge (DSiWare)
  • Classic Word Games
  • Cooking Coach
  • Foto Showdown (DSi Exclusive)
  • Pop SuperStar : Road To Celebrity (DSiWare)
  • Real Football 2009 (DSiWare)
  • WarioWare : Snapped! (DSiWare)
  • iCarly
  • Pokemon Black,White (2010,JP)
  • Castle of Magic (DSiWare)
  • Photo Dojo (DSiWare)

Homebrew

Camera registers (ARM7)

The cameras are controlled and initialized with I2C Bus on ARM7 side.

Camera registers (ARM9)

The actual data transfers are done on ARM9 side with below registers.

ADDRESS WIDTH NAME
0x04004200 2 REG_CAM_MCNT
0x04004202 2 REG_CAM_CNT
0x04004204 4 REG_CAM_DATA
0x04004210 4 REG_CAM_SOFS
0x04004214 4 REG_CAM_EOFS

REG_CAM_MCNT

BIT DESCRIPTION
15-8 unused
7 INI
6 V28 rail enable
5 VIO (1.8V IO voltage) rail enable
4 V18 (1.8V core voltage) rail enable
3 IRCLK
2 SYNC
1 RST
0 STDBY

Used for resetting cameras. Once cameras are reset by poking this register, all three 0x0400420X camera registers are set to zero.

REG_CAMCNT

BIT DESCRIPTION
0-3 NLINES
4 IRQ FIFO-error flag
5 flush
7-6 ?
8-9 IREQVS
10 IREQBE: Set to 1 during init, 0 on cameras shutdown
11 IE: Set to 1 during init, 0 on cameras shutdown
12 ?
13 YUV2RGB
14 TRIMEN
15 data transfer enable

When the IRQ error flag is set when the cameras IRQ handler is executing, the cameras are shut off. The cameras I2C devices are powered off until cameras are initialized via this register.

REG_CAMDATA

BIT DESCRIPTION
YUV422 0-7 First pixel's luminance (Y)
8-15 Both pixels' blue (U)
16-23 Second pixel's luminance (Y)
24-31 Both pixels' red (V)
RGB555 0-4 First pixel's red
5-9 First pixel's green
10-14 First pixel's blue
15 First pixel's alpha (always 1)
16-20 Second pixel's red
21-25 Second pixel's green
26-30 Second pixel's blue
31 Second pixel's alpha (always 1)

For retrieving camera video data, NDMA with arm9 startup mode 11(camera) is used with this src register. The NDMA frame transfer is started when the cameras IRQ was thrown. Supported internal-cameras DSP final resolutions are 256x192 and 640x480, the corresponding frame transfer lengths are 0x18000 and 0x96000. (The 256x192 final resolution is converted by the internal-cameras DSP from the camera resolution)

The video data can be transferred as the camera's native YUV422 for higher quality or automatically converted to the same RGB555 as the 2D engine bitmap format. No official program uses the YUV mode, but it has been used in the homebrew dsi-camera.

See also