Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Gregory_C

Pages: [1]
1
TFTs / Problem with Display NHD-3.5-320240MF-ATXL#-T-1
« on: July 07, 2016, 02:47:46 PM »
Hello;
It just put me in charge of a project developed by an engineer with many years of experience. This project consists of several part :
microcontroller - PIC32MX795F512L-80I/PT
Ram memory : IS66WV51216DBLL - 55TLI
SPI : SST25VF016B - 75-4I - S2AF
and a touch screen NHD - 3.5-320240MF - ATXL # -T -1 .

The prototype worked until very recently , but today this is no the case .

I am writing because I need help to solve my problems .

Normally , the screen displays an original image and when a person touches the screen , the image disappears to display another .

Today, the original image appears and when a person touches the screen , nothing happens.

By going to check or debug mode is made in the code execution, it remains stuck in an infinite loop and remains blocked.

The library used :

Code: [Select]
/*********************************************************************
 *                  LCC Graphics Driver (MicrochipGraphicsDMA)
 *********************************************************************
 * FileName:        MicrochipGraphicsDMA.c
 * Company:         Digi-Key Corporation
 *
 * The orginal Microchip Technology, Inc. software is modified to
 * support a Newhaven Display International LCD panel,
 * P/N NHD-3.5-320240MF-ATXL#-T-1 (controllerless panel with
 * resistive touch screen).
 *
 * Date     Comment
 *
 * 10/15/12     Modified for Newhaven LCD     K. Culkins


 #if !defined(GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E)
       address = (DWORD)(((y)*(DISP_HOR_RESOLUTION))+(left));

       #else
       address = (DWORD)(76800-(left*240)+(y));
       #endif
 
       for(x = left; x <= right; x+= 8)
            {
                static DWORD prevaddr;

                    DrawCount++;
                    while(DrawCount>PIXEL_DRAW_PER_DMA_TX){}   //Added in WQVGA Driver to stabilize refresh rate (Line 973)

                    //Suspend DMA
                    DMACONSET = 0x1000;
                    while(PMMODEbits.BUSY ==1);

                    //Save previous address value
                    prevaddr = PMADDR;
...

Additionally, MPLAB X IDE V3.05 informs me of an error : cannot be resolved to a valid program memory address

Here are my questions I ask myself :

Is a Ram memory problem could be the cause of my error message MPLAB ? and the conditions on lines 1013, 1028, 1044, 1060, 1076, 1092, 1108 are never good
What I find strange is that the problem occurs in the code provided by Newhaven LCD .

Is there a solution for testing  if my ram memory is corrupt ?

It is not always easy to explain the problem or provide all relevant information , but I am available to answer your questions and finding a solution to my problem.

Thank you for your help

Sorry , I do not speak English very well

Function problem code, look for never valid and infinite loop
Code: [Select]
/*********************************************************************
* Function: WORD Bar(SHORT left, SHORT top, SHORT right, SHORT bottom)
*
* PreCondition: none
*

* Input: left,top - top left corner coordinates,
*        right,bottom - bottom right corner coordinates
*
* Output: For NON-Blocking configuration:
*         - Returns 0 when device is busy and the shape is not yet completely drawn.
*         - Returns 1 when the shape is completely drawn.
*         For Blocking configuration:
*         - Always return 1.
*
* Side Effects: none
*
* Overview: draws rectangle filled with current color
*
* Note: none
*
********************************************************************/
WORD Bar(SHORT left, SHORT top, SHORT right, SHORT bottom)
{
    SHORT   x, y;
    static DWORD address;
    static WORD  overflowamount=0;
    static int addresschange;

       #if !defined(GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E)
       addresschange = 1;
       #else
       addresschange = -240;
       #endif

   if(_clipRgn)
   {
      if(left < _clipLeft)
      left = _clipLeft;
      if(right > _clipRight)
      right = _clipRight;
      if(top < _clipTop)
      top = _clipTop;
      if(bottom > _clipBottom)
      bottom = _clipBottom;
    }

#ifdef LCC_INTERNAL_MEMORY

for(y = top; y <= bottom; y++)
   for(x = left; x <= right; x++)

// NHD, this fixes ClearDevice(), which uses the Bar function.
   #if defined(GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
   GraphicsFrame[y][x] = _color;
   #else
   GraphicsFrame[(GetMaxX()-x)][y] = _color;
   #endif
#else

    for(y = top; y <= bottom; y++)
      { 

       #if !defined(GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E)
       address = (DWORD)(((y)*(DISP_HOR_RESOLUTION))+(left));

       #else
       address = (DWORD)(76800-(left*240)+(y));
       #endif
 
       for(x = left; x <= right; x+= 8)
            {
                static DWORD prevaddr;

                    DrawCount++;

//
// infinite loop
//
                    while(DrawCount>PIXEL_DRAW_PER_DMA_TX){}   //Added in WQVGA Driver to stabilize refresh rate
                    //
                    // infinite loop
                    //

                    //Suspend DMA
                    DMACONSET = 0x1000;
                    while(PMMODEbits.BUSY ==1);

                    //Save previous address value
                    prevaddr = PMADDR;

                    if(((right-x) <= 8))  //Draw less than 8 at a time if x<8
                    {

                    //Perform Write
                    ADDR15 = address>>15;
                    ADDR16 = address>>16;
                    #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                    ADDR17 = address>>17;
                    ADDR18 = address>>18;
                    #endif

                    PMADDR = address;             
                    PMDIN = _color;   
                    x -= 7;
                    }
                    else    //Draw 8 pixels at a time
                    {
                      //Setup Write 1
                     overflowamount = (address/PMADDR_OVERFLOW);
                     ADDR15 = overflowamount;
                     ADDR16 = overflowamount>>1;
                     #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                     ADDR17 = overflowamount>>2;
                     ADDR18 = overflowamount>>3;
                     #endif
   
                    PMADDR = address;
                    address  +=  addresschange;           
                    PMDIN = _color;   

                   //Setup Write 2
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;
                    address  +=  addresschange;             
                    PMDINSET = 0;            //Draw pixel 2

                    //Setup Write 3
//
//never valid
//
                     if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address; 
                    address  +=  addresschange;           
                    PMDINSET = 0;            //Draw pixel 3

                    //Setup Write 4
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;   
                    address  +=  addresschange;         
                    PMDINSET = 0;            //Draw pixel 4

                    //Setup Write 5
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;
                    address  +=  addresschange;           
                    PMDINSET = 0;            //Draw pixel 5

                    //Setup Write 6
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;
                    address  +=  addresschange;           
                    PMDINSET = 0;            //Draw pixel 6

                    //Setup Write 7
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;
                    address  +=  addresschange;           
                    PMDINSET = 0;            //Draw pixel 7

                    //Setup Write 8
//
//never valid
//
                    if(overflowamount != (address/PMADDR_OVERFLOW))
                    {
                        overflowamount = (address/PMADDR_OVERFLOW);
                        ADDR15 = overflowamount;
                        ADDR16 = overflowamount>>1;
                        #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                        ADDR17 = overflowamount>>2;
                        ADDR18 = overflowamount>>3;
                        #endif
                    }

                    PMADDR = address;           
                    PMDINSET = 0;            //Draw pixel 8
                    }

                    //Clean-up Address Lines
                    ADDR15 = overflowcount;          //count holds the additional address line count
                    ADDR16 = overflowcount>>1;
                    #ifdef GFX_USE_DISPLAY_PANEL_TFT_640480_8_E
                    ADDR17 = overflowcount>>2;
                    ADDR18 = overflowcount>>3;
                    #endif
                    PMADDR = prevaddr;

                    //ReStart DMA
                    DMACONCLR = 0x1000;
                    address  +=  addresschange;
             }

      }
#endif
    return (1);
}



Pages: [1]