jcc147 Posted February 21, 2018 Report Posted February 21, 2018 Hello, I'm trying to make uGFX run on bare metal HY-miniSTM32 board(STM32F103VC) + SSD1289 + ADS7843 with Std Peripheral Library. The SSD1289 driver for 320x240 display has been revised to use Std Peripheral Library, and it works fine. Now, I'm working on touchscreen. The ADS7843 driver has been updated to use Std Peripheral Library as well. However, after GINPUT_NEED_MOUSE set TRUE, the screen size returned by function call gdispGetWidth() and gdispGetHeight becomes 3849x2048. It seems touchscreen drivers reset the screen size and it doesn't use the screen size set by SSD1289 driver. Who can please kindly help me on this issue? Thanks, Josh
jcc147 Posted February 21, 2018 Author Report Posted February 21, 2018 After tracing down the code, I found the Width and Height in the GDISP->g has been changed by the function call in _gmouseInitDriver() void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, delaytime_t millisec) { gfxMutexEnter(&mutex); // Start our thread if not already going if (!hThread) { hThread = gfxThreadCreate(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE, GTIMER_THREAD_PRIORITY, GTimerThreadHandler, 0); if (hThread) {gfxThreadClose(hThread);} // We never really need the handle again } Especially after gfxThreadCreate. Somehow, the GDISP->g.Width got changed to the value of GTIMER_THREAD_WORKAREA_SIZE which is 2048.
inmarket Posted February 22, 2018 Report Posted February 22, 2018 This sounds like you are over-running your stack and therefore modifying unrelated data structures. Please check your stack sizes carefully.
jcc147 Posted February 24, 2018 Author Report Posted February 24, 2018 I used 2048 for the heap size. #define GFX_OS_HEAP_SIZE 2048
inmarket Posted February 24, 2018 Report Posted February 24, 2018 Don't forget the main thread stack size (which is normally part of your board linker script or part of your operating system initialisation).
Joel Bodenmann Posted February 25, 2018 Report Posted February 25, 2018 This is definitely most likely an issue with stack overflows. This piece of code is extremely well tested as almost everybody uses it. Along with what @inmarket said, keep in mind that 2k stack is not a lot for when you're doing graphics. That's surely enough to draw a few rectangles and so on but you'll quickly run out of memory when you start rendering fonts & images and when starting to dick around with the window manager. Usually you'd start way higher and then minimize the stack size until you have something that works in all conditions.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now