Jump to content

STM32F4 Discovery to XPT2046 (ADS7843)


ivan47

Recommended Posts

This is link to my Keil 5 project. All user modified files (defines.h, gfxconf.h, gmouse_lld_ADS7843_board.h etc.) are located in

\01-STM32F4xx_Keil_CMSIS_uGFX\User.

I'm using STM32F4 Discovery board (it uses 8 MHz external crystal), ILI9341 display controller with SPI interface, XPT2046 touch screen controller (also uses SPI).

I'm using Tilens libraries to send data over SPI and for initialize (makes life easier).

Pin descriptions are in defines.h :

#define ILI9341_CS_CLK                RCC_AHB1Periph_GPIOC
#define ILI9341_CS_PORT GPIOC
#define ILI9341_CS_PIN GPIO_Pin_2
/* WRX or DC pin */
#define ILI9341_WRX_CLK RCC_AHB1Periph_GPIOD
#define ILI9341_WRX_PORT GPIOD
#define ILI9341_WRX_PIN GPIO_Pin_7
/* RST pin */
#define ILI9341_RST_CLK RCC_AHB1Periph_GPIOD
#define ILI9341_RST_PORT GPIOD
#define ILI9341_RST_PIN GPIO_Pin_6

#define TM_SPI3_PRESCALER SPI_BaudRatePrescaler_2

/////////////////////

#define XPT2046_CS_PORT GPIOB
#define XPT2046_CS_PIN GPIO_Pin_12

#define XPT2046_PENIRQ_PORT GPIOB
#define XPT2046_PENIRQ_PIN GPIO_Pin_11

#define XPT2046_SPI SPI2
#define XPT2046_SPI_PINS TM_SPI_PinsPack_2

#define TM_SPI4_PRESCALER SPI_BaudRatePrescaler_128

Link to comment
Share on other sites

  • 2 weeks later...

I have not had time yet unfortunately. Work has been extremely busy.

There has however been something else that has come up that may be an issue...

Try using GOS_RAW32_HEAP_SIZE to invoke the use of the raw32 memory allocator. Some third party (including ones like the arduino versions) cannot handle being called with a non - native stack base and thereby cause the application to crash in unexpected places.

If that doesn't work please let me know and I will make a bigger effort to allocate that time I promised.

Link to comment
Share on other sites

  • 3 weeks later...

This is my gfxconf.h file:

#ifndef _GFXCONF_H
#define _GFXCONF_H

/* The operating system to use. One of these must be defined - preferably in your Makefile */
//#define GFX_USE_OS_CHIBIOS TRUE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
//#define GFX_USE_OS_OSX FALSE
#define GFX_USE_OS_RAW32 TRUE
#define GOS_RAW_HEAP_SIZE 512
// #define INTERRUPTS_OFF() optional_code
// #define INTERRUPTS_ON() optional_code


/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE //
#define GFX_USE_GINPUT TRUE //
#define GFX_USE_GEVENT TRUE

#define GFX_USE_GTIMER TRUE
#define GFX_USE_GQUEUE TRUE //

/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_CIRCLE TRUE
#define GDISP_NEED_ELLIPSE TRUE
#define GDISP_NEED_ARC TRUE
#define GDISP_NEED_CONVEX_POLYGON TRUE
#define GDISP_NEED_TEXT TRUE
//u slucaju koristenja nekog fonta treba ga promijeniti u TRUE
#define GDISP_NEED_ANTIALIAS FALSE
#define GDISP_NEED_UTF8 FALSE
#define GDISP_NEED_TEXT_KERNING FALSE
#define GDISP_INCLUDE_FONT_UI1 FALSE
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS20 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE
#define GDISP_INCLUDE_FONT_FIXED_10X20 TRUE
#define GDISP_INCLUDE_FONT_FIXED_7X14 TRUE
#define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
#define GDISP_INCLUDE_USER_FONTS FALSE
#define GDISP_NEED_CONTROL TRUE //
#define GDISP_NEED_MULTITHREAD TRUE//
#define GDISP_USE_DMA FALSE

/* GDISP fonts to include */
#define GDISP_INCLUDE_FONT_UI2 TRUE


/* Features for the GWIN subsystem. */
#define GWIN_NEED_WINDOWMANAGER FALSE
#define GWIN_NEED_WIDGET TRUE //
#define GWIN_NEED_BUTTON TRUE //
#define GWIN_NEED_FRAME FALSE

/* Features for the GINPUT subsystem. */
#define GINPUT_NEED_MOUSE TRUE
//#define GINPUT_NEED_TOGGLE TRUE
#endif /* _GFXCONF_H */

Link to comment
Share on other sites

  • 1 month later...

Sorry for it to take so long but I finally got some time to work on some strange crash issues.

I found a problem with the raw32 scheduler that affects some of the more recent gcc versions. If you can please load the latest master and see if this fixes your crashing issues.

This forum entry will provide more information on what was found.

http://forum.ugfx.org/viewtopic.php?f=9&t=244

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...