Monday, June 19, 2023

Dual speed SPI link needed

UPPED THE SPEED OF THE SPI LINK TO 25MHZ FOR FASTER SCREEN REDRAW

The process of redrawing the screen sends a substantial number of bits over the SPI link. For example, clearing the screen by writing black pixels sends 2,457,600 data bits over the link so that at 25MHz this operation alone takes about a tenth of a second. At the earlier 2.5MHz testing speed the pause was painful. Each time an up or down arrow is pushed there will be a redraw. At least now it will be tolerable. 

THE TOUCH CONTROLLER CAN'T OPERATE AT THIS SPEED

The touch controller chip (XPT2046) is accessed at 3MHz in the demonstration code, which drops down from the 18MHz speed it uses when communicating with the LCD controller chip. My nearest attainable speed is 2.5MHz, in order that the touch controller chip can communicate with us. Per the top section, this is painfully slow when drawing screens through the LCD controller chip. 

THE SOLUTION IS TO STOP, CHANGE SPEEDS AND START

The general logic of my interface is that once we through up a screen, there is no action on the LCD screen until the user has touched somewhere to attempt a button press, or the disk drive in the IBM 1130 has come up to speed and believed it loaded the heads onto the disk platter. 

Thus the user interface logic is watching for the touch interrupt, the signal for head loading, or the signal that our power has failed necessitating a quick unload of the disk contents to the SD card. When we enter this watching portion of the logic, we will call a function to set the SPI speed down to 2.5MHz for communication with the touch controller. 

After we see a touch, we will have interrogated the controller chip to extract the X and Y coordinates of the touch action. These cause various actions such as moving the highlighted virtual cartridge name, ending with the need to redraw the screen. To redraw, we first will call a function to set the SPI speed back up to 25MHz. 

Changing the speed is straightforward. We disable the SPI link by setting a bit in a control register, we load the new baud rate value in another control register, then enable by restoring the bit in the first control register. These will be simple functions contained in a new changeSPIspeed module, called SPIslowdown and SPIspeedup respectively. I am developing the code now and will add the calls into the user interface module as described above. 

No comments:

Post a Comment