GPIO data bus speed optimization/recommendation(s)
Greetings embed Professionals
Recently taken onto STM32 and getting along quite well so far! Regretting for not having done so earlier so plenty of catch up and "learning to do" (ps. mechanical engineering background here).
Learning in particular; I'd like to investigate how professionals would go about implementing an optimized data bus for lower end mcu (e.g. STM32F1x/budget limitations). Below is what I have coded so far, which works great btw, however I feel the performance is quite lacking, something, somewhere.
Is there any other way(s) I could get 16-bit across faster???
ps. The #define DATAOUT(i) seems to be the bottleneck
Thanks for any recomendation/alternative ways you may have, I'd sincerely appreciate a hand
//LCD.H
#define DATAOUT(i) { \
GPIOA->BSRR = 0b0001000011111111 << 16; \
GPIOA->BSRR = (((i) & (1<<0)) << 0) \
| (((i) & (1<<1)) << 0) \
| (((i) & (1<<2)) << 0) \
| (((i) & (1<<3)) << 0) \
| (((i) & (1<<4)) << 0) \
| (((i) & (1<<5)) << 0) \
| (((i) & (1<<6)) << 0) \
| (((i) & (1<<7)) << 0) \
| (((i) & (1<<12)) << 0); \
GPIOB->BSRR = 0b1110111100000000 << 16; \
GPIOB->BSRR = (((i) & (1<<8)) << 0) \
| (((i) & (1<<9)) << 0) \
| (((i) & (1<<10)) << 0) \
| (((i) & (1<<11)) << 0) \
| (((i) & (1<<13)) << 0) \
| (((i) & (1<<14)) << 0) \
| (((i) & (1<<15)) << 0); \
}
//LCD.C
static void WriteData(uint16_t data)
{
//elapsed_time_start(0);
DATAOUT(data); //elapsed_time@72Mhz -> 81 ticks(?!)
//elapsed_time_stop(0);
}