Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8452

General • Re: I can't detect I2C devices on pico2 RP2350

$
0
0
This look fine.
In the C SDK bus_scan.c example, GPIO calls are made to enable the pullups but there are no calls to disable the pulldowns -- this might be the difference versus MicroPython.

Code:

    gpio_pull_up(PICO_DEFAULT_I2C_SDA_PIN);    gpio_pull_up(PICO_DEFAULT_I2C_SCL_PIN);
gpio_pull_up():

Code:

/*! \brief Set specified GPIO to be pulled up. *  \ingroup hardware_gpio * * \param gpio GPIO number */static inline void gpio_pull_up(uint gpio) {    gpio_set_pulls(gpio, true, false);}

gpio_set_pulls(gpio, true, false);
4.1.10.7.65. gpio_set_pulls
void gpio_set_pulls (uint gpio, bool up, bool down)
Select up and down pulls on specific GPIO.
Parameters
gpio GPIO number
up If true set a pull up on the GPIO
down If true set a pull down on the GPIO
NOTE On the RP2040, setting both pulls enables a "bus keep" function, i.e. a weak pull to whatever is current high/low state of GPIO.

Statistics: Posted by gmx — Fri Mar 28, 2025 7:29 pm



Viewing all articles
Browse latest Browse all 8452

Trending Articles