ysw0145 wrote:I change the i2c scanner program (from
https://github.com/nkolban/esp32-snippe ... cscanner.c) 's I2C pin map.
Code: Select all
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
[b] conf.sda_io_num = 25;
conf.scl_io_num = 27;[/b]
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = 100000;
And connect SDA & SCL to 18,19.
Then,it still works without any error.
As a result,I can not map the i2c pins to whatever I want.....
What's wrong?
first: why you set up the pins 25, 27 directly and
not use the nice define for it
Code: Select all
#define SDA_PIN 25
#define SCL_PIN 27
second,
like jeroen mentioned, make clean -
cause looks like if you do this:
Code: Select all
conf.sda_io_num = 25;
conf.scl_io_num = 27;
"but" you connect
SDA & SCL to 18,19.
and your hardware runs without problem with this setup ( connected on 18,19 )
then it looks like you work with "old" .o and .a file for your main or what ever you do
on code with I2C, with a preview compile on 18,19 and your project was not updated.
if you work in eclipes example
be sure you "save your changes on the .c file where you make this change
example by STRG + S
then compile.
if you forget this, then it compiles too, but your changes on the code was not updated.
FYI: if you change a file in eclipse, there is a * in begin of file name
like this:
your file is up2date
- 1.png (32.48 KiB) Viewed 8302 times
you did a change on it - if you compile - this change is not supported in the compilation
- 2.png (46.75 KiB) Viewed 8302 times
save your changes first - then compile
- 3.png (39.95 KiB) Viewed 8302 times
and use the define for the pins
you never need change then in the main and on each other place if you work
moretimes on this pins, simple then change only in the top of the file
and on one and only place.
hope this helps
best wishes
rudi