Friday, November 24th 2017, 8:59pm UTC+1

You are not logged in.

  • Login
  • Register

ertana

Beginner

Date of registration: Aug 12th 2014

Posts: 2

1

Tuesday, August 12th 2014, 9:34am

_SetText() cause hardfault.

Hello,
I am using STemwin but there is nobody in st forum to solve my problem.


I can init LCD; i can write anything on the screen using GUI_DispString(). I can create button (or checkbox, or some widgets) on anywhere on the screen, but when i try to write anything on the widget (for example BUTTON_SetText(), or for example CHECKBOX_SetText() ), after GUI_Exec() a hard fault occured. I download a lot of example, and i did what they did but the result didnt changed.
What do you thing about the reason?
NOTE:
- LCD driver is RA8875
- MCU is STM32F427VI (256KByte RAM, 2MByte Flash)
- FMC is using for communication.
- External memory device is not using.There is a code which wrote for testing.- Allocated 192KByte ram for emWin.

- LCD size is normall 800*480 but i tried to make this 150*150.

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void _DemoButton(void) {
  BUTTON_Handle hButton;
 
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Click on button...", 160, 90);
  //
  // Create the button and set text
  //
  hButton = BUTTON_CreateEx(110, 110, 100, 40, 0, WM_CF_SHOW,0,1); 
  BUTTON_SetText(hButton, "Click me..."); //When i remove this line, everything is ok, but when i wrote this line after GUI_Exec() hard fault occured.
}
void EMain(void){
    GUI_Init();
    GUI_SetBkColor(GUI_RED);
    GUI_Clear();
    GUI_SetFont(&GUI_Font8x16);
    _DemoButton();
    GUI_Exec();
    while(1){
    }
}

This post has been edited 4 times, last edit by "ertana" (Aug 12th 2014, 9:52am)


ertana

Beginner

Date of registration: Aug 12th 2014

Posts: 2

2

Wednesday, August 13th 2014, 8:35am

Hello, i find the reason. RA8875 works different from standard version driver chips. Normally if RS is 0, this means the data is command, if RS is 1, this means the data is data. But RA8875 works reverse of this. So normally emwin uses pfWriteM16_A1 but for RA8875 pfWriteM16_A0 should be used.