Problem with Display NHD-3.5-320240MF-ATXL#-T-1
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 :
/*********************************************************************
* 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
/*********************************************************************
* 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);
}
-
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.0 -
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 help0 -
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.0 -
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:/*********************************************************************
* 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égory0
Please sign in to leave a comment.
Comments
4 comments