2019-05-29 12:01 AM
Hello,
I'm trying to imitate an I2C solution. I'm using STM32F100RB.
When selecting I2C ->
In the example, they have these GPIO settings for I2C pins:
Note the GPIO Pull-up/Pull-down option:
Here is mine:
The CUBE version is identical.
The I2C configuration is identical.
What could be the reason?
Thanks!
2019-05-29 04:16 AM
Hello @ISeed , It's reported internally for further check .
Best Regards,
Khouloud.
2019-05-29 04:59 AM
@ISeed could you please send me the ioc exemple ?
2019-05-29 10:36 AM
yes, of course. How do I send it to you?
2019-05-30 12:18 AM
@ISeed select this Icon then upload the ioc exemple file.
Regards,
Khouloud.
2019-05-30 02:34 AM
In any case, beyond the tools, nothing prevents you moving forward by programming the GPIO->PUPD registers directly.
2 lines of code, how long would it take to make it happen?
2019-05-30 02:56 AM
Hi,
Do you have an example of this?
2019-05-30 02:59 AM
2019-05-30 03:19 AM
This is your ioc file , could you please share the "example" ioc file where did you find GPIO Pull-up/Pull-down option ?
Thanks!
Khouloud.
2019-05-30 04:40 AM
open stm32l4xx_hal_gpio.c and dig in:
/* Activate the Pull-up or Pull down resistor for the current IO */
temp = GPIOx->PUPDR;
temp &= ~(GPIO_PUPDR_PUPD0 << (position * 2));
temp |= ((GPIO_Init->Pull) << (position * 2));
GPIOx->PUPDR = temp;
Want a pullup on PB3?
GPIOB->PUDR &= ~(0x03<<(3*2));
GPIOB->PUDR |= (0x01<<(3*2));
Want a pulldown on PB3?
GPIOB->PUDR &= ~(0x03<<(3*2));
GPIOB->PUDR |= (0x02<<(3*2));
Done, reading the ref man, 3 minutes, coding 2 minutes.