Calibration: Difference between revisions

 
(24 intermediate revisions by 6 users not shown)
Line 1: Line 1:
During [[Factory_Setup|factory setup]], the Switch goes through calibration and the generated data from this process is written to two [[Flash_Filesystem|NAND user partitions]] ('''PRODINFO''' and '''PRODINFOF''').
During [[Factory_Setup|factory setup]], the Switch goes through calibration and the generated data from this process is written to two [[Flash_Filesystem|NAND user partitions]] ('''PRODINFO''' and '''PRODINFOF''').


'''PRODINFOF''' is a FAT12 compliant filesystem and it's structure can be found [[Flash_Filesystem#PRODINFOF|here]]. It's mainly used to keep calibration logs and other assorted files.
= CalibrationBinary =
This is "nn::cal::CalibrationBinary".


'''PRODINFO''' is a raw binary blob containing the main calibration data, which ranges from hardware IDs to system keys.
This is a raw binary blob containing the main calibration data, which ranges from hardware IDs to system keys.
 
= CAL0 =
This is the raw data stored under the PRODINFO partition.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 12: Line 10:
!  Offset
!  Offset
!  Size
!  Size
!  Field
!  Description
!  Description
|-
|-
0x0000
0x0
0x04
0x4
|  magic
MagicNumber ("CAL0")
|  "CAL0" header magic.
|-
|-
0x0004
0x4
0x04
0x4
version
Version
|  Always 0x07.
|-
|-
0x0008
0x8
0x04
0x4
calib_data_size
BodySize (size of calibration data starting at offset 0x40)
|  Total size of calibration data minus 0x40 bytes (header + calib_data_sha256).
|-
|-
0x000C
0xC
0x02
0x2
model
Model
|  Always 0x01.
|-
|-
0x000E
0xE
0x02
0x2
revision
UpdateCount (increases each time calibration data is installed)
|  Increases each time calibration data is installed.
|-
|-
|  0x0020
|  0x20
|  0x20
calib_data_sha256
0x20
|  SHA256 hash calculated over calibration data.
BodyHash (SHA256 hash calculated over calibration data)
|-
|-
0x0040
0x40
0x1D
0x1E
config_id1
[[Settings_services#ConfigurationId1|ConfigurationId1]]
| Configuration ID string.
|-
|-
0x0060
0x60
|  0x20
|  0x20
reserved
Reserved
|  Empty.
|-
|-
0x0080
0x80
0x04
0x4
wlan_country_codes_num
WlanCountryCodesNum
|  Number of elements in the wlan_country_codes array.
|-
|-
0x0084
0x84
0x04
0x4
wlan_country_codes_last_idx
WlanCountryCodesLastIndex
|  Index of the last element in the wlan_country_codes array.
|-
|-
0x0088
0x88
|  0x180
|  0x180
wlan_country_codes
WlanCountryCodes
|  Array of WLAN country code strings. Each element is 3 bytes (code + NULL terminator).
|-
|-
0x0210
0x210
0x06
0x6
wlan_mac_addr
[[Settings_services#MacAddress|WlanMacAddress]]
|
|-
|-
0x0220
0x220
0x06
0x6
bd_addr
[[Settings_services#BdAddress|BdAddress]]
|
|-
|-
0x0230
0x230
0x06
0x6
|  accelerometer_offset
AccelerometerOffset
|   
|-
|-
0x0238
0x238
0x06
0x6
|  accelerometer_scale
AccelerometerScale
|   
|-
|-
0x0240
0x240
0x06
0x6
|  gyroscope_offset
GyroscopeOffset
|   
|-
|-
0x0248
0x248
0x06
0x6
|  gyroscope_scale
GyroscopeScale
|   
|-
|-
0x0250
0x250
|  0x18
|  0x18
serial_number
[[Settings_services#SerialNumber|SerialNumber]]
|
|-
|-
0x0270
0x270
|  0x30
|  0x30
device_key_ecc_p256
EccP256DeviceKey (unused)
|  Device key (ECC-P256 version; empty and unused).
|-
|-
0x02B0
0x2B0
|  0x180
|  0x180
device_cert_ecc_p256
EccP256DeviceCertificate (unused)
|  Device certificate (ECC-P256 version; empty and unused).
|-
|-
0x0440
0x440
|  0x30
|  0x30
device_key_ecc_b233
EccB233DeviceKey (unused)
|  Device key (ECC-B233 version; empty and unused).
|-
|-
0x0480
0x480
|  0x180
|  0x180
device_cert_ecc_b233
EccB233DeviceCertificate
|  Device certificate (ECC-B233 version; active).
|-
|-
0x0610
0x610
|  0x30
|  0x30
eticket_key_ecc_p256
EccP256ETicketKey (unused)
|  ETicket key (ECC-P256 version; empty and unused).
|-
|-
0x0650
0x650
|  0x180
|  0x180
eticket_cert_ecc_p256
EccP256ETicketCertificate (unused)
|  ETicket certificate (ECC-P256 version; empty and unused).
|-
|-
0x07E0
0x7E0
|  0x30
|  0x30
eticket_key_ecc_b233
EccB233ETicketKey (unused)
|  ETicket key (ECC-B233 version; empty and unused).
|-
|-
0x0820
0x820
|  0x180
|  0x180
eticket_cert_ecc_b233
EccB233ETicketCertificate (unused)
|  ETicket certificate (ECC-B233 version; empty and unused).
|-
|-
0x09B0
0x9B0
|  0x110
|  0x110
ssl_key
SslKey (unused)
|  SSL key (empty and unused).
|-
|-
0x0AD0
0xAD0
0x04
0x4
ssl_cert_size
SslCertificateSize
|  Total size of the SSL certificate.
|-
|-
0x0AE0
0xAE0
|  0x800
|  0x800
ssl_cert
SslCertificate (only SslCertificateSize bytes are used)
|  SSL certificate. Only ssl_cert_size bytes are used.
|-
|-
|  0x12E0
|  0x12E0
|  0x20
|  0x20
ssl_cert_sha256
SslCertificateHash (SHA256 over the SSL certificate)
SHA256 over the SSL certificate.
|-
|-
|  0x1300
|  0x1300
|  0x1000
|  0x1000
random_number
RandomNumber
|  Random generated data.
|-
|-
|  0x2300
|  0x2300
|  0x20
|  0x20
random_number_sha256
RandomNumberHash (SHA256 over the random data block)
SHA256 over the random data block.
|-
|-
|  0x2320
|  0x2320
|  0x110
|  0x110
gamecard_key
GameCardKey (unused)
|  GameCard key (empty and unused).
|-
|-
|  0x2440
|  0x2440
|  0x400
|  0x400
gamecard_cert
GameCardCertificate
|  GameCard certificate.
|-
|-
|  0x2840
|  0x2840
|  0x20
|  0x20
gamecard_cert_sha256
GameCardCertificateHash (SHA256 over the GameCard certificate)
SHA256 over the GameCard certificate.
|-
|-
|  0x2860
|  0x2860
|  0x220
|  0x220
eticket_key_rsa
Rsa2048ETicketKey (unused)
|  ETicket key (RSA-2048 version; empty and unused).
|-
|-
|  0x2A90
|  0x2A90
|  0x240
|  0x240
eticket_cert_rsa
Rsa2048ETicketCertificate
|  ETicket certificate (RSA-2048 version; active).
|-
|-
|  0x2CE0
|  0x2CE0
|  0x18
|  0x18
battery_lot
BatteryLot
|  Battery lot string ID.
|-
|-
|  0x2D00
|  0x2D00
|  0x800
|  0x800
speaker_calib_value
[[#SpeakerCalibrationValue|SpeakerCalibrationValue]]
| Speaker calibration values. Only 0x5A bytes are used.
|-
|-
|  0x3510
|  0x3510
0x04
0x4
region_code
[[Settings_services#RegionCode|RegionCode]]
|
|-
|-
|  0x3520
|  0x3520
|  0x50
|  0x50
amiibo_key
AmiiboKey
|  Amiibo key (ECQV and ECDSA versions).
|-
|-
|  0x3580
|  0x3580
|  0x14
|  0x14
amiibo_cert_ecqv
AmiiboEcqvCertificate
|  Amiibo certificate (ECQV version).
|-
|-
|  0x35A0
|  0x35A0
|  0x70
|  0x70
amiibo_cert_ecdsa
AmiiboEcdsaCertificate
|  Amiibo certificate (ECDSA version).
|-
|-
|  0x3620
|  0x3620
|  0x40
|  0x40
amiibo_key_ecqv_bls
AmiiboEcqvBlsKey
|  Amiibo key (ECQV-BLS version).
|-
|-
|  0x3670
|  0x3670
|  0x20
|  0x20
amiibo_cert_ecqv_bls
AmiiboEcqvBlsCertificate
|  Amiibo certificate (ECQV-BLS version).
|-
|-
|  0x36A0
|  0x36A0
|  0x90
|  0x90
amiibo_root_cert_ecqv_bls
AmiiboEcqvBlsRootCertificate
|  Amiibo root certificate (ECQV-BLS version).
|-
|-
|  0x3740
|  0x3740
0x04
0x4
product_model
[[#ProductModel|ProductModel]]
|
|-
|-
|  0x3750
|  0x3750
0x06
0x6
color_variation
[[#ColorVariation|ColorVariation]]
|
|-
|-
|  0x3760
|  0x3760
0x0C
0xC
|  lcd_backlight_brightness_mapping
LcdBacklightBrightnessMapping
|   
|-
|-
|  0x3770
|  0x3770
|  0x50
|  0x50
device_ext_key_ecc_b233
ExtendedEccB233DeviceKey
|  Extended device key (ECC-B233 version; active).
|-
|-
|  0x37D0
|  0x37D0
|  0x50
|  0x50
eticket_ext_key_ecc_p256
ExtendedEccP256ETicketKey (unused)
|  Extended ETicket key (ECC-P256 version; empty and unused).
|-
|-
|  0x3830
|  0x3830
|  0x50
|  0x50
eticket_ext_key_ecc_b233
ExtendedEccB233ETicketKey (unused)
|  Extended ETicket key (ECC-B233 version; empty and unused).
|-
|-
|  0x3890
|  0x3890
|  0x240
|  0x240
eticket_ext_key_rsa
ExtendedRsa2048ETicketKey
|  Extended ETicket key (RSA-2048 version; active).
|-
|-
|  0x3AE0
|  0x3AE0
|  0x130
|  0x130
ssl_ext_key
ExtendedSslKey
|  Extended SSL key (active).
|-
|-
|  0x3C20
|  0x3C20
|  0x130
|  0x130
gamecard_ext_key
ExtendedGameCardKey
|  Extended GameCard key (active).
|-
|-
|  0x3D60
|  0x3D60
0x04
0x4
lcd_vendor_id
[[#LcdVendorId|LcdVendorId]]
|
|-
|-
|  0x3D70
|  0x3D70
|  0x240
|  0x240
|  [5.0.0+] device_cert_rsa
|  [5.0.0+] ExtendedRsa2048DeviceKey
|  Device certificate (RSA-2048 version).
|-
|-
|  0x3FC0
|  0x3FC0
|  0x240
|  0x240
|  [5.0.0+] device_ext_key_rsa
|  [5.0.0+] Rsa2048DeviceCertificate
|  Extended device key (RSA-2048 version).
|-
|-
|  0x4210
|  0x4210
0x04
0x1
|  [5.0.0+] usb_type_c_power_source_circuit_version
|  [5.0.0+] [[#UsbTypeCPowerSourceCircuit|UsbTypeCPowerSourceCircuitVersion]]
|   
|-
|  0x4220
|  0x4
|  [9.0.0+] [[#HousingColor|HousingSubColor]]
|-
|  0x4230
|  0x4
|  [9.0.0+] [[#HousingColor|HousingBezelColor]]
|-
|  0x4240
|  0x4
[9.0.0+] [[#HousingColor|HousingMainColor1]]
|-
|  0x4250
|  0x4
|  [9.0.0+] [[#HousingColor|HousingMainColor2]]
|-
|  0x4260
|  0x4
|  [9.0.0+] [[#HousingColor|HousingMainColor3]]
|-
|  0x4270
|  0x1
|  [9.0.0+] [[#AnalogStickModuleType|AnalogStickModuleTypeL]]
|-
|  0x4280
|  0x12
|  [9.0.0+] [[#AnalogStickModelParameter|AnalogStickModelParameterL]]
|-
|  0x42A0
|  0x9
|  [9.0.0+] [[#AnalogStickFactoryCalibration|AnalogStickFactoryCalibrationL]]
|-
|  0x42B0
|  0x1
|  [9.0.0+] [[#AnalogStickModuleType|AnalogStickModuleTypeR]]
|-
|  0x42C0
|  0x12
|  [9.0.0+] [[#AnalogStickModelParameter|AnalogStickModelParameterR]]
|-
|  0x42E0
|  0x9
|  [9.0.0+] [[#AnalogStickFactoryCalibration|AnalogStickFactoryCalibrationR]]
|-
|  0x42F0
|  0x1
|  [9.0.0+] [[#ConsoleSixAxisSensorModuleType|ConsoleSixAxisSensorModuleType]]
|-
|  0x4300
|  0x6
|  [9.0.0+] [[#ConsoleSixAxisSensorHorizontalOffset|ConsoleSixAxisSensorHorizontalOffset]]
|-
|-
|  0x4310
|  0x4310
0x04
0x1
|  [6.0.0+] battery_version
|  [6.0.0+] [[#BatteryVersion|BatteryVersion]]
|
|-
|-
|  0x4320
|  0x1
|  [10.0.0+] [[#TouchIcVendorId|TouchIcVendorId]]
|-
|  0x4330
|  0x4
|  [9.0.0+] [[#ColorModel|ColorModel]]
|-
|  0x4340
|  0x1
|  [10.0.0+] [[#ConsoleSixAxisSensorMountType|ConsoleSixAxisSensorMountType]]
|}
== SpeakerCalibrationValue ==
This is "nn::cal::SpeakerCalibrationValue".
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x2 || Version
|-
| 0x2 || 0x22 || Reserved
|-
| 0x24 || 0x2 || SpeakerHpf2A1
|-
| 0x26 || 0x2 || SpeakerHpf2A2
|-
| 0x28 || 0x2 || SpeakerHpf2H0
|-
| 0x2A || 0x2 || SpeakerEqInputVolume
|-
| 0x2C || 0x2 || SpeakerEqOutputVolume
|-
| 0x2E || 0x2 || SpeakerEqCtrl1
|-
| 0x30 || 0x2 || SpeakerEqCtrl2
|-
| 0x32 || 0x2 || SpeakerDrcAgcCtrl2
|-
| 0x34 || 0x2 || SpeakerDrcAgcCtrl3
|-
| 0x36 || 0x2 || SpeakerDrcAgcCtrl1
|-
| 0x38 || 0x2 || SpeakerAnalogVolume
|-
| 0x3A || 0x2 || HeadphoneAnalogVolume
|-
| 0x3C || 0x2 || SpeakerDigitalVolumeMin
|-
| 0x3E || 0x2 || SpeakerDigitalVolumeMax
|-
| 0x40 || 0x2 || HeadphoneDigitalVolumeMin
|-
| 0x42 || 0x2 || HeadphoneDigitalVolumeMax
|-
| 0x44 || 0x2 || MicFixedGain
|-
| 0x46 || 0x2 || MicVariableVolumeMin
|-
| 0x48 || 0x2 || MicVariableVolumeMax
|-
| 0x4A || 0x7B6 || Reserved
|}
== ProductModel ==
This is "nn::cal::ProductModel".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || Invalid
|-
| 1 || Nx
|-
| 2 || Copper
|-
| 3 || Iowa
|-
| 4 || Hoag
|-
| 5 || Calcio
|-
| 6 || Aula
|}
== ColorVariation ==
This is "nn::cal::ColorVariation".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || Default
|-
| 1 ||
|-
| 2 ||
|-
| 3 ||
|-
| 4 ||
|}
== LcdVendorId ==
This is "nn::cal::LcdVendorId".
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x1 || [[#Vendor|Vendor]]
|-
| 0x1 || 0x1 || Model
|-
| 0x2 || 0x1 || [[#Board|Board]]
|-
| 0x3 || 0x1 || Reserved
|}
=== Vendor ===
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0x10 || JDI
|-
| 0x20 || InnoLux
|-
| 0x30 || AUO
|-
| 0x40 || Sharp
|-
| 0x50 || Samsung
|}
=== Board ===
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0x9 || Icosa (JDI SI display)
|-
| 0xF || Icosa/Iowa
|-
| 0x10 || Hoag
|-
| 0x20 || Aula
|-
| 0x26 || Icosa (JDI LTPS display)
|}
== UsbTypeCPowerSourceCircuit ==
This is "nn::cal::UsbTypeCPowerSourceCircuit".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || 
|-
| 1 || 
|}
== HousingColor ==
This is "nn::cal::HousingColor".
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x1 || R
|-
| 0x1 || 0x1 || G
|-
| 0x2 || 0x1 || B
|-
| 0x3 || 0x1 || A
|}
== AnalogStickModuleType ==
This is "nn::cal::AnalogStickModuleType".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0x23 || H1 (Hosiden)
|-
| 0x25 || H5 (Hosiden)
|-
| 0x41 || F1 (FIT)
|}
== AnalogStickModelParameter ==
This is "nn::cal::AnalogStickModelParameter". Same as [[Joy-Con#AnalogStickModelValue|AnalogStickModelValue]].
== AnalogStickFactoryCalibration ==
This is "nn::cal::AnalogStickFactoryCalibration". Same as [[Joy-Con#AnalogStickCalibrationValue|AnalogStickCalibrationValue]].
== ConsoleSixAxisSensorModuleType ==
This is "nn::cal::ConsoleSixAxisSensorModuleType".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| -1 || Invalid
|-
| 0 || None
|-
| 1 || Lsm6ds3h
|-
| 2 || Bmi160
|-
| 3 || Icm20600
|-
| 4 || Lsm6ds3trc
|-
| 5 || Icm40607
|-
| 6 || Icm42607p
|-
| 7 || Lsm6dsv
|}
== ConsoleSixAxisSensorHorizontalOffset ==
This is "nn::cal::ConsoleSixAxisSensorHorizontalOffset". Same as [[Joy-Con#SixAxisSensorModelValue|SixAxisSensorModelValue]].
== BatteryVersion ==
This is "nn::cal::BatteryVersion".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 ||
|-
| 1 ||
|-
| 2 ||
|}
== TouchIcVendorId ==
This is "nn::cal::TouchIcVendorId".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 || FTM4CD60DA1BE
|-
| 1 || FTM4CD50TA1BE
|}
== ColorModel ==
This is "nn::cal::ColorModel".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 ||
|}
== ConsoleSixAxisSensorMountType ==
This is "nn::cal::ConsoleSixAxisSensorMountType".
{| class="wikitable" border="1"
|-
! Value
! Description
|-
| 0 ||
|-
| 1 ||
|}
|}


Line 350: Line 626:
   return(crc);
   return(crc);
  }
  }
= CalibrationFile =
This is "nn::cal::CalibrationFile".
This is a FAT12 compliant filesystem mainly used to keep calibration logs and other assorted files.
├── Certifications
│  └── WirelessCertification.png
└── ptd
    ├── DeviceIdWithEmsBit.dat
    ├── Ecid.dat
    ├── prodCode.dat
    └── log
        ├── Process_asm1.log
        ├── Process_board1.log
        ├── TestFlagLine.log
        ├── TestFlagQc.log
        ├── AGING
        │  └── Sequence.log
        ├── BOARD_TEST
        │  └── Sequence.log
        ├── BOARD_WIRELESS
        │  └── Sequence.log
        ├── FINAL_CHECK
        │  └── Sequence.log
        ├── LCD_AND_KEY
        │  └── Sequence.log
        └── USB_AND_HP
            └── Sequence.log
== DeviceIdWithEmsBit ==
Contains a 0x10-byte uppercase hex string, identical to the DeviceId in the [[Settings_services|DeviceCert]].