Rena
Active member
I'm using Teensy 3.2 to drive an ILI9481 TFT LCD on a breakout board. The protocol for transferring image data (after initialization) is pretty simple: you send X, Y, width, height, and pixel data over the 8 data lines, using the WR line as a clock. (WR has to be pulled low and then high again each time a byte is written.)
To improve performance I've connected the TFT board's 8 data lines to the 8 GPIOs that correspond to PORTC bits 0-7. So instead of 8 separate digitalWrites I can just write the byte to GPIOC_PDOR. However it still takes two more digitalWrites to toggle the WR line each time. I also can't see any way to use DMA for this with the WR requirement.
One solution I realized might be to connect WR to C8 and do two 16-bit writes to GPIOC_PDOR, first with bit 8 clear and then set, to set the data and WR lines at the same time.
The problem with this approach is that C8 is pin 28, on the bottom of the Teensy board, difficult to reach. Also one of the C pins is 13, so the LED flashes while transferring data, and I don't know what C12 through C15 are connected to. (Is it safe to touch those?)
Is there any way to change which bits of the port registers map to which physical pins, so that I can drive all of the TFT control+data lines from one register and not worry about the LED and the extra bits? Or some other clever way to push the data out a bit faster?
To improve performance I've connected the TFT board's 8 data lines to the 8 GPIOs that correspond to PORTC bits 0-7. So instead of 8 separate digitalWrites I can just write the byte to GPIOC_PDOR. However it still takes two more digitalWrites to toggle the WR line each time. I also can't see any way to use DMA for this with the WR requirement.
One solution I realized might be to connect WR to C8 and do two 16-bit writes to GPIOC_PDOR, first with bit 8 clear and then set, to set the data and WR lines at the same time.
The problem with this approach is that C8 is pin 28, on the bottom of the Teensy board, difficult to reach. Also one of the C pins is 13, so the LED flashes while transferring data, and I don't know what C12 through C15 are connected to. (Is it safe to touch those?)
Is there any way to change which bits of the port registers map to which physical pins, so that I can drive all of the TFT control+data lines from one register and not worry about the LED and the extra bits? Or some other clever way to push the data out a bit faster?