0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5Atomのピンと競合機能 など

Last updated at Posted at 2025-07-02

とりあえず発見したものから、どんどん追記していこうと考えています。

ピンと競合機能

内蔵IMUと21,25番ピンは同時に使えない。
これはIMUが内部的にSDAに25、SCLに21番ピンを使っているからだそうだ。

platformIOのエラーとバージョン管理

platformIOでMFRC522_I2C.hを使ったプログラムを書き込むことまでは成功したが、シリアルモニタを開くと
requestFrom(): i2cRead returned Error 263
が発生してうまく動かなかった。ググると

というのがあって、platform = espressif32@2.0.0にしたら治ったとあったがさすがにこれは嘘だろう
なぜならUnknownBoard: Unknown board ID 'm5stack-atom'と言われるからだ。
ちゃんと調べたわけではないが、m5stack-atomが利用可能(なくらい新しい)、かつMFRC522_I2C.hライブラリがイイカンジに使える(くらい古い)バージョンとして、
platform = espressif32@5.0.0

としたら使えるようになった

IMUが使えない?

Wire.hをインクルードしていないコードで

[ 11370][E][Wire.cpp:319] beginTransmission(): could not acquire lock
[ 11371][E][Wire.cpp:370] requestFrom(): Unfinished Repeated Start transaction! Expected address do not match! 104 != 0      
[ 11377][E][Wire.cpp:313] beginTransmission(): Unfinished Repeated Start transaction! Expected requestFrom, not beginTransmission! Clearing...

assert failed: xQueueGenericSend queue.c:820 (pxQueue)

というエラーが出た。
エラー中の104番アドレス(0x68)は内蔵IMUのI2Cアドレスだそうだ。確かにIMUを使おうとしたとき、このエラーに遭遇した。
解決法は、platformio.iniの
platform = espressif32@5.0.0
となっていたところを
platform = espressif32 としてバージョン指定しない(すなわち最新バージョンを使用する)
にしたら直った。
MFRC522を使うためにはespressif32@5.0.0、それ以外のとき(特に内蔵IMUを使うとき)には6系か最新を使うようにするべきだろう。

M5Stack BasicのI2CピンをGPIOとして使いたい

M5Stack BASICの「PORT.A.I2C」なGroveコネクタは上からGPIO22,GPIO21で普通に入出力ピンとして使える。
image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?