Library for Mini-DK board

Dependencies:   SPI_TFT_ILI9320

Dependents:   LPC1768_Mini-DK_EasyWeb_DM9161 LPC1768_Mini-DK LPC1768_Mini-DK

Fork of Mini-DK by Frank Vannieuwkerke

Mini-DK board overview (Micro SD connector is at the bottom side)

One serial interface , uses CP2102 (USB to RS232 interface, support ISP download )

RJ45-10/100M Ethernet network interface (Ethernet PHY: DM9161)

2.8 inch TFT color LCD interface (SPI interface or 16Bit parallel interface)

Touch panel controller XPT2046 (ADS7843 compatible)

USB 2.0 interface, USB host and USB Device interface.

TF SD / MMC card (SPI) interface.

Two user buttons, One Reset button and ISP button , One INT0 button, two user-programmable LED lights

Serial ISP download, Standard 20-pin JTAG download simulation debugging interface.

Selection between external 5V power supply or USB 5V supply.

Board size: 95mm * 78mm

All IO available on extension connectors

/media/uploads/frankvnk/mini-dk_top.jpg

04/01/13

Erik Olieman (http://mbed.org/users/Sissors/) joined the code development for the Mini-DK board.

Thanks to his input, we were able to obtain a tremendous speed gain, remove warnings, ...

An overview of all modifications is stored in modifs.h

The old page (http://mbed.org/users/frankvnk/code/LPC1768_Mini-DK/) contains the demo code.

IMPORTANT : Due to a change in the mbed libraries (Stream()), we cannot use the printf instruction - we need to use <SPI_TFT>.printf (example - see main.cpp in http://mbed.org/users/frankvnk/code/LPC1768_Mini-DK/)

WARNING: filetoflash (SD to CPU flash)

The SPI_TFT library contains an option to copy an image from the SD card to the CPU flash memory. This allows you to use an image as background without speed loss when writing other text and graphics.

By default, this option is enabled.

It can be disabled by uncommenting the #define mentioned below in Mini_DK.h:

#define NO_FLASH_BUFFER

Since the flash memory has limited write endurance, DO NOT use this feature when you intend to read multiple images from the SD card (eg: when used as a photo frame).

14/01/13

A newer version of the Mini-DK has been released by the manufacturer: Mini-DK2. They replaced the DM9161 PHY with a LAN8720A PHY and better buttons are fitted on the board. All other hardware remains the same. Code for this PHY is available from the NXP MCU SW application team. This allows us to use the mbed 'EthernetInterface' library with little modifications. Further info - see http://mbed.org/forum/mbed/topic/3684/?page=1#comment-18473.

Notes:

The code in 'lpc_phy_lan8720.c' uses 'msDelay' - needs to be replaced with 'osDelay'.

A custom MAC address can be defined using following code:

extern "C" void mbed_mac_address(char * mac) {
 
// define your own MAC Address
  mac[0] = 0x00;  
  mac[1] = 0x01;  
  mac[2] = 0x02;  
  mac[3] = 0x03;  
  mac[4] = 0x04;  
  mac[5] = 0x05;           
  
};
Committer:
frankvnk
Date:
Tue Nov 04 21:43:48 2014 +0000
Revision:
23:67989b4f61ad
Parent:
17:66c4e84d8571
Updated SPI_TFT_ILI9320 library to the latest version (auto-detect ILI9320, 9325 and 9328)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frankvnk 2:d0acbd263ec7 1 /*
frankvnk 3:fb4d62b5ffb3 2 Authors : Erik Olieman/Frank Vannieuwkerke
frankvnk 17:66c4e84d8571 3 ------------------------------------------
frankvnk 17:66c4e84d8571 4
frankvnk 17:66c4e84d8571 5 11/12/2012 Initial code (ported from Peter Drescher's code - http://mbed.org/cookbook/SPI-driven-QVGA-TFT
frankvnk 17:66c4e84d8571 6 Replaced DMA code with SPI code - modified several functions to fit ILI9320.
frankvnk 17:66c4e84d8571 7
frankvnk 17:66c4e84d8571 8 12/12/2012 (SPI_TFT) Replaced circle and fillcircle with draw_ellipse and fill_ellipse
frankvnk 17:66c4e84d8571 9 Modified rect and fillrect: use width and height parameters instead of x1,y1
frankvnk 17:66c4e84d8571 10
frankvnk 17:66c4e84d8571 11 31/12/2012 lpc1768 SPI port: problem when using SD and TFT simultaneously - solution provided by Erik Olieman
frankvnk 17:66c4e84d8571 12 see note http://mbed.org/comments/cr/83/2654/#c4768
frankvnk 2:d0acbd263ec7 13
frankvnk 17:66c4e84d8571 14 Code readability and speed
frankvnk 17:66c4e84d8571 15 1. created separate structure for mini-DK (base for library)
frankvnk 17:66c4e84d8571 16 2. Removed wr_dat_only routine (uses 8 bit transfer = slow) in SPI_TFT
frankvnk 17:66c4e84d8571 17 Replaced each wr_dat_only with
frankvnk 17:66c4e84d8571 18 _spi.format(16,3);
frankvnk 17:66c4e84d8571 19 .....
frankvnk 17:66c4e84d8571 20 _spi.write(...);
frankvnk 17:66c4e84d8571 21 .....
frankvnk 17:66c4e84d8571 22 _spi.format(8,3);
frankvnk 17:66c4e84d8571 23 3. Creation of Mini-DK.h with all declarations specific to the mini-DK board.
frankvnk 2:d0acbd263ec7 24
frankvnk 17:66c4e84d8571 25 Removed reset pin from SPI_TFT (not needed - pin is connected to main reset).
frankvnk 2:d0acbd263ec7 26
frankvnk 17:66c4e84d8571 27 Separated SPI_TFT from TouchADS7843
frankvnk 3:fb4d62b5ffb3 28
frankvnk 17:66c4e84d8571 29 In main.cpp
frankvnk 17:66c4e84d8571 30 -----------
frankvnk 17:66c4e84d8571 31 TouchScreenADS7843 initialisation: pointer to SPI_TFT needed for calibration, drawcross and drawpoint routines.
frankvnk 17:66c4e84d8571 32
frankvnk 17:66c4e84d8571 33 Moved following global touch var declarations from main.cpp back to touch.cpp/.h
frankvnk 17:66c4e84d8571 34 Matrix matrix;
frankvnk 17:66c4e84d8571 35 Coordinate display;
frankvnk 17:66c4e84d8571 36 Coordinate screen;
frankvnk 17:66c4e84d8571 37 NOTE : i did not create a class with var readback, just used plain C notation.
frankvnk 17:66c4e84d8571 38 These vars can be accessed from other code through <classname>.<varname>
frankvnk 17:66c4e84d8571 39 example : TP.display.x
frankvnk 17:66c4e84d8571 40 Only drawback : Each element of these vars needs to be initialised separately.
frankvnk 17:66c4e84d8571 41 (initialisation of these vars is not possible with array notation).
frankvnk 2:d0acbd263ec7 42
frankvnk 17:66c4e84d8571 43 In Touch.cpp/.h
frankvnk 17:66c4e84d8571 44 ---------------
frankvnk 17:66c4e84d8571 45 TouchScreenADS7843 constructor: added pointer to SPI_TFT - needed for calibration, drawcross and drawpoint routines.
frankvnk 17:66c4e84d8571 46 If LCD calls are not needed, initialise TouchScreenADS7843 with NULL pointer for LCD.
frankvnk 2:d0acbd263ec7 47
frankvnk 17:66c4e84d8571 48 Removed TP_Init - moved TP_init code to constructor.
frankvnk 2:d0acbd263ec7 49
frankvnk 17:66c4e84d8571 50 Variables in call to TouchPanel_Calibrate, Read_Ads7846, getDisplayPoint are no longer needed.
frankvnk 17:66c4e84d8571 51 Modified these routines accordingly in touch.cpp/.h (pointers no longer needed)
frankvnk 2:d0acbd263ec7 52
frankvnk 17:66c4e84d8571 53 Read_Ads7846: is also called in TouchPanel_Calibrate (Touch.cpp) with other var.
frankvnk 17:66c4e84d8571 54 Modified Read_Ads7846 to allow call with/without (parameter).
frankvnk 17:66c4e84d8571 55 When called without (parameter) - screen variable is used, otherwise (parameter) is used.
frankvnk 17:66c4e84d8571 56 in Touch.h - unsigned char Read_Ads7846(Coordinate * screenPtr); replaced with
frankvnk 17:66c4e84d8571 57 unsigned char Read_Ads7846(Coordinate * screenPtr = NULL);
frankvnk 17:66c4e84d8571 58 in Touch.cpp - if (screenPtr == NULL) screenPtr = &screen; added.
frankvnk 17:66c4e84d8571 59
Sissors 5:781a72d380a1 60
Sissors 5:781a72d380a1 61
Sissors 5:781a72d380a1 62
frankvnk 17:66c4e84d8571 63 In SPI_TFT
frankvnk 17:66c4e84d8571 64 ----------
frankvnk 17:66c4e84d8571 65 Changed the SPI object to a BurstSPI object
frankvnk 17:66c4e84d8571 66 All cases where large numbers of bytes are written (filled rect, cls, etc) have been replaced by fastWrite functions for higher speed
frankvnk 17:66c4e84d8571 67 mbed library updated to this century
frankvnk 17:66c4e84d8571 68 Colorwheel stepsize reduced to 1 in main.cpp
Sissors 6:b547fb6c1095 69
frankvnk 17:66c4e84d8571 70 Known issues: claim function for stdout does not work
frankvnk 17:66c4e84d8571 71 Removed stream name from TextDisplay (not used in current mbed version)
frankvnk 2:d0acbd263ec7 72
frankvnk 2:d0acbd263ec7 73
frankvnk 17:66c4e84d8571 74 03/01/2013 General cleaning:
frankvnk 17:66c4e84d8571 75 SPI_TFT::window function changed to use ints instead of unsigned ints, and made virtual to remove warnings.
frankvnk 17:66c4e84d8571 76 In SPI_TFT.cpp GraphicsDiplay initialization moved to front to remove warnings
frankvnk 17:66c4e84d8571 77 In Touch.cpp TFT pointer initialization moved to front to remove warnings
frankvnk 17:66c4e84d8571 78 In Mini_DK.h Added SD card pins
frankvnk 17:66c4e84d8571 79 Added two macros to enable/disable the LCD MISO pin, allowing use of both SD card and LCD
frankvnk 17:66c4e84d8571 80 Usage (in your main function):
frankvnk 17:66c4e84d8571 81 ENABLE_LCD_MISO when you want to read from LCD
frankvnk 17:66c4e84d8571 82 DISABLE_LCD_MISO when you want to read from SD
frankvnk 17:66c4e84d8571 83 Faster SPI write: BurstSPI libary added.
frankvnk 17:66c4e84d8571 84 _spi.write replaced with _spi.fastWrite
frankvnk 17:66c4e84d8571 85 (http://mbed.org/users/Sissors/code/BurstSPI/docs/600eecd89a78/BurstSPI_8cpp_source.html)
frankvnk 17:66c4e84d8571 86 Code cleanup & comments added.
frankvnk 17:66c4e84d8571 87 Separate Mini_DK library created.
frankvnk 17:66c4e84d8571 88
frankvnk 17:66c4e84d8571 89 04/01/2013 Added ability to use bitmaps from any filesystem.
frankvnk 17:66c4e84d8571 90 Added conversion to be able to use 24 bit bitmaps.
frankvnk 17:66c4e84d8571 91 NOTE : Don't forget to load the official mbed SDFileSystem library!!
frankvnk 17:66c4e84d8571 92
frankvnk 17:66c4e84d8571 93 06/01/2013 Bug fix in Bitmap function: orientation.
frankvnk 17:66c4e84d8571 94 Added IAP (In-Application programming): internal Flash memory access library.
frankvnk 17:66c4e84d8571 95 Added option to use a background image: #define USE_FLASH_BUFFER introduced in SPI_TFT.h
frankvnk 17:66c4e84d8571 96 When omitted, the bitmap is NOT copied to flash memory.
frankvnk 17:66c4e84d8571 97 Bitmap function: comments about return codes updated.
frankvnk 17:66c4e84d8571 98 Background image remains static when orientation is changed.
frankvnk 17:66c4e84d8571 99 Constructor modified in SPI_TFT: backgroundOrientation = 0;
frankvnk 17:66c4e84d8571 100 changed to
frankvnk 17:66c4e84d8571 101 #ifdef USE_FLASH_BUFFER
frankvnk 17:66c4e84d8571 102 backgroundOrientation = 0;
frankvnk 17:66c4e84d8571 103 #endif
frankvnk 17:66c4e84d8571 104
frankvnk 17:66c4e84d8571 105 08/01/2013 Stream & claim issues resolved: mbed library has been updated by the mbed team to allow
frankvnk 17:66c4e84d8571 106 stream name => claim function can be used again.
frankvnk 17:66c4e84d8571 107 Changed 'TextDisplay::TextDisplay(const char *name) : Stream()' back to
frankvnk 17:66c4e84d8571 108 TextDisplay::TextDisplay(const char *name) : Stream(name) in TextDisplay.cpp
frankvnk 17:66c4e84d8571 109 #define USE_FLASH_BUFFER (SPI_TFT.h) replaced with #define NO_FLASH_BUFFER (Mini_DK.h). When copy to flash
frankvnk 17:66c4e84d8571 110 is not needed, enable this option.
frankvnk 17:66c4e84d8571 111
frankvnk 17:66c4e84d8571 112 09/01/2013 Code cleanup: modifs.h streamlined.
frankvnk 17:66c4e84d8571 113 SPI_TFT.cpp and SPI_TFT.h comments.
frankvnk 17:66c4e84d8571 114 Touch.cpp commnets.
frankvnk 17:66c4e84d8571 115
frankvnk 2:d0acbd263ec7 116 */