I'm trying to drive an LCD display over an 8-bit data bus + 4 control lines. I have connected it to 12 pins on the Arduino Edison board (D0-11 right now).
The 8 data lines (D0-7) need to switch IO direction between write and reads, eg I need to write an 8 bit command, then toggle to read mode, flag the "read" control pin and read out the 8-bit result.
Whenever I call mraa_gpio_dir() on the 8 data pins to switch from out to in, all my pins that are high (even the control pins D8-11) toggle from high to low to high 8 times, which the LCD obviously treats as an intentional input, and therefore doesn't work (eg the above mentioned read-after-write can only read zeros).
Inspired by KurtE's MRAA optimizations (in Ping Sensor - pinMode too slow? (both Arduino and MRAA)), I did some hacking in MRAA and found that both the tristate flipping and the write to the "outputen" pin trigger the high-low-high transition on the other pins. By holding the tristate pin low once for all 8 data direction changes, I can reduce the undesired pin flips to only happen once instead of 8 times, but that is still not sufficient for correct functioning of the LCD.
Is there any way to not have all pins flip when the tristate gets changed? Like if i were do to some kernel hacking could I get further on this or is this a general limitation of the hardware design? Or are there any pins that are isolated from the tristate that I could put my control pins on?
Thanks for any help!