PS In reality I want an 16 bit port to drive a 480x320 LCD, I used an 8bit example for clarity.
PPS I have development board with an LCD based on stm32f429. AFAIK, they use 3x6bit outputs to make a 16bit bus.
What kind of display is that?
I have used a 480x320 with an iLI9481 controller, and managed to get about 33 mega pixel per second writing random sized rectangles (
crappy video link, on the right px/s, on the left rect/s).
That was on a F4 Discovery (STM32F407), and using the FSMC configured for a 16 bit static memory with only one address line: the display was accessed through two pointers, one for commands and one for data:
void FillRect( uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2 )
{
if( x1 > x2 ) SWAP( x1, x2 );
if( y1 > y2 ) SWAP( y1, y2 );
uint32_t area = (x2 - x1 + 1)*(y2 - y1 + 1);
WindowLCD( x1, y1, x2, y2 );
*pCmd = ILI_RAMWRITE;
for( uint32_t i = 0; i < area; i++ ) *pData = lcd.colFG;
}
If the STM32F429 board is a Discovery too, it's driving the (iLI9341) display through the integrated TFT controller (a raster interface) and uses 18bit (6x3) colour, SPI is also possible.
So, your options depend very much on the display controller and whether it has been hardwired for a specific bus, and on the availability of the FSMC and LTDC peripherals on your STM32 of choice.
If you need to resort to GPIO bit wrangling, performance will probably be worse and you'll have to fight the odd pinout...
And CubeMX is actually pretty good once you figure it out, its just the code it generates and the HAL drivers it uses are quite a mess.
Yes, they are, but I found them not worse and actually less bugged than other vendors libs, e.g. TI and NXP.