Hardware | ESP-12 사용기

|

ESP-01 부터 시작한 ESP8266 시리즈 중, 이번에는 ESP-12 사용기 입니다.


* Hardware | ESP-07 사용기

https://chocoball.tistory.com/entry/Hardware-ESP07-using


* Hardware | ESP-03 사용기

https://chocoball.tistory.com/entry/Hardware-ESP03-using


* Hardware | ESP-01 or ESP8266 사용기 - 5

https://chocoball.tistory.com/entry/Hardware-ESP01-or-ESP8266-using-5


* Hardware | ESP-01 or ESP8266 사용기 - 4

https://chocoball.tistory.com/entry/Hardware-ESP01-or-ESP8266-using-4


* Hardware | ESP-01 or ESP8266 사용기 - 3

https://chocoball.tistory.com/entry/Hardware-ESP01-or-ESP8266-using-3


* Hardware | ESP-01 or ESP8266 사용기 - 2

https://chocoball.tistory.com/entry/Hardware-ESP01-or-ESP8266-using-2


* Hardware | ESP-01 or ESP8266 사용기 - 1

https://chocoball.tistory.com/entry/Hardware-ESP01-or-ESP8266-using-1




1. 구입


일전에 구입한 ESP-07 와 동일한 업자에게서 구입.


* ESP8266 ESP-01 ESP-01S ESP-07 ESP-12E ESP-12F remote serial Port WIFI wireless module intelligent housing system Adapter 2.4G

https://www.aliexpress.com/item/32339917567.html



도착 샷.



Pinout 정보가 새겨진 뒷면.





2. Pinout


ESP8266EX 칩을 충분히 활용할 수 있는 Pinout 구성으로 되어 있습니다.





3. Breakout 보드


중간의 0 ohm 을 제거해 주면, 뒷 면의 Voltage Regulator 를 사용할 수 있게 됩니다.

이는 ESP-07 에서도 다루었던 내용이라, 자세한 내용은 생략합니다.





4. Diagram


Programming (Flashing) 하는 연결도와 Normal (구동) 하기 위한 연결도는 다릅니다. 아래 사이트에서 정보를 얻었습니다.


* Programming ESP8266 ESP-12

https://www.instructables.com/Programming-ESP8266-ESP-12/



* Programming Mode


Flash 메모리에 새로은 firmware 나 source 를 올리기 위한 mode 입니다.

차이는 IO0 / 18 번 pin 을 pull-up 해주냐 마냐의 차이.



* Normal Use Mode (after Upload)


Flash chip 에 업로드한 프로그램을 실행시키기 위한 모드 입니다.


위의 Programming 모드와 Normal 모드를 결합한 연결 구성 입니다.

이 Programming mode 로 진입하기 위해서는, 스위치 버튼 눌러주면서 전원을 on 하면 됩니다.



실제 구성 사진은 다음과 같습니다.


사실은 Breakout 보드에 ESP-12 를 결합해 놨으므로, Breakout 보드상에 이미 장착된 저항을 이용하면, 추가로 저항 2개만 필요합니다.

위 / 아래 연결 구성은 Breakout 보드가 없을 때의 모습이지만, 필요한 Pin 에 Voltage/Ground 가 연결되어 있으므로 문제 없이 동작합니다.



ESP2866 계열에서는 그나마 끝판왕인 ESP-12 가 연결된 모습.





5. 기본 확인


기본으로 올려진 Firmware version 과 몇 가지 명령어 시험.

기본 버전은 2016년1.3.0.0 이군요.



AT+RST 를 이용하여 rebooting. 사용된 Flash Chip 정보를 알 수 있습니다. QIO 모드이면서 32Mbit (512KB+512KB) 라고 나옵니다.

32Mbit1024KB+1024KB 일 듯 한데... 일단 넘어 갑니다.



Internet 에 연결하여 AT+CIUPDATE 실행을 통하여 원격 update 를 시도해 봤으나, ERROR 를 냅니다. 역시나 옛날 버전.



Flash Chip 은 QUAD : 32Mbit 로 문제 없이 확인 됩니다.





6. Programming


일단은 문제가 없는 듯 하니, source 를 올려 봅니다. 테스트 해볼 소스는 BlinkCheckFlashConfig.



CheckFlashConfig 소스는 다음과 같습니다.


/*
  ESP8266 CheckFlashConfig by Markus Sattler

  This sketch tests if the EEPROM settings of the IDE match to the Hardware
*/

void setup(void) {
  Serial.begin(115200);
}

