LoginSignup
6
6

More than 1 year has passed since last update.

ESP32 のGPIOピンのクセ

Posted at

ESP32のピン配置は結構自由に割り振れるのだが、調子に乗っていると起動モード用のピンにあたったり、出力しないなーと思っていたらINPUT専用のピンだったりのうっかりミスを起こしがち。
なので回路設計時には、いちいち「なんだっけ? 」と資料を何回も見なくてもいいように、これを貼っている。

image.png

改めて、知識整理のために記事化。

高精度Analog Inputピン

  • SENSOR_VP は GPIO36 として入力に使える
  • SENSOR_VN は GPIO39 として入力に使える

GPIO34 ~ 39

  • 入力専用
  • PullUp/PullDown 回路は付属していない

GPIO 6~11

  • ESP-WROOM32 の内蔵フラッシュに接続しているため、通常は使用できない

ピン設定とブートモード

ブートに関係するピンは GPIO0,2,4,5,12,15。

ピン 初期状態 Hi Lo
GPIO0 PullUp SPIブート downloadモード
GPIO2 PullDown downloadモード時、STDOからブート downloadモード時、シリアルからブート
GPIO4 - -
GPIO5 PullUp SDIO Slaveモード時にFE Output に設定 SDIO Slaveモード時にRE Output に設定
MTDI(GPIO12) Pulldown flash供給電圧を1.8Vに設定 flash供給電圧を3.3Vに設定
MTDO(GPIO15) PullUp ブート時デバッグログをU0XDに出力しない/SDIO Slaveモード時にREsamplingに設定 ブート時デバッグログをU0XDに出力する/SDIO Slaveモード時にFEsamplingに設定

備考

  • GPIO2 GPIO0がHiのときにはGPIO2の状態は起動に影響を及ぼさない
  • GPIO4 起動時の状態は検出するがここで検出した情報は現在使用していない。ユーザ側で情報を利用できる。
  • GPIO5 SDIO Slave モードを使わず通常起動であれば起動に影響を及ぼさない
  • GPIO12 ESP-WROOM32 の内蔵フラッシュは3.3VなのでLoに落として起動しないように注意

テキスト

SENSOR_VP is GPIO36
SENSOR_VN is GPIO39
IO34 to IO39 are input only
Boot mode is GPIO0,2,4,5,12,15
when boot: 
GPIO0 Pulluped / when Lo to download mode
GPIO2 Pulldowned / when GPIO0 Hi and GPIO2 Lo to serial downlaod mode 
GPIO4 detectable , but no use
GPIO5 Pulluped / when SDIO slave mode, timing set
GPIO12 Pulldowned / MTDI / when Hi to flash voltage to 1.8V
GPIO15 Pulluped / MTDO / when Lo to suppress debugging log print over U0TXD

参考資料

「ESP32 Series Datasheet」
https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
の「2.4 Strapping Pins」

「Boot Mode Selection - ESP32 - — esptool.py latest documentation」
https://docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/boot-mode-selection.html

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6