Hi there!
I’m building a pinball machine and am currently designing the display system.
You can follow the progress on my blog at http://poormanspinball.blogspot.com, if you’d like.
Now for my question(s):
Using a Arduino Mega2560, my current revision is using direct port manipulation to send the bits to the system at about 170 us per 128 bit row.
For a total of 32 rows, it summons up to around 5.5 ms for a full frame (4096 bit), which becomes increasingly slow when more colors (frames) are being added.
I can probably shave of a few microseconds by unrolling the three nested for-loops.
Can I reach even higher values with SPI?
Is it faster than direct port manipulation? If so - how?
The commonly described " while(!(SPSR & (I << SPIF)));" , must it be used? Or can I simply push 128 bit data and hope it arrives?
The reason I’m simply not testing away is that there’s a lot of stuff to rewire and reconfigure for SPI to be used, so I’d take a chance to check with you guys first.
The data is stored in a “byte frame[32][128]” variable which must be compared during runtime to see which shade it has. I.e a simple:
if (frame[y][x] > CURRENT_COLOR_LAYER) writePin(COLUMN_DATA, HIGH); else writePin(COLUMN_DATA, LOW);
Can this be speeded up in any way?
I figure that it should be possible (somehow) to get the performance up to around 56 us based on the “Staggering SPI” document. But how?
Thanks for your time, looking forward to some input on this matter!