void loop() {

  uint32_t realSize = ESP.getFlashChipRealSize();
  uint32_t ideSize = ESP.getFlashChipSize();
  FlashMode_t ideMode = ESP.getFlashChipMode();

  Serial.printf("Flash real id:   %08X\n", ESP.getFlashChipId());
  Serial.printf("Flash real size: %u bytes\n\n", realSize);

  Serial.printf("Flash ide  size: %u bytes\n", ideSize);
  Serial.printf("Flash ide speed: %u Hz\n", ESP.getFlashChipSpeed());
  Serial.printf("Flash ide mode:  %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));

  if (ideSize != realSize) {
    Serial.println("Flash Chip configuration wrong!\n");
  } else {
    Serial.println("Flash Chip configuration ok.\n");
  }

  delay(5000);
}


QIO4MiB 네요. 지금까지 완성품을 구입한 ESP8266 계열에서는 가장 좋은 Flash Chip 을 사용한 모듈 입니다.



소스가 업로드 되는 과정에 있어서도 문제 없습니다. 순탄한 흐름.


esptool.py v2.8
Serial port COM3
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 50:02:91:78:d3:60
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 267104 bytes to 196785...
Wrote 267104 bytes (196785 compressed) at 0x00000000 in 17.5 seconds (effective 122.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...


보드상에 장착된 LED 를 깜빡이는 소스 입니다.


/*
  ESP8266 Blink by Simon Peter
  Blink the blue LED on the ESP-01 module
  This example code is in the public domain

  The blue LED on the ESP-01 module is connected to GPIO1
  (which is also the TXD pin; so we cannot use Serial.print() at the same time)

  Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
*/

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  // but actually the LED is on; this is because
  // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}


예상한 것과 달리 문제 없이 동작.



지금까지 ESP8266 가지고 놀았던 과정 중, 전혀 문제 없이 여기까지 왔습니다.

ESP8266 을 Flashing 하는 작업은 이제 통달 한 듯 한 느낌.




7. Firmware Update


최신 firmware 를 사용합니다. 2020년에 공개된 Non-OS SDK 3.0.4 를 이용합니다.


ESP8266_NONOS_SDK-3.0.4.zip



Firmware upload 에 필요한 BIN 파일 및 Address 는, 최신 문서에 잘 나와 있습니다.

4a-esp8266_at_instruction_set_en.pdf



32 Mbit (4 MiB) 버전이므로, 아래 section 을 찾아 BIN / Address 정보를 그대로 사용합니다.


---------------------------------------------------------------------------------------------
|               BIN             | Address  |                 Description                    |
---------------------------------------------------------------------------------------------
| boot_v1.7.bin                 | 0x00000  | In /bin/at.                                    |
---------------------------------------------------------------------------------------------
| user1.2048.new.5.bin          | 0x01000  | In /bin/at/1024+1024.                          |
---------------------------------------------------------------------------------------------
| blank.bin                     | 0x3FB000 | Initializes RF_CAL parameter area.             |
---------------------------------------------------------------------------------------------
| esp_init_data_default_v08.bin | 0x3FC000 | Stores default RF parameter values,            |
|                               |          | has to be downloaded into flash at least once. |
|                               |          | If the RF_CAL parameter area is initialized,   |
|                               |          | this bin has to be downloaded too.             |
---------------------------------------------------------------------------------------------
| blank.bin                     | 0xFE000  | Initializes Flash user parameter area,         |
|                               |          | more details in Appendix.                      |
---------------------------------------------------------------------------------------------
| blank.bin                     | 0x3FE000 | Initializes Flash system parameter area,       |
|                               |          | more details in Appendix.                      |
---------------------------------------------------------------------------------------------


Flash chip 용량이 크고, SPI Mode 도 빠르기 때문에, 1024 KB + 1024 KB (32 Mbit-C1) 버전으로 입혀 봅니다.



별다른 문제 없이 성공. 최신 버전인 AT - 1.7.4 / SDK - 3.0.4 가 올라 갔습니다.




AT+RST 를 이용하여 rebooting sequence 를 보면, QIO / 32Mbit(1024KB+1024KB) 로 잘 동작 합니다.



참고로, "SpiAutoSet" 을 키고 업로드 하면, 강제로 32Mbit 으로 변경됩니다.



1024 KB + 1024 KB (32 Mbit-C1) 버전용 BIN / Address 를 사용하고 있으므로, 메뉴얼로 32Mbit-C1 을 선택해 줘야 합니다.




8. AT Command 확인


Internet 접속 및 전번적인 확인 작업. 특별히 문제 없슴.


* AT+CWMODE_CUR : Sets the Current Wi-Fi mode; Configuration Not Saved in the Flash

- 1: Station mode

- 2: SoftAP mode

- 3: SoftAP+Station mode


* AT+CWLAP : Lists Available APs


* AT+CWJAP_CUR : Connects to an AP; Configuration Not Saved in the Flash


* AT+CIFSR : Gets the local IP address


* AT+PING="www.google.com" : Ping packets




* AT+CIPSTATUS : Gets the connection status


* AT+CIPBUFSTATUS : Checks the status of TCP-send-buffer


* AT+CWQAP : Disconnects from the AP


AP 와 연결을 끊으면, internet 연결 정보가 깔끔하게 reset 되지 않고 일정 시간동안 남아 있습니다.

시간이 지나고 다시 확인하면 reset 되어 있슴.




* AT+CIUPDATE : Upgrades the software through network


역시 최신 firmware 라 그런지, FOTA - 인터넷을 통한 firmware update 가 가능합니다.



Firmware update 하면서 LED 가 깜빡거리는 모습이 좋아, 동영상으로 담아 봤습니다.




* AT+RESTORE : Restores the Factory Default Settings



모든 확인이 끝났습니다. 앞으로 sensor 들과 같이 활용할 기회에 사용하면 되겠네요.




FIN


중국 제조사 답게 WeChat 관련한 옵션이 새로 추가되었습니다.



And