2024-11-29 04:38 AM
Hi everyone I'm rather new with programming with STM32 controllers and I am currently using NUCLEO-L432KC. Currently I'm facing a problem with HAL_GPIO_WritePin() function. I am interfacing with a 16x2 LCD and I am trying to write to the RS pin via the function I have mentioned, however I am facing a problem where the RS isn't being set to the desired value I am providing. I have provided the value like so: HAL_GPIO_WritePin(RS_GPIO_Port, RS_Pin, rs);
Where I have given rs = 0 but the function is setting the value as 1. I have also provided the photo of the RS pin configuration from the IOC file.
2024-11-30 03:51 AM
As you mentioned I checked with the LED blink program and that works perfectly fine. Reconfiguring the same program with the RS pin however the problem as I have mentioned occurs, it doesn't set to zero when I pass it in HAL_GPIO_WritePin (the RS pin isn't being toggled). I even reconfigured the RS pin to another pin, originally I configured it to PA0 and it didn't work, this time I just gave it to PA1 and the same problem occurs.
HAL_GPIO_WritePin(RS_GPIO_Port, RS_Pin, SET);
HAL_Delay(1000);
HAL_GPIO_WritePin(RS_GPIO_Port, RS_Pin, RESET);
HAL_Delay(1000);
2024-11-30 06:36 AM
So, again, have you checked the Nucleo board's User Manual and/or schematics to see that nothing else is using that pin?