Monday 25 August 2014

TFTM1802 SPI Display Library Beta1 for CY8CKIT-049-42xx by C/D

New TFTM1802 SPI Display Library, version Beta1 for CY8CKIT-049-42xx kit.

After an high workload on SPI (SCB mode) [v1.20] Component inside PSoC Creator, we have made a first version of our beta library for any cheap display compatible with standard S6D02A1 or ST7735.

There's lots version of this display, and lots of initializations that you can consider to work properly on these displays. So we refer, in this project, only to model TFTM1802; that you can handily purchase over ebay.

We don't guarantee that it can work with other models... at any rate right now...

The Component made available from Cypress Semiconductor it's a powerful component, but the power is nothing without control, so you have to know more in depth this component to work with it.

Our SPI configuration is for a 5 pins display, related to a port with MOSI - CLK - RS - CS - RST (BL a part); all of standard configurations need an additional pin (MISO) that we want to keep out from our setting.

For our purpose, the only configuration that allows to make a custom setting, it's the "Unconfigured SCB". This configuration needs to write in your code a structure to set every entries; we set this structure with all control datas into "ControlLCD.c" and with it you can dispose a 5 pins SPI bus on your board (CY8CKIT-049-42xx) simply with an #include "file" .

Some info about this configuration, entry by entry (clear up):

- uint32 mode (Mode of operation for SPI)
- uint32 submode (Submode SPI. In our case SCB_SPI_MODE_MOTOROLA.)
- uint32 sclkMode (Determines the sclk relationship for Motorola submode.)
- uint32 oversample (Oversampling factor for the SPI clock.)
- uint32 enableMedianFilter
- uint32 enableLateSampling
- uint32 enableWake (Ignored for master mode.)
- uint32 rxDataBits (Number of data bits for RX direction. Ignored in our case.)
- uint32 txDataBits (Number of data bits for TX direction.)
- uint32 bitOrder (Determines the bit ordering.)
- uint32 transferSeperation (Whether transfers are back to back or SS state.)
- uint32 rxBufferSize (Size of the RX buffer.)
- uint8* rxBuffer (Buffer space provided for a RX software buffer.)
- uint32 txBufferSize (Size of the TX buffer.)
- uint8* txBuffer (Buffer space provided for a TX software buffer.)
- uint32 enableInterrupt
- uint32 rxInterruptMask (Mask of interrupt sources to enable in the RX direction.)
- uint32 rxTriggerLevel (FIFO level for an RX trigger interrupt.)
- uint32 txInterruptMask (Mask of interrupt sources to enable in the TX direction.)
- uint32 txTriggerLevel (FIFO level for a TX trigger interrupt.)

We set the oversampling value to 2 and the HFCLK=ClockSPI to 48Mhz with an accuracy of 2%, this means that we can transfert data with a bit-rate of:

Data rate = Fscbclk / Oversampling = 20 Mbps

Even the Fscbclk accuracy is important for correct data transfer operation of SPI and the actual Fscbclk it's the same one of HFCLK with a DivSCBCLK = 1 (be careful if you decide to change this value).

Another big hand it's given from the configuration of SPI Motorola Data Tranfer inside the Component and by interrupts related to the same component. With this powerful addons we can be sure of complete data tranfer and the next port available for following data/command.

Follows a series of graphical implementations to draw pixel, lines, circles, rectangles and much more.
We think we can improve this section in future release; with for example the printing of characters (much more useful).

A suggestion. Take a look to your USB cable if you don't want problems.

After all the time spent on this board, we have found that the printed USB plug, even if in serial communication, it can give you lots wrong uploads if the connection with PC USB port (or extension cable port) isn't perfect.

The method of programming used in this board, it doesn't allows you to make a verify of your uploaded code, this even for the lack of a JTAG programmer. I spent much more time than I thought for this stupid reason, that appears stupid only right now, but that has generated every kind possible problem.

We leave you to our demo video to evaluate code potentials, see you soon... at next release.

GIT code reference.

No comments:

Post a Comment

Hi at all, leave me a feedback for this post. Thx