Error in STM32 LL GPIO driver
Greetings. I wasted a lot of time trying to figure out what is wrong with I2Ccommunication and thus found this issue. Following code works as it is expected to (it changes corresponding CNFy bits to 0x03 and MODEy bits to 0x03 too):
/* Configure SCL Pin as : Alternate function, High Speed, Open drain, Pull up */
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_6, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetPinSpeed(GPIOB, LL_GPIO_PIN_6, LL_GPIO_SPEED_FREQ_HIGH);
LL_GPIO_SetPinOutputType(GPIOB, LL_GPIO_PIN_6, LL_GPIO_OUTPUT_OPENDRAIN);
LL_GPIO_SetPinPull(GPIOB, LL_GPIO_PIN_6, LL_GPIO_PULL_UP);
/* Configure SDA Pin as : Alternate function, High Speed, Open drain, Pull up */
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_7, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetPinSpeed(GPIOB, LL_GPIO_PIN_7, LL_GPIO_SPEED_FREQ_HIGH);
LL_GPIO_SetPinOutputType(GPIOB, LL_GPIO_PIN_7, LL_GPIO_OUTPUT_OPENDRAIN);
LL_GPIO_SetPinPull(GPIOB, LL_GPIO_PIN_7, LL_GPIO_PULL_UP);�?�?�?�?�?�?�?�?�?�?�?
Given:
#define RF430_NRST LL_GPIO_PIN_4
#define RF430_INT LL_GPIO_PIN_5
#define RF430_I2C_SIG LL_GPIO_PIN_8
#define RF430_I2C_RD LL_GPIO_PIN_9
#define RF430_SDA LL_GPIO_PIN_7
#define RF430_SCL LL_GPIO_PIN_6
#define RF430_IO_PORT GPIOB�?�?�?�?�?�?�?�?
Next code snippet should do the same job.However for some reason it sets CNFy bits to 0x02 and MODEy bits to 0x01, which is far from what I expect to see.
LL_GPIO_InitTypeDef pin_init;
pin_init.Mode = LL_GPIO_MODE_ALTERNATE;
pin_init.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
pin_init.Speed = LL_GPIO_SPEED_FREQ_HIGH;
pin_init.Pull = LL_GPIO_PULL_UP;
pin_init.Pin = RF430_SCL;
LL_GPIO_Init(RF430_IO_PORT, &pin_init);
pin_init.Pin = RF430_SDA;
LL_GPIO_Init(RF430_IO_PORT, &pin_init);�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
GPIO LL driver code looks like totally unreadable mess, so I can't figure outwhetherit is my bad or issue in code. However some workaround and clarification required, I think.
#gpio #ll-gpio #ll-drivers #ll #i2c