esp32arduino
*ESP32でArduino [[index]] #contents **ボード [[ESP32-DevKitC ESP-WROOM-32開発ボード>https://akizukidenshi.com/catalog/g/gM-11819/]] ボードはESP32 Dev Module **Lチカ Arduino1.8.5 + esp8266 ver2.4.1 esp32_blinky.ino >void setup() { > pinMode(23,OUTPUT); >} > >void loop() { > digitalWrite(23,HIGH); > digitalWrite(23,LOW); >} **Hello Arduino1.8.5 + esp8266 ver2.4.1 esp32_hello.ino >void setup() { > Serial.begin(115200); > while(!Serial); > Serial.printf("Hello! ESP32.\r\n"); >} > >void loop() { > Serial.printf("."); > delay(1000); >} **加速度センサー ***LIS3DH Arduino1.8.5 + esp8266 ver2.4.1 SparkFun LIS3DH Breakout 1.0.0 秋月電子 LIS3DH \600 [[http://akizukidenshi.com/catalog/g/gK-06791/]] ライブラはSparkFun ライブラリマネージャからSparkFun LIS3DH Breakoutをインストール MSBFIRST無いってエラーでるので、Arduino\libraries\SparkFun_LIS3DH_Breakout\src\SparkFunLIS3DH.cppを書き換え includeの後ろに、下記記述追加。 >#define MSBFIRST 1 ↓ githubから落としたver1.0.1に置き換え。 [[https://github.com/sparkfun/SparkFun_LIS3DH_Arduino_Library]] それはMSBFIRSTのエラー出なかった。 基板はA,Bをショート、Cはオープンにして5ピンをVCCにショート(SparkFunのボードと同じ構成にした)。 当初SCL,SDAをDefaultとは違う、別ポートにしていたら動かなかった。(ピン指定してもダメだった。SDOが常に同じ値で、シリアルモニタの表示値は0) ソースはサンプルをそのまま [[https://github.com/sparkfun/SparkFun_LIS3DH_Arduino_Library/blob/master/examples/MinimalistExample/MinimalistExample.ino]] **はまり ***タイマー割り込み入らない Arduino1.8.5 + esp8266 ver2.4.1 + Sparkfun LIS3DH ver1.0.1 なぜかこれ追加でタイマー割り込みかからない > myIMU.settings.accelSampleRate = 100; > myIMU.begin(); > Wire.setClock(400000); //must after myIMU.begin(); ↓ いろいろいじっていたら動く組み合わせもあるので、どっかでなにかが邪魔してる。多分自分のせい。 ↓ 初期化順序を タイマー -> myIMU -> Wireにしたら動いた ↓ と思ったらやっぱダメ 良い時とダメな時がある。 ***SPIとGPIOの初期化タイミング SPIを初期化すると、デフォルトのGPIOポートが初期化されちゃうので、SPI初期化後にGPIO初期化する必要が有る。 ***UPnPで不具合? 検証したのではなくやってみたレベルなんですが、アクセスポイントのUPnPを「使用する」にしているとTCP通信が失敗した。 使用しないように設定したらTCP通信の失敗が無くなった。ような気がする。 うーん。 APはWR8600NのRTモードで、WAN未接続、ESP32はAPへ2.4G接続。IPアドレスは固定(DHCPは生かしてあるが使用しない) **ウェイト ets_delay_us(x) [[【ESP32】マルチタスク中でμs単位でdelayをかける>http://rikoubou.hatenablog.com/entry/2017/07/27/151139]] **チップリビジョン Revision0は、なんか動作が不安定だった。交換したら動いて今迄の苦労は...てなった。 ***パッケージの刻印でもわかる [[https://ht-deko.com/arduino/esp-wroom-32.html#21]] ***チップにアクセスして確認 Windows StoreでPythonを入れる Python3.11 esptoolを落とす [[https://github.com/espressif/esptool]] >pip install esptool コマンドプロンプトで、さっきおとしたesptoolのフォルダに入って >python3 espefuse.py -p COM12 summary とやると > espefuse.py v4.7-dev > Connecting.... > Detecting chip type... Unsupported detection protocol, switching and trying again... > Connecting.... > Detecting chip type... ESP32 > > === Run "summary" command === > EFUSE_NAME (Block) Description = [Meaningful Value] [Readable/Writeable] (Hex Value) > ---------------------------------------------------------------------------------------- > Calibration fuses: > ADC_VREF (BLOCK0) True ADC reference voltage = 1100 R/W (0b00000) > > Config fuses: > WR_DIS (BLOCK0) Efuse write disable mask = 0 R/W (0x0000) > RD_DIS (BLOCK0) Disable reading from BlOCK1-3 = 0 R/W (0x0) > DISABLE_APP_CPU (BLOCK0) Disables APP CPU = False R/W (0b0) > DISABLE_BT (BLOCK0) Disables Bluetooth = False R/W (0b0) > DIS_CACHE (BLOCK0) Disables cache = False R/W (0b0) > CHIP_CPU_FREQ_LOW (BLOCK0) If set alongside EFUSE_RD_CHIP_CPU_FREQ_RATED; the = False R/W (0b0) > ESP32's max CPU frequency is rated for 160MHz. 24 > 0MHz otherwise > CHIP_CPU_FREQ_RATED (BLOCK0) If set; the ESP32's maximum CPU frequency has been = False R/W (0b0) > rated > BLK3_PART_RESERVE (BLOCK0) BLOCK3 partially served for ADC calibration data = False R/W (0b0) > CLK8M_FREQ (BLOCK0) 8MHz clock freq override = 51 R/W (0x33) > VOL_LEVEL_HP_INV (BLOCK0) This field stores the voltage level for CPU to run = 0 R/W (0b00) > at 240 MHz; or for flash/PSRAM to run at 80 MHz.0 > x0: level 7; 0x1: level 6; 0x2: level 5; 0x3: leve > l 4. (RO) > CODING_SCHEME (BLOCK0) Efuse variable block length scheme > = NONE (BLK1-3 len=256 bits) R/W (0b00) > CONSOLE_DEBUG_DISABLE (BLOCK0) Disable ROM BASIC interpreter fallback = True R/W (0b1) > DISABLE_SDIO_HOST (BLOCK0) = False R/W (0b0) > DISABLE_DL_CACHE (BLOCK0) Disable flash cache in UART bootloader = False R/W (0b0) > > Flash fuses: > FLASH_CRYPT_CNT (BLOCK0) Flash encryption is enabled if this field has an o = 0 R/W (0b0000000) > dd number of bits set > FLASH_CRYPT_CONFIG (BLOCK0) Flash encryption config (key tweak bits) = 0 R/W (0x0) > > Identity fuses: > CHIP_PACKAGE_4BIT (BLOCK0) Chip package identifier #4bit = False R/W (0b0) > CHIP_PACKAGE (BLOCK0) Chip package identifier = 0 R/W (0b000) > CHIP_VER_REV1 (BLOCK0) bit is set to 1 for rev1 silicon = True R/W (0b1) > CHIP_VER_REV2 (BLOCK0) = False R/W (0b0) > WAFER_VERSION_MINOR (BLOCK0) = 0 R/W (0b00) > WAFER_VERSION_MAJOR (BLOCK0) calc WAFER VERSION MAJOR from CHIP_VER_REV1 and CH = 1 R/W (0b001) > IP_VER_REV2 and apb_ctl_date (read only) > PKG_VERSION (BLOCK0) calc Chip package = CHIP_PACKAGE_4BIT << 3 + CHIP_ = 0 R/W (0x0) > PACKAGE (read only) > > Jtag fuses: > JTAG_DISABLE (BLOCK0) Disable JTAG = False R/W (0b0) > > Mac fuses: > MAC (BLOCK0) MAC address > = 24:0a:c4:08:98:d8 (CRC 0xe5 OK) R/W > MAC_CRC (BLOCK0) CRC8 for MAC address = 229 R/W (0xe5) > MAC_VERSION (BLOCK3) Version of the MAC field = 0 R/W (0x00) > > Security fuses: > UART_DOWNLOAD_DIS (BLOCK0) Disable UART download mode. Valid for ESP32 V3 and = False R/W (0b0) > newer; only > ABS_DONE_0 (BLOCK0) Secure boot V1 is enabled for bootloader image = False R/W (0b0) > ABS_DONE_1 (BLOCK0) Secure boot V2 is enabled for bootloader image = False R/W (0b0) > DISABLE_DL_ENCRYPT (BLOCK0) Disable flash encryption in UART bootloader = False R/W (0b0) > DISABLE_DL_DECRYPT (BLOCK0) Disable flash decryption in UART bootloader = False R/W (0b0) > KEY_STATUS (BLOCK0) Usage of efuse block 3 (reserved) = False R/W (0b0) > SECURE_VERSION (BLOCK3) Secure version for anti-rollback = 0 R/W (0x00000000) > BLOCK1 (BLOCK1) Flash encryption key > = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W > BLOCK2 (BLOCK2) Security boot key > = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W > BLOCK3 (BLOCK3) Variable Block 3 > = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 R/W > > Spi Pad fuses: > SPI_PAD_CONFIG_HD (BLOCK0) read for SPI_pad_config_hd = 0 R/W (0b00000) > SPI_PAD_CONFIG_CLK (BLOCK0) Override SD_CLK pad (GPIO6/SPICLK) = 0 R/W (0b00000) > SPI_PAD_CONFIG_Q (BLOCK0) Override SD_DATA_0 pad (GPIO7/SPIQ) = 0 R/W (0b00000) > SPI_PAD_CONFIG_D (BLOCK0) Override SD_DATA_1 pad (GPIO8/SPID) = 0 R/W (0b00000) > SPI_PAD_CONFIG_CS0 (BLOCK0) Override SD_CMD pad (GPIO11/SPICS0) = 0 R/W (0b00000) > > Vdd fuses: > XPD_SDIO_REG (BLOCK0) read for XPD_SDIO_REG = False R/W (0b0) > XPD_SDIO_TIEH (BLOCK0) If XPD_SDIO_FORCE & XPD_SDIO_REG = 1.8V R/W (0b0) > XPD_SDIO_FORCE (BLOCK0) Ignore MTDI pin (GPIO12) for VDD_SDIO on reset = False R/W (0b0) > > Flash voltage (VDD_SDIO) determined by GPIO12 on reset (High for 1.8V, Low/NC for 3.3V) **参考 [[ESP32-WROOM-32>https://ht-deko.com/arduino/esp-wroom-32.html]] [[Arduino core for the ESP32 リファレンス>https://garretlab.web.fc2.com/arduino/esp32/reference/]] [[Arduino – ESP32 のマルチタスク ( Dual Core ) を試す>https://www.mgo-tec.com/blog-entry-arduino-esp32-multi-task-dual-core-01.html]] xSemaphoreGiveFromISR [[https://www.renesas.com/cn/ja/products/gadget-renesas/reference/gr-rose/rtos-semaphore.html]]
2025-04-01 00:10:20 32400