Thu, May 25, 2023 at 12:03:20AM -0400, Hugo Villeneuve kirjoitti: > From: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx> > > When we want to configure a pin as an output pin with a value of logic > 0, we end up as having a value of logic 1 on the output pin. Setting a > logic 0 a second time (or more) after that will correctly output a > logic 0 on the output pin. > > By default, all GPIO pins are configured as inputs. When we enter > c16is7xx_gpio_direction_output() for the first time, we first set the Missing 's'. > desired value in IOSTATE, and then we configure the pin as an output. > The datasheet states that writing to IOSTATE register will trigger a > transfer of the value to the I/O pin configured as output, so if the > pin is configured as an input, nothing will be transferred. > > Therefore, set the direction first in IODIR, and then set the desired > value in IOSTATE. > > This is what is done in NXP application note AN10587. -- With Best Regards, Andy Shevchenko