Hi,
Im converting a MQX 3.6 to MQX3.7 project, and I'm found that "tchres:" device no longer exists in the list of installed drivers.
I use the same options in user_config.h that is #define BSPCFG_ENABLE_TCHSRES 1
I've found a difference in the init_bsp.c file between 3.6 and 3.7
the lines
#if BSPCFG_ENABLE_TCHSRES _mcf52xx_tchres_install("tchscr:", &_bsp_tchscr_resisitve_init);#endif
no longer exists in init_bsp.c file from MQX 3.7
how do I enable the Resistive Touch-screen Driver in MQX 3.7
Regards
Solved! Go to Solution.
Hi,
I found out why the touch screen driver doesn't work under MQX 3.7. The MQX3.7 contains the completely new touch screen driver that change little bit phylosophy of using driver and (it start using standard MQX ADC driver) and the ADC driver and Touch screen driver must be installed by user like this:
const ADC_INIT_STRUCT adc_init = {
ADC_RESOLUTION_12BIT,// ADC_RESOLUTION_DEFAULT, /* resolution */
};
extern TCHRES_INIT_STRUCT _bsp_tchscr_resisitve_init;
d4d_task()
{
MQX_FILE_PTR adc_file;
adc_file = fopen(BSP_TCHRES_ADC_DEVICE, (const char*)&adc_init);
if( adc_file == NULL )
{
_mqx_exit(0);
}
ioctl( adc_file, ADC_IOCTL_CALIBRATE, NULL );
_io_tchres_install("tchscr:", &_bsp_tchscr_resisitve_init, adc_file );
.......
}
Check the Kinetis K40 demo, there is good main.c file, in other MQX3.7 demos was used old version of file, sorry for this.
Gargy
In bsp.h u can find sth like that:
#if 0 /* to be used in next MQX version */#include <tchres.h> /* resistive touch screen driver */#endif
The question is when the next MQX version will be ... ?
Hi,
Which version of MQX are you using?
in MQX 3.7 that condicional if has desappeared.
I will return to the previous version until the problem is fixed in MQX 3.7
Hello,
Have a look to eGUI 2.1
You will find IAR and CW10.1 examples for MQX 3.6 and 3.7 for some platforms. To use touch in MQX, in d4d_user_cfg.h:
// List of supported low level touch screen drivers
// d4dtch_resistive - driver for resistive touch screen with direct analog connection to MCU
// d4dtch_resistive_mqx - driver for resistive touch screen with direct analog connection to MCU over MQX (version 3.6 or higher)
// d4dtch_mcf52277_asp - driver for resistive touch screen over MCF52277 ASP peripheral
// Please define a used touch screen driver if touch screen is used in project
#define D4D_LLD_TCH d4dtch_resistive_mqx
And have a look to d4dtch_resistive.c
#include "mqx.h"
#include <fio.h>
#include "tchres.h"
#include "d4dtch_resistive_mqx.h"
/******************************************************************************
* Macros
******************************************************************************/
/**************************************************************//*!
*
* Local functions
*
******************************************************************/
static unsigned char D4DTCH_Init_Tchres_Mqx(void);
static unsigned char D4DTCH_DeInit_Tchres_Mqx(void);
static D4D_TOUCHSCREEN_LIMITS* D4DTCH_GetRawLimits_Tchres_Mqx(void);
static unsigned char D4DTCH_GetPositionRaw_Tchres_Mqx (unsigned short *TouchPositionX,
unsigned short *TouchPositionY);
.....
Best Regards,
Hi Luis
Im using eGui 2.1,
in in d4d_user_cfg.h: I have
#define D4D_LLD_TCH d4dtch_resistive_mqx
When debugging my program, I found that this function "static unsigned char D4DTCH_Init_Tchres_Mqx(void);"
returns 0 when attemping to fopen "tchres:" device.
I see in that point that the device "tchres:" is not in the list of installed IO_DEVICES.
regards
Hello Marcos,
Just tested with external MQX 3.7 and eGUI 2.1.
It works for me, I have tested it with IAR and using flexbus :
#define D4D_LLD_LCD_HW d4dlcdhw_mqx_fb
What compiler are you using? Have you configured the switches properly in TWR-LCD? Have you program an 'empty' sprogram in 51JM60 (TWR-LCD)?
Best Regards,
Hello Luis, thanks for your reply
I am developing using a "Tower System"
Hello,
I supposed you were using Kinetis.. I have tested in Kinetis K60. In any case, you mention eGUI 2.07. MQX 3.7 support is included only in eGUI 2.1. Is it a typo?
Best Regards,
yesterday I download eGUI 2.1 from here
in the page mentions 2.1, the 2.07 comes from the following code and is what i see in the demo project.
***************************************************************************//*!** @file d4d_base.h** @author r50233* * @version 0.0.85.0* * @date Apr-11-2011* * @brief D4D Driver core and base functions header file********************************************************************************/#ifndef __D4D_BASE_H#define __D4D_BASE_H/******************************************************************************* Includes******************************************************************************//******************************************************************************* Constants******************************************************************************/#define D4D_VERSION "v2.07" // to check release history - read the release_notes.txt file
Hi
the 2.07 version in sw == 2.1 marketing sign.
This is small bug in latest release.
Sorry guys
Hi,
I am using CW10.10, eGUI 2.1, TWR_LCD on the tower with 52259. I had all this working on the old MQX and old eGUI various, so the hardware should be right.
I have made the following changes to d4d_user_cfg.h
// Low level touch screen driver
#define D4D_LLD_TCH d4dtch_resistive_mqx
//#define D4D_LLD_TCH_HW not_used_in_mqx
In main.cabove lcd_task (its not called d4d_task)
//CN17062011 Start
const ADC_INIT_STRUCT adc_init = {
ADC_RESOLUTION_12BIT,// ADC_RESOLUTION_DEFAULT, /* resolution */
};
extern TCHRES_INIT_STRUCT _bsp_tchscr_resistive_init;
//CN17062011 End
I added the following to lcd_task (first thing it does)
//CN17062011 Start
adc_file = fopen(BSP_TCHRES_ADC_DEVICE, (const char*)&adc_init);
if( adc_file == NULL )
{
_mqx_exit(0);
}
// ioctl( adc_file, ADC_IOCTL_CALIBRATE, NULL ); //THIS COMMAND DOES NOT WORK AS ITS NOT SUPPORTED IN 52259
_io_tchres_install("tchscr:", &_bsp_tchscr_resisitve_init, adc_file );
////CN17062011 End
You will notice that ACD_IOCTL_CALIBRATE is not supported in 52259, do we need to do something else here?
So, when I run the project, the calibration just flash's each cross hair and moves on to the next as if it is being touched, but they all have the same value. If I measure the ADC pins, they sit at 0V, then jump up for a 'blip' as the software takes a measurement (I guess). If I hold my finger on the screen, the values come up and change (but the same for each cross hair as it still just always flicks between them all)... I don't know what to do now... I can 'force' it to calibrate by quickly trying to catch each cross hair as it flash's up, but the touch screen doesnt work once it loads.
It appears that for some reason my 52259 project cannot see the following in d4d.h, the path has been added, yet they are still not seen for some reason. Note, the K40 project can see them, just not the 52259...
#include "d4d_user_cfg.h"
#include "d4d_picture.h"
#include "d4d_button.h"
#include "d4d_check_box.h"
#include "d4d_gauge.h"
#include "d4d_slider.h"
#include "d4d_label.h"
#include "d4d_icon.h"
#include "d4d_menu.h"
#include "d4d_graph.h"
#include "d4d_scroll_bar.h"
#include "d4d_console.h"
#include "d4d_text_box.h"
#include "d4d_progress_bar.h"
I checked the linked resources, and the MQX_ROOT_DIR is wrong, it has a suffix of EAR or something on the end, the rest are the same as the K40 project (which works), but this doesn't fix the problem.
I notice in the Codewarrior Projects view, the K40 project has the folder for the D4D lib's as purple, where as its brown in the 52259 project.
I also notice there are many differences in the project settings for paths and resources... So many things missing from the 52259. I think there is a problem with the way the project has been setup as the K40 example all works find, just not the 52259.
Hi,
Am I the only one having troubles getting the supplied example to compilie (TWR52259 + D4D + CW10.1)?
It appears that the project is simply setup wrong. All the supplied MQX example work, they load, just not the D4D 52259 TWR.
Hi,
It turns out its just the IDE that cannot see the include files, CW10.1 is telling me they are unresolved includes, but they are there, making it very confusing to look at the code as it thinks half the code is not there as it cannot see the define's! I dont know how to fix the IDE so it can see the paths like the compiler can, I am sure its hidden in some project setting...
I am having a problem with the touch screen, on two computers now and two samples of the hardware it does exactly the same thing, it jumps from calbration point to calibration point infinitely quite quickly. It does pick up your touching it, and the output when measured with my DSO jumps up on each measurement then drops back to 0V (which I dont think is normal).
I think,
this issue was solved in another one thread:
https://community.freescale.com/message/90308#90308
Gargy
Hi,
So I am trying to get the K40 demo project from eGUI 2.1 to work. I have MQX 3.7 installed, as well as the latest updates for CodeWarrior 10.1. I can not get the program to compile. I am not sure if that code that you listed up above will work for the K40 or not. The specific Error I get is for this line of code,
_io_tchres_install("tchscr:", &_bsp_tchscr_resisitve_init, adc_file );
the error is:
illegal implicit conversion from 'struct mqx_file *' to
I have not changed the code in anyway. I am also using the bsp file for the K40X256 under the mqx/build/cw10. If all I have to do is put that code from above in, where exactly do I need to insert that code?
Hi,
sorry but I don't have installed at the moment CW10.
But try to explicit retype the parameters in the function like this:
_io_tchres_install("tchscr:", (TCHRES_INIT_STRUCT_PTR)&_bsp_tchscr_resisitve_init, (MQX_FILE_PTR)adc_file );
I hope that this help
Gargy
HI, the code that you are using looks fine. So this point to any "issue" with new touch screen driver under MQX. Thee is two possible solution:
1. if you don't usin'g the ADC driver for anything else, just use the bare metal version of driver for MCF52259.
2. Report the issue to the MQX team and wait :smileyhappy:
Have a nice day
Gargy
Hi,
I found out why the touch screen driver doesn't work under MQX 3.7. The MQX3.7 contains the completely new touch screen driver that change little bit phylosophy of using driver and (it start using standard MQX ADC driver) and the ADC driver and Touch screen driver must be installed by user like this:
const ADC_INIT_STRUCT adc_init = {
ADC_RESOLUTION_12BIT,// ADC_RESOLUTION_DEFAULT, /* resolution */
};
extern TCHRES_INIT_STRUCT _bsp_tchscr_resisitve_init;
d4d_task()
{
MQX_FILE_PTR adc_file;
adc_file = fopen(BSP_TCHRES_ADC_DEVICE, (const char*)&adc_init);
if( adc_file == NULL )
{
_mqx_exit(0);
}
ioctl( adc_file, ADC_IOCTL_CALIBRATE, NULL );
_io_tchres_install("tchscr:", &_bsp_tchscr_resisitve_init, adc_file );
.......
}
Check the Kinetis K40 demo, there is good main.c file, in other MQX3.7 demos was used old version of file, sorry for this.
Gargy
Thanks Gargy, your solutions works.
I have the touch screen working in MQX3.7 using MCF52259.
I have to comment, the line
ioctl( adc_file, ADC_IOCTL_CALIBRATE, NULL );
In MQXIOUG rev9 i found this:
8.6.1 Hardware-Specific IOCTL Commands
Hardware-specific commands are used to handle specific MCU behavior and hardware performance.These commands are not portable to other processor.The following table summarizes MCF51EM, MCF51MM and Kinetis family processor specific IOCTLcommands.
ADC_IOCTL_CALIBRATE: Starts calibration process on a device. Commandfails if any channel on a deviceis opened.
Thanks again.
I've got a problem with code above, i'm using tower system with pcf51Cn.