GPIO36,39 as digital input not working

xenpac
Posts: 33
Joined: Sun Dec 08, 2019 1:20 am

GPIO36,39 as digital input not working

Postby xenpac » Fri Mar 27, 2020 5:19 pm

Hi guys,-)

I have a CSI camera attached and IO36, IO39 is used as input for D0,D1.

I cant get readings of the input.

All others are working (2 15 13 12 14 33 34 35 32)


Do i need to disable ADC or Hall sensor or ?

any clues welcome:-)

here my io init and reading:

Code: Untitled.txt Select all

	int i;
gpio_config_t conf;

conf.pin_bit_mask=0;
for (i=0;i<sizeof(pintab)/sizeof(gpio_num_t);i++)
// gpio_set_direction(pintab[i], GPIO_MODE_INPUT); // doesnt work as expected!
conf.pin_bit_mask |= 1ULL<<pintab[i]; // set the pin bits for gpio_config to apply below settings.

conf.intr_type = GPIO_INTR_DISABLE;
conf.mode = GPIO_MODE_INPUT;
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
conf.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&conf); // we need to do it with gpio_config, otherwise some pins dont work as expected!!!

.....
reading:
if (pin < 32)
{
state = (GPIO_REG_READ(GPIO_IN_REG) >> pin) & 1U;
}
else
{
pin -= 31;
state = (GPIO_REG_READ(GPIO_IN1_REG) >> pin) & 1U;
}

Thanks

xenpac
Posts: 33
Joined: Sun Dec 08, 2019 1:20 am

Re: GPIO36,39 as digital input not working

Postby xenpac » Fri Mar 27, 2020 5:26 pm

ooouuups.......

i found it.

reading inputs correct version:

if (pin < 32)
{
state = (GPIO_REG_READ(GPIO_IN_REG) >> pin) & 1U;
}
else
{
pin -= 32;
state = (GPIO_REG_READ(GPIO_IN1_REG) >> pin) & 1U;
}

Who is online

Users browsing this forum: ChatGPT-User and 2 guests