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;           
  
};
Revision:
3:fb4d62b5ffb3
Parent:
2:d0acbd263ec7
Child:
5:781a72d380a1
--- a/modifs.h	Thu Jan 03 10:54:09 2013 +0000
+++ b/modifs.h	Thu Jan 03 16:16:24 2013 +0000
@@ -1,35 +1,18 @@
 /*
-Date   : 31.12.12
-Author : Erik Olieman
----------------------
-Code readability and speed
-1. created separate structure for mini-DK (base for library)
-2. Removed wr_dat_only routine (uses 8 bit transfer = slow)
-   Replaced each wr_dat_only with
-     _spi.format(16,3);
-     .....
-     _spi.write(...);
-     .....
-     _spi.format(8,3);
-3. Creation of Mini-DK.h with all declarations specific to the mini-DK board.
-
+Date    : 31.12.12
+Authors : Erik Olieman/Frank Vannieuwkerke
+-----------------------------------------
+      Code readability and speed
+        1. created separate structure for mini-DK (base for library)
+        2. Removed wr_dat_only routine (uses 8 bit transfer = slow) in SPI_TFT
+           Replaced each wr_dat_only with
+             _spi.format(16,3);
+             .....
+             _spi.write(...);
+             .....
+             _spi.format(8,3);
+        3. Creation of Mini-DK.h with all declarations specific to the mini-DK board.
 
-Date   : 31.12.12
-Author : Frank Vannieuwkerke
-----------------------------
-      NOTE : Current code contains SPI_TFT *LCD; in Touch.h
-             TouchPanel_Calibrate, TP_DrawPoint and DrawCross in Touch.cpp use LCD->...
-             These are currently commented out since using them locks up the system although
-             the compiler does not show any errors. Current code works but the calibration
-             crosshairs do not show - touching their approximate position still allows you to
-             calibrate and draw (TP.TP_DrawPoint in main.cpp temporarily replaced with TFT.rect).
-             
-             ??Other solution : see TODOs below??
-                Possible advantage of this solution :
-                    Touch library fully independent of LCD library.
-                    Perhaps do Calibration with a printed template when LCD is not used (less accurate).
-                    This would only be useful when a touchpanel without LCD is used.
-             
 
       Removed reset pin from SPI_TFT (not needed - pin is connected to main reset).
 
@@ -37,14 +20,10 @@
       
       In main.cpp
       ----------- 
-      TODO: before TP.TouchPanel_Calibrate()
-                cls
-                draw 3 crosses with numbers according to DisplaySample in touch.cpp
-                Use following text : Calibration - Touch each crosshair in the numbered sequence.
-            after TP.TouchPanel_Calibrate()
-                cls
 
-      Moved following global touch var declarations (at top of main.cpp) to touch.cpp/.h
+      TouchScreenADS7843 initialisation: pointer to SPI_TFT needed for calibration, drawcross and drawpoint routines.
+      
+      Moved following global touch var declarations from main.cpp back to touch.cpp/.h
         Matrix      matrix;
         Coordinate  display;
         Coordinate  screen;
@@ -56,27 +35,26 @@
 
       In Touch.cpp/.h
       ---------------
-      Removed TP_Init - moved TP_init code to constructor.
+      TouchScreenADS7843 constructor: added pointer to SPI_TFT - needed for calibration, drawcross and drawpoint routines.
+                                      If LCD calls are not needed, initialise TouchScreenADS7843 with NULL pointer for LCD.
 
-      TODO : Avoid using TFT_LCD library : remove all references to LCD driving
-                                           remove Drawpoint and Drawcross
-                                           remove #include Arial12x12
+      Removed TP_Init - moved TP_init code to constructor.
 
       Variables in call to TouchPanel_Calibrate, Read_Ads7846, getDisplayPoint are no longer needed.
       Modified these routines accordingly in touch.cpp/.h (pointers no longer needed)
       *** TouchPanel_Calibrate and getDisplayPoint already modified.
 
-      TODO: Problem with Read_Ads7846 -> is also called in TouchPanel_Calibrate (Touch.cpp) with other var. 
-            Solution : in TouchPanel_Calibrate, change screen_cal to screen_tmp and copy (TP.)screen to this
-                       variable. Put screen_tmp back to (TP.)screen after setCalibrationMatrix.
-
+      Read_Ads7846: is also called in TouchPanel_Calibrate (Touch.cpp) with other var.
+                    Modified Read_Ads7846 to allow call with/without (parameter).
+                    If called without  (parameter) - screen variable is used, otherwise (parameter) is used.
+                    in Touch.h - unsigned char Read_Ads7846(Coordinate * screenPtr); replaced with
+                                 unsigned char Read_Ads7846(Coordinate * screenPtr = NULL);
+                    in Touch.cpp - if (screenPtr == NULL) screenPtr = &screen; added.
 
 
 General notes
 -------------
-lpc1768 SPI port - problem with using SD and TFT simultaneously
+lpc1768 SPI port - problem when using SD and TFT simultaneously - solution provided by Erik Olieman
 see note http://mbed.org/comments/cr/83/2654/#c4768
-google search : lpc1768 ssp ssp0 ssp1
-perhaps use softspi (eg http://arduino.cc/forum/index.php?topic=117356.0)
-Ignore above notes - use Erik Olieman's solution. 
+Even faster SPI write : http://mbed.org/users/Sissors/code/BurstSPI/docs/600eecd89a78/BurstSPI_8cpp_source.html
 */
\ No newline at end of file