Closed hasenradball closed 5 months ago
Looks like you need to make sure you change the PICO_DEFAULT_I2C
define before you include i2c.h
? (see https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_i2c/include/hardware/i2c.h#L76 )
Also, I believe if you #define
d your new values before including any of the pico header-files, then you wouldn't need to #undef
them.
@lurch Hi,
thanks for the fast reply. Ok this could be the point. I will check this.
by the way a happy new year 😊
@lurch
I tried your proposal but does not help here.
It seems to be tricky to use the i2c1
.
Is there an official example how to use i2c1
?
If you want to explicitly use i2c1
, it might be easier to modify the code to explicitly refer to I2C1 and the new pins you're using, rather than trying to hackily override the "defaults" mechanisms?
@lurch Thanks for your reply.
This I also tried, but without any success.
It seems to me actually, I is only possible to use i2c0
with pins 4 / 5.
So I also wondering about that all examples you find in the net use i2c0
with pins 4 / 5.
See https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#pinout-and-design-files and be careful that you don't mix up "pin numbers" and "GPIO numbers". Software will always use the GPIO numbers.
@lurch I used always GPIO numbers.
I just want to switch between these two ports:
This is beginning to feel more like a support question, rather than a bug report. Support questions belong in https://forums.raspberrypi.com/
@lurch I thik I had to double check this with a new Pico.
@hasenradball any chance you could tell me what components you're using to test this? Thanks.
Hi Peter,
I had doupt that my pico works fine, I am waiting for my new layoutet pico dev board. then I will test again. Then I will give some feedback.
Frank
@peterharperuk Hi Peter what about the issue of the dht Sensor? I was wonderin why you don‘ t merged my proposal into develop due to the fact it works, against the actual example don‘ t.
Frank
Yes. It'll get merged soon. It just needs me to test it again
@peterharperuk are these boards not lovely?
I finally found a display to test this and it works fine on i2c1. I have pushed a fix that might make it a bit easier to change. The code is pretty bad - it would be nice to fix that sometime and get it to work with more modern devices.
P.S. The boards look very nice. What do they do?
The code is pretty bad
IIRC it was written by an intern, and everyone was so busy that no-one had the time to polish it.
@peterharperuk the board can take a pico or picoW. You can directly plug it onto the 40 pin on the pi, use the CSDK and directly program and flasch the pico. Additionally you have 3 buttons to use, 3 LEDs, and both I2c interfaces and so on…
@peterharperuk i could not see any change in the examples.
I was referring to this commit https://github.com/peterharperuk/pico-examples/commit/3faa5f4a83de616c53d87767d41fff478ffaeeee
I was referring to this commit peterharperuk@3faa5f4
That commit bypasses the "default pins" mechanism, which I guess means that it "breaks" that example for anybody using a board that redefines I2C onto a different set of pins? e.g. https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/sparkfun_thingplus.h#L46
It was just for testing so I could close this issue
@peterharperuk @lurch Hi guys I could test now the LCD_1602 example with a new Pico. I wrote a object oriented example to easiliy swith between i2c0 and i2c1. It works now fine so the issue was located in damaged Pico. Here connected to GPIO 2 and GPIO3
So issue could be closed. Sorry for miss leading.
PS: why don't you use more object oriented examples, this would be much easier to adapt like in this to switch from i2c0 to i2c1.
Best regards frank
I finally found a display to test this and it works fine on i2c1. I have pushed a fix that might make it a bit easier to change. The code is pretty bad - it would be nice to fix that sometime and get it to work with more modern devices.
P.S. The boards look very nice. What do they do?
Why don't you pushed the fix on the develop branch? It seems to me it takes very long time if the examples (develop/master) branch are updated, isn't it?
Best regards
Frank
It's just not the top priority at the moment. We generally push as many changes as we can before making an sdk release. So it'll happen then or when it gets to the top of my todo list.
@peterharperuk understood, thanks for the update. nice evening and weekend.
Hello,
The example LCD1602_i2c does not work with the i2c1 instance. I changed the I2C instance to:
Does anybody know how to get the I2C Example to work with the
ì2c1
?