Jump to content

No MousePolling on STM32 using RAW32/BareMetal


juliandonart

Recommended Posts

Hello,


i'm new to this forum and community to uGFX, so first of all many thanks for this great library!


I just could get running a ILI9341-Display using SPI. Now i would like to get my Touch-IC running.
I use a STM32F051 Microcontroller and Coocox CoIDE with ARM-GCC 4.8 and i take the Baremetal/RAW32 implementation of uGFX.

I could be sure that i properly implemented the gfxSystemTicks() and gfxMillisecondsToTicks() functions and configured correctly the gfxconf.h Header for using RAW32.
My Problem is that the Mouse-Get-Function which should be fired periodically by a Mouse-Timer (Polling) gets never called.
It just gets fired once at the start when inizializing.
I could watch the same Problem on a STM32F407.

To get sure that the problem is not my own fault in implementation, i just do this:

#include "gfx.h"

#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE)

#define GMOUSE_DRIVER_VMT		GMOUSEVMT_ADS7843
//#include "../../../../src/ginput/ginput_driver_mouse.h"
#include "src/ginput/ginput_driver_mouse.h"
// Get the hardware interface
#include "gmouse_lld_ADS7843_board_template.h"

static bool_t init_board(GMouse* m, unsigned driverinstance) {

    //Gets Called at start
	return TRUE;
}
static bool_t MouseXYZ(GMouse* m, GMouseReading* pdr)
{
	(void)m;

    // THIS function only gets called at the start, and will never be polled
	return TRUE;
}

const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
	{
		GDRIVER_TYPE_TOUCH,
		GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN,
		sizeof(GMouse)+GMOUSE_ADS7843_BOARD_DATA_SIZE,
		_gmouseInitDriver,
		_gmousePostInitDriver,
		_gmouseDeInitDriver
	},
	1,				// z_max - (currently?) not supported
	0,				// z_min - (currently?) not supported
	1,				// z_touchon
	0,				// z_touchoff
	{				// pen_jitter
		GMOUSE_ADS7843_PEN_CALIBRATE_ERROR,			// calibrate
		GMOUSE_ADS7843_PEN_CLICK_ERROR,				// click
		GMOUSE_ADS7843_PEN_MOVE_ERROR				// move
	},
	{				// finger_jitter
		GMOUSE_ADS7843_FINGER_CALIBRATE_ERROR,		// calibrate
		GMOUSE_ADS7843_FINGER_CLICK_ERROR,			// click
		GMOUSE_ADS7843_FINGER_MOVE_ERROR			// move
	},
	init_board, 	// init
	0,				// deinit
	MouseXYZ,		// get
	0,				// calsave
	0				// calload
}};

#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */

 


Has anyone any idea?


Julian

 

Link to comment
Share on other sites

Hello Julian and welcome to the community!

What touchscreen controller (the chip) are you using? It looks like you are trying to write your own touchscreen driver but most likely your touchscreen controller is already supported and µGFX comes with a built-in driver for that! In that case you would just have to write the board file as you did with the display.
You can find a list of all existing drivers here: http://ugfx.org/platforms.html

To verify that the systick functions that you implemented for RAW32 are working correctly, you can write a small test program like this:

#include "gfx.h"
  
int main(void)
{
  gfxInit();
  
  while (TRUE) {
    ledToggle();
    gfxSleepMilliseconds(500);
  }
}

You can then either use a scope to check whether the 500ms delay is exactly correct or just eye-ball it.
The reason to do this is that when the GINPUT module polls the touchscreen only once it's possible that the delay is just way too long which can be a result of a fault in the systick conversion function implementations.

The next thing you want to do is making sure that the GTIMER thread still runs. Take the program that you already have (the one that only polls the touchscreen once) and add a new GTIMER job yourself. You can just add a function that toggles an LED and tell GTIMER to call that function periodically. If the LED doesn't flash, it means that the GTIMER thread crashed.
You can find example code for GTIMER in either the /demos/moduls/gtimer directory or on the corresponding wiki page: http://wiki.ugfx.org/index.php/GTIMER

Just a side note: there are two (well three) little programs available that help tracking down touchscreen issues. You can find them in /demos/tools.

Link to comment
Share on other sites

Hello Joel,

thank you for the fast answer. I tested successfully a led blinking demo and could verify that the systick runs exactly on 1ms. 

I found the issue that was here:

while(1) {
	// Get an event
	pe = geventEventWait(&gl, 0); // Must be TIME_INFINITE

	switch(pe->type) {
	}
}

This Code was auto generated from uGFX Studio. I had to replace 0 with TIME_INFINITE, now everything works fine. The Mouse-Get Function gets called periodically.

I use a FT6206 IC for capacitive touch panels. It also has an interrupt pin, that i could configure as EXTI-Interrupt on my STM32. In this case i could renounce the use of a mouse-timer. 

Thank you for your help. 

Julian

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...