|
| 1 | +Factory Test |
| 2 | +************ |
| 3 | + |
| 4 | +1. Overview |
| 5 | +=========== |
| 6 | + |
| 7 | +The document introduces how to develop, compile, download and run the factory test firmware. |
| 8 | + |
| 9 | +The factory test software development kit is also an example of the SDK, and it is located at :example:`examples/system/factory-test`. |
| 10 | + |
| 11 | +2. Development |
| 12 | +============== |
| 13 | + |
| 14 | +Users can use ready-to-use applications directly, or can also add custom application code into the factory test software development kit. |
| 15 | + |
| 16 | +More details of adding customer components, please refer to :doc:`Documentation for the GNU Make based build system <build-system>`. |
| 17 | + |
| 18 | +Users can just develop the factory test application as normal examples of the SDK. |
| 19 | + |
| 20 | +2.1 Application code |
| 21 | +-------------------- |
| 22 | + |
| 23 | +Just like other applications, the entry function of factory test application is ``app_main``. It should be added into the source code file of users. |
| 24 | +For example, users can add the ``app_main`` into ``main.c`` of the above sample project. |
| 25 | + |
| 26 | +Users can refer to the source code in file :idf_file:`/examples/system/factory-test/main/main.c` to build custom project. |
| 27 | + |
| 28 | + |
| 29 | +2.2 Linking address |
| 30 | +------------------- |
| 31 | + |
| 32 | +The SDK's partition only supports two applications that named as ``ota_0`` and ``ota_1``. |
| 33 | + |
| 34 | +In this case, we link the factory test firmware to the partition of ``ota_1``. |
| 35 | +So, please do not flash the factory test firmware into the partition of ``ota_0``. |
| 36 | + |
| 37 | + |
| 38 | +3. Compile |
| 39 | +========== |
| 40 | + |
| 41 | +To make the bootloader run the ``ota_1(factory test firmware)``, |
| 42 | +please enable the ``GPIO triggers boot from test app partition`` and set the ``correct`` GPIO of your development board in menuconfig:: |
| 43 | + |
| 44 | + Bootloader config ---> |
| 45 | + [*] GPIO triggers boot from test app partition |
| 46 | + (12) Number of the GPIO input to boot TEST partition |
| 47 | + |
| 48 | +Using the partition table file which has two "OTA" definitions partition:: |
| 49 | + |
| 50 | + Partition Table ---> |
| 51 | + Partition Table (Factory app, two OTA definitions) ---> |
| 52 | + (X) Factory app, two OTA definitions |
| 53 | + |
| 54 | +Enable the console which is used for human-computer interaction:: |
| 55 | + |
| 56 | + Component config ---> |
| 57 | + Virtual file system ---> |
| 58 | + [*] Using espressif VFS |
| 59 | + |
| 60 | +Enable pthread for this function:: |
| 61 | + |
| 62 | + Component config ---> |
| 63 | + PThreads ---> |
| 64 | + [*] Enable pthread |
| 65 | + |
| 66 | +Then call command ``make app2`` in the terminal to compile the firmware which is able to run at ``ota_1`` partition. |
| 67 | +The ``Make System`` will start compiling bootloader, partition table file, factory test firmware and so on one by one. |
| 68 | + |
| 69 | + |
| 70 | +3.1 Special Commands |
| 71 | +==================== |
| 72 | + |
| 73 | +1. ``make app2``: only compile factory test firmware which is able to run at ``ota_1``, ``with`` bootloader, partition table file and so on |
| 74 | + |
| 75 | +2. ``make app2-flash``: flash(download) only the factory test firmware which is able to run at ``ota_1``, ``without`` bootloader, partition table file and so on |
| 76 | + |
| 77 | +3. ``make app2-flash-all``: flash(download) the factory test firmware which is able to run at ``ota_1``, ``with`` bootloader, partition table file and so on |
| 78 | + |
| 79 | + |
| 80 | +4. Download |
| 81 | +=========== |
| 82 | + |
| 83 | +Input command ``make app2-flash-all`` in the terminal to download bootloader, partition table file and factory test firmware which is located at ``ota_1`` one by one. |
| 84 | + |
| 85 | +If users only want to download factory test firmware, please use command ``make app2-flash`` instead. |
| 86 | + |
| 87 | + |
| 88 | +5. Run |
| 89 | +====== |
| 90 | + |
| 91 | +Please hold the ``correct`` GPIO, which is configured in the menuconfig in Section 3 ``Compile``, to be low level and power on. |
| 92 | +Input command ``make monitor`` in the terminal, and then logs will appear like following:: |
| 93 | + |
| 94 | + ets Jan 8 2013,rst cause:1, boot mode:(3,6) |
| 95 | + |
| 96 | + load 0x40100000, len 7872, room 16 |
| 97 | + 0x40100000: _stext at ??:? |
| 98 | + |
| 99 | + tail 0 |
| 100 | + chksum 0xf1 |
| 101 | + load 0x3ffe8408, len 24, room 8 |
| 102 | + tail 0 |
| 103 | + chksum 0x78 |
| 104 | + load 0x3ffe8420, len 3604, room 8 |
| 105 | + tail 12 |
| 106 | + chksum 0x1b |
| 107 | + I (64) boot: ESP-IDF v3.2-dev-354-gba1f90cd-dirty 2nd stage bootloader |
| 108 | + I (64) boot: compile time 13:56:17 |
| 109 | + I (72) qio_mode: Enabling default flash chip QIO |
| 110 | + I (73) boot: SPI Speed : 40MHz |
| 111 | + I (80) boot: SPI Mode : QIO |
| 112 | + I (86) boot: SPI Flash Size : 2MB |
| 113 | + I (92) boot: Partition Table: |
| 114 | + I (98) boot: ## Label Usage Type ST Offset Length |
| 115 | + I (109) boot: 0 nvs WiFi data 01 02 00009000 00004000 |
| 116 | + I (120) boot: 1 otadata OTA data 01 00 0000d000 00002000 |
| 117 | + I (132) boot: 2 phy_init RF data 01 01 0000f000 00001000 |
| 118 | + I (144) boot: 3 ota_0 OTA app 00 10 00010000 000f0000 |
| 119 | + I (155) boot: 4 ota_1 OTA app 00 11 00110000 000f0000 |
| 120 | + I (167) boot: End of partition table |
| 121 | + I (173) boot: No factory image, trying OTA 0 |
| 122 | + I (5180) boot: Detect a boot condition of the test firmware |
| 123 | + I (5180) esp_image: segment 0: paddr=0x00110010 vaddr=0x40210010 size=0x37b18 (228120) map |
| 124 | + I (5263) esp_image: segment 1: paddr=0x00147b30 vaddr=0x3ffe8000 size=0x00718 ( 1816) load |
| 125 | + I (5264) esp_image: segment 2: paddr=0x00148250 vaddr=0x3ffe8718 size=0x0019c ( 412) load |
| 126 | + I (5275) esp_image: segment 3: paddr=0x001483f4 vaddr=0x40100000 size=0x084b0 ( 33968) load |
| 127 | + 0x40100000: _stext at ??:? |
| 128 | + |
| 129 | + I (5299) boot: Loaded app from partition at offset 0x110000 |
| 130 | + I (5340) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE |
| 131 | + I (5340) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE |
| 132 | + I (5530) phy_init: phy ver: 1055_12 |
| 133 | + I (5530) reset_reason: RTC reset 1 wakeup 0 store 0, reason is 1 |
| 134 | + I (5530) factory-test: SDK factory test firmware version:v3.2-dev-354-gba1f90cd-dirty |
| 135 | + |
| 136 | +Then users can input test commands to start factory testing. |
| 137 | + |
| 138 | +6. Test Commands |
| 139 | +================ |
| 140 | + |
| 141 | +1. ``rftest_init``:: |
| 142 | + |
| 143 | + parameters: no |
| 144 | + |
| 145 | + function: initialize RF to prepare for test |
| 146 | + |
| 147 | +2. ``tx_contin_func <parameter 1>``:: |
| 148 | + |
| 149 | + parameter 1: value 1 means that chip transmits packets continuously with 92% duty cycle, |
| 150 | + value 0 means that "iqview" test mode |
| 151 | + |
| 152 | + function: set test mode |
| 153 | + |
| 154 | +3. ``esp_tx <parameter 1> <parameter 2> <parameter 3>``:: |
| 155 | + |
| 156 | + parameter 1: transmit channel which ranges from 1 to 14 |
| 157 | + parameter 2: transmit rate which ranges from 0 to 23 |
| 158 | + parameter 2: transmit power attenuation which ranges from -127 to 127, unit is 0.25dB |
| 159 | + |
| 160 | + function: start transmitting Wi-Fi packets |
| 161 | + |
| 162 | + note 1: command "wifitxout" is the same as "esp_tx" |
| 163 | + note 2: the function can be stopped by command "cmdstop" |
| 164 | + |
| 165 | +4. ``esp_rx <parameter 1> <parameter 2>``:: |
| 166 | + |
| 167 | + parameter 1: transmit channel which ranges from 1 to 14 |
| 168 | + parameter 2: transmit rate which ranges from 0 to 23 |
| 169 | + |
| 170 | + function: start receiving Wi-Fi packets |
| 171 | + |
| 172 | + note 1: the function can be stopped by command "cmdstop" |
| 173 | + |
| 174 | +5. ``wifiscwout <parameter 1> <parameter 2> <parameter 3>``:: |
| 175 | + |
| 176 | + parameter 1: enable signal, value 1 means enable, value 0 means disable |
| 177 | + parameter 2: transmit channel which ranges from 1 to 14 |
| 178 | + parameter 3: transmit power attenuation which ranges from -127 to 127, unit is 0.25dB |
| 179 | + |
| 180 | + function: start transmitting single carrier Wi-Fi packets |
| 181 | + |
| 182 | + note 1: the function can be stopped by command "cmdstop" |
| 183 | + |
| 184 | +6. ``cmdstop``:: |
| 185 | + |
| 186 | + parameters: no |
| 187 | + |
| 188 | + function: stop transmitting or receiving Wi-Fi packets |
| 189 | + |
| 190 | + note 1: command "CmdStop" is the same as "cmdstop" |
0 commit comments