Author Topic: Problem with Display NHD-3.5-320240MF-ATXL#-T-1  (Read 1494 times)

Gregory_C

  • Newbie
  • *
  • Posts: 3
  • Karma: -1
    • View Profile
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);
}



Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 10
    • View Profile
Re: Problem with Display NHD-3.5-320240MF-ATXL#-T-1
« Reply #1 on: July 08, 2016, 02:48:07 PM »
This sounds like something must have happened to either the code or the processor.

Were there any changes between now and the last time the display worked.

Gregory_C

  • Newbie
  • *
  • Posts: 3
  • Karma: -1
    • View Profile
Re: Problem with Display NHD-3.5-320240MF-ATXL#-T-1
« Reply #2 on: July 12, 2016, 06:33:44 AM »
Hello Saurabh_B

Nothing has changed. I could download the code into the microcontroller and everything seems to be , so I know that communication with the prototype works .


There are some in law or the compiler gives me an error on the edge (see photo) : Unable to resolve identifier

By cons , it is able to compile without error. Why that ?

Thank you for your help

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 10
    • View Profile
Re: Problem with Display NHD-3.5-320240MF-ATXL#-T-1
« Reply #3 on: July 12, 2016, 03:47:49 PM »
Gregory,

The error you are getting seems to be either because you are declaring static variables inside of the function or the variables you are declaring might have been declared elsewhere in your code.
Would it be possible to remove the static modifier, or check to see if the same variables are declared globally elsewhere?


I tried to reply to the message you left on our site earlier, however the email address you provided did not work.

Gregory_C

  • Newbie
  • *
  • Posts: 3
  • Karma: -1
    • View Profile
Re: Problem with Display NHD-3.5-320240MF-ATXL#-T-1
« Reply #4 on: July 13, 2016, 07:49:14 AM »
Hello

I removed the static variable declaration of functions, but the same error occurs. I also checked if the variables were declared in global, but no.

The same error occurs for the functions of variable declaration (see picture)

These errors occur in the library provides for NHD-3.5-320240MF-ATXL#-T-1 , no modification has been done on this code .


I am able to communicate with the PIC32 because I am able to program and make moficiations . For example, the start image can be changed even if the touch screen is not working .

Did I say that the PIC32 working properly?

In debug mode, I never stopped me was the following function:

Code: [Select]
/*********************************************************************
* Function: SHORT TouchGetX()
*
* PreCondition: none
*
* Input: none
*
* Output: x coordinate
*
* Side Effects: none
*
* Overview: returns x coordinate if touch screen is pressed
*           and -1 if not
*
* Note: none
*
********************************************************************/
SHORT TouchGetX(void)
{
    long    result;

    result = TouchGetRawX();

    if(result >= 0)
    {
        result = CalcTouchX(result);

        #ifdef TOUCHSCREEN_RESISTIVE_FLIP_X
            result = GetMaxX() - result;
        #endif
   
        if(result < 0) return(0);
   
        if(result > GetMaxX()) return(GetMaxX());   
    }

    return (result);
}

* Function: SHORT TouchGetY()
*
* PreCondition: none
*
* Input: none
*
* Output: y coordinate
*
* Side Effects: none
*
* Overview: returns y coordinate if touch screen is pressed
*           and -1 if not
*
* Note: none
*
********************************************************************/
SHORT TouchGetY(void)
{
    long    result;

    result = TouchGetRawY();

    if(result >= 0)
    {
        result = CalcTouchY(result);

        #ifdef TOUCHSCREEN_RESISTIVE_FLIP_Y
            result = GetMaxY() - result;
        #endif

        if(result < 0) return(0);

        if(result > GetMaxY()) return(GetMaxY());
    }
   
    return (result);
}

I already change the screen

Thank you

Grégory

 

Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 5
Views: 4583
Last post Today at 10:40:50 AM
by tolikkk
NHD‐C12864A1Z‐FSW‐FBW‐HTT display clears after draw

Started by EdAverillBoard Graphic LCDs

Replies: 7
Views: 5723
Last post Today at 02:14:24 AM
by tolikkk
Arduino LCD library not working with newhaven display NHD‐0420H1Z‐FL‐GWB-3V3

Started by c2hollowBoard Character LCDs

Replies: 12
Views: 8857
Last post Today at 06:49:33 AM
by tolikkk
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines

Started by stylonurusBoard OLEDs

Replies: 5
Views: 5597
Last post June 18, 2014, 10:09:49 AM
by Michael_L
NHD-C0220BiZ Sometimes Ignoring "Clear Display" Command

Started by dstoverBoard Character LCDs

Replies: 2
Views: 3763
Last post March 27, 2014, 05:41:27 PM
by Michael_L