Jump to content

ugfx example for stm32f429 discovery board


artem_dmitriev

Recommended Posts

Hello,

There is a ready-to-run demo for the STM32F429i-Discovery board using either ChibiOS/RT 2.x or ChibiOS/RT 3.x. Those examples can be found in the /boards directory. However, they use the Make build system and are not Keil examples.

Sadly Keil cannot import projects using external Makefiles. To use the examples in Keil you'd have to create a new project yourself from scratch and add all the necessary files to the project file tree. We strongly recommend using an IDE that can handle projects using external Makefiles.

However, many users are using uGFX with KEIL without any problems at all. So if you want to go through the trouble it will definitely work out.

~ Tectu

Link to comment
Share on other sites

You can use uGFX with or without ChibiOS/RT. If you don't want to use an OS you can use the RAW32 port for uGFX. But our examples for the STM32F429i-Discovery board only work with ChibiOS/RT. Therefore you have to download ChibiOS/RT.

We recommend getting the ChibiOS/RT demo for the STM32F429i-Discovery board working (blinking LED) before you add uGFX. This way you can be sure that your setup is working properly.

~ Tectu

Link to comment
Share on other sites

Hi,

I have some early experience with Keil µVision, ChibiOS/RT and µGFX.

I've put a ready-to-compile sample online, with everything you need inside. It works fine on µVision v5.13

It's based on ChibiOS/RT 2.6.7 & a very recent copy of the Master branch of µGFX.

Please share your mind-blowing stuff you make with it afterwards :)

http://www.otte.be/stm32/20150320_STM3232F429I-DISCO_ChibiOS_uGFX_Sample.rar

Link to comment
Share on other sites

  • 1 month later...

Hello There!

First of all, I would like to thank you all for this great effort in making this awesome GUI available for public!

Well, I'm trying to get familiar with ChibiOS/RT and uGFX in parallel, however, I would like to try uGFX on my STM32F429-Discovery Board to display few simple primitives (arcs, circles, lines, text) before going any further with the advanced features, OS-based implementation, and other modules. Basically, I would like to know what are the basic requirements needed to get the GDISP Module to work alone (without any other modules, and without an OS), structure of src and inc files required for a simple build using AC6 (System Workbench for STM32) and gnu-arm-none-eabi compiler.

I did not try to import the example using make, as I don't like this approach. I'd rather feel more comfortable when adding srcs and incs manually to my project!

Thank you for your help!

Link to comment
Share on other sites

Hello zaher and welcome to the community!

It's no problem at all to use uGFX without the make build system. However, as every IDE is different we didn't write any useful step-by-step guide. What you basically have to do is go through the src directory file by file and add what you need as you described yourself. This article might help a bit but don't expect too much.

It is furthermore possible to use uGFX without any underlying OS at all as well. We provide a port that is called RAW32. This port can be used to run uGFX on any system. All you have to do is to implement two function regarding delays. These are basically just a matter of dividing and multiplying your systick and there are some examples available so the implementation should be pretty straight forward.

To directly answer your question: What you need is the GDISP module, the GOS module (the RAW32 port) and the required GDISP driver.

Personally I'd like to suggest to follow this guide in order to set up a working project for your STM32F429i-Discovery. Once your project is working adding uGFX will be very easy as the required display and touch drivers are already part of the official repository.

Upgrading to an underlying OS such as ChibiOS/RT afterwards will be pretty easy as well.

If you have any questions please do not hesitate to ask. We like to help where we can.

~ Tectu

Link to comment
Share on other sites

Hello Tectu,

Thank you very much for the prompt reply, and please excuse me for not getting back sooner as I have been away for a little bit. Your support is awesome, and I really appreciate such an initiative! :)

Well, with the information provided, I will try to follow each and every step you come across in your reply, including the recommended guide/article. Anyways, could you please tell me where I can find the RAW32 Port? I could not find it in the uGFX main archive.

Again, if someone could provide a working example for Eclipse-Based IDE, AC6 in particular, I would be grateful for your help!

Thank you again!

Zaher

Link to comment
Share on other sites

Anyways, could you please tell me where I can find the RAW32 Port? I could not find it in the uGFX main archive.

The RAW32 port is is located under /src/gos/gos_raw32.*. Link for lazyness: https://bitbucket.org/Tectu/ugfx/src/88 ... ?at=master

I was wondering if uGFX incorporates a widget for table views. For example, if I want to display CSV file data in cells (columns and rows).

I'm sorry to disappoint you but there's currently no such widget. Implementing your own custom widgets is however feasible assuming that you know your C. There are already many examples and we're happy to help should you face any problems.

~ Tectu

Link to comment
Share on other sites

  • 3 months later...

Hi,

I'm using chibios 3.0.1, and the blincking led demo program for STM32F429-discovery works fine at first try.

Now I'm trying to insert uGFX, so I've downloaded the latest version and put it inside chibios root dir:

so I have /home/user/chibios/ugfx (with ugfx at the same level of the other main dir of chibios)

I've modified the makefile following the instruction from uGFX website for chibios integration


##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#

# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif

# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif

# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif

# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif

# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif

# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = yes
endif

# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif

# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif

# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif

#
# Build global options
##############################################################################


##############################################################################
# Architecture or project specific options
#

# Stack size to be allocated to the Cortex-M process stack. This stack is
# the stack used by the main() thread.
ifeq ($(USE_PROCESS_STACKSIZE),)
USE_PROCESS_STACKSIZE = 0x400
endif

# Stack size to the allocated to the Cortex-M main/exceptions stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
USE_EXCEPTIONS_STACKSIZE = 0x400
endif

# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif

#
# Architecture or project specific options
##############################################################################

##############################################################################
# Project, sources and paths
#

# Define project name here
PROJECT = ch

# Imported source files and paths
CHIBIOS = ../../..
CHIBIOS_VERSION = 3

CHIBIOS_CPUCLASS = ARMCMx
CHIBIOS_PORT = v7m

#uGFX path
GFXLIB = $(CHIBIOS)/ugfx
GFXBOARD = STM32F429i-Discovery
#GFXDEMO = modules/gdisp/basics
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
OPT_OS = chibios
OPT_THUMB = yes
OPT_LINK_OPTIMIZE = yes
OPT_CPU = stm32m4


# ChibiOS settings
ifeq ($(OPT_OS),chibios)
# See $(GFXLIB)/tools/gmake_scripts/os_chibios.mk for the list of variables
CHIBIOS_BOARD = ST_STM32F429I_DISCOVERY
CHIBIOS_PLATFORM = STM32F4xx
CHIBIOS_PORT = GCC/ARMCMx/STM32F4xx
CHIBIOS_LDSCRIPT = STM32F429xI.ld
endif



# Startup files.
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_STM32F429I_DISCOVERY/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk

include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk

# Other files (optional). se compilo test mi crasha il compilatore quando compila!!!!
#include $(CHIBIOS)/test/rt/test.mk

# per usare framework grafico
include $(GFXLIB)/gfx.mk
#include $(GFXLIB)/boards/base/STM32F429i-Discovery/board.mk # board
#include $(GFXLIB)/drivers/gdisp/STM32F429iDiscovery/driver.mk # additional driver
#include $(GFXLIB)/drivers/gdisp/ILI9341/driver.mk

# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F429xI.ld

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(STARTUPSRC) \
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
$(GFXSRC) \
usbcfg.c main.c


# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC =

# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =

# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =

# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =

# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =

# List ASM source files here
ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)

INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \
$(GFXINC) #\ #$(GFXINC)/$(GFXINC)/boards/base/STM32F429i-Discovery \
#include

#
# Project, sources and paths
##############################################################################

##############################################################################
# Compiler settings
#

MCU = cortex-m4

#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary

# ARM-specific options here
AOPT =

# THUMB-specific options here
TOPT = -mthumb -DTHUMB

# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
#CWARN =
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#CPPWARN =
#
# Compiler settings
##############################################################################
#CFLAGS +=-DGFX_USE_OS_CHIBIOS=TRUE -DCORTEX_USE_FPU=FALSE
#CPPFLAGS += -DGFX_USE_OS_CHIBIOS=TRUE -DCORTEX_USE_FPU=FALSE
#CXXFLAGS += -DGFX_USE_OS_CHIBIOS=TRUE -DCORTEX_USE_FPU=FALSE
##############################################################################
# Start of user section
#

# List all user C define here, like -D_DEBUG=1
UDEFS =

# Define ASM defines here
UADEFS =

# List all user directories here
UINCDIR =

# List the user directory to look for the libraries here
ULIBDIR =

# List all user libraries here
ULIBS =

#
# End of user defines
##############################################################################

RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
# *** EOF ***

And copied gfxconf.h inside the folder where I have the makefile and the main.c (inside demos/STM32/RT-STM32F429-DISCOVERY) where I have the following defines


#define GFX_USE_OS_CHIBIOS TRUE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
//#define GFX_USE_OS_OSX FALSE

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

/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE

#define GDISP_TOTAL_DISPLAYS 1
#define GDISP_NEED_STARTUP_LOGO FALSE
#define GDISP_STARTUP_LOGO_TIMEOUT 0

and add the instruction I found in the example of uGFX ugfx/demos/modules/gdisp/basics


coord_t width, height;
coord_t i, j;

// Initialize and clear the display
gfxInit();

//start thread for blinking 2 leds
/*
* Activates the USB driver and then the USB bus pull-up on D+.
* Note, a delay is inserted in order to not have to disconnect the cable
* after a reset.
*/
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1000);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);

/*
* Creating the blinker threads.
*/
chThdCreateStatic(waThread1, sizeof(waThread1),
NORMALPRIO + 10, Thread1, NULL);
chThdCreateStatic(waThread2, sizeof(waThread2),
NORMALPRIO + 10, Thread2, NULL);

// Get the screen size
width = gdispGetWidth();
height = gdispGetHeight();

// Code Here
gdispDrawBox(10, 10, width/2, height/2, Yellow);
gdispFillArea(width/2, height/2, width/2-10, height/2-10, Blue);
gdispDrawLine(5, 30, width-50, height-40, Red);

for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
gdispDrawPixel(i, j, White);

while(TRUE) {
gfxSleepMilliseconds(500);
}

The make would complete without errors, but when I flash it the led stop blinking so I assume the system is stuck on the gfxInit();

Any ideas where I made it wrong? (I have enabled the SPI bus with SPI5 inside the chibios config file, just in case anyone have a doubt about it)

Thanks to all.

Link to comment
Share on other sites

Hello Enrico and welcome to the community!

I gave your code a quick look but I couldn't spot something that is obviously wrong. The only thing I can say is that you don't have to include the uGFX board file AND the actual drivers in your Makefile. Including the board file is enough as this file will automatically include the corresponding driver files for you.

First thing you want to do when something is not working is disabling compiler optimization (-O0 instead of -O2) and disabling LTO (USE_LTO = no). LTO is a very well known issue causer.

Next, try commenting out the USB stuff and everything else. Take the bare blinker code with nothing else in it and just add gfxInit().

If that does not help, can you please upload your complete project as a ZIP archive so we can have a look?

~ Tectu

Link to comment
Share on other sites

Good morning.

After the suggestion made by Tectu (switch to -O0, disable link optimization, disable usb and so on..), I was able to have my lcd show something! Then I tried to figure out restoring the initial condition one by one to see what was the source of the problem. Strangely now I am able to have everything working, what I noticed is that sometimes using st-link to flash the program, even if the message was successful, the program is not really loaded into the board (I had to launch st-link two times in a row to have it working) so I suppose this is the main source of my problem yesterday..

I have another question, I looked inside the gfx.mk and it seems to load automatically other mk if I have defined some variable, like


ifneq ($(GFXBOARD),)
include $(GFXLIB)/boards/base/$(GFXBOARD)/board.mk
endif
ifneq ($(GFXDRIVERS),)
include $(patsubst %,$(GFXLIB)/drivers/%/driver.mk,$(GFXDRIVERS))
endif
ifneq ($(GFXDEMO),)
include $(GFXLIB)/demos/$(GFXDEMO)/demo.mk
endif

But Tectu wrote about it is not necessary to

you don't have to include the uGFX board file AND the actual drivers in your Makefile

So just in case of the supported board I have to leave only


GFXBOARD = STM32F429i-Discovery

inside my Makefile?

What is the purpose of


ifneq ($(GFXDRIVERS),)
include $(patsubst %,$(GFXLIB)/drivers/%/driver.mk,$(GFXDRIVERS))
endif

Is it possible to use graphics capability of uGSX by only having the display drivers, or it needs always also the board?

besides I'd like to point out that from

http://wiki.ugfx.org/index.php?title=ChibiOS/RT

the example of makefile (I know it is only an example, so I have copied only the enlightened part) there are those rows


include $(GFXLIB)/gfx.mk

include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/board.mk # board

include $(GFXLIB)/drivers/gaudio/vs1053/driver.mk # additional driver

but from Tectu it seems not to be right? I must include only


include $(GFXLIB)/gfx.mk

include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/board.mk # board

or if I define in the makefile


GFXBOARD = STM32F429i-Discovery

then I only have to include


include $(GFXLIB)/gfx.mk

Thanks a lot for the support!

in the following days I'm looking forward to work with uGFX and hope it will lighten the burden to deal with the graphics, facilitating my job!

Link to comment
Share on other sites

So just in case of the supported board I have to leave only


GFXBOARD = STM32F429i-Discovery

inside my Makefile?

That is correct. You can use GFXBOARD and GFXDRIVERS for easy inclusing of board files and drivers in your Makefile so you don't have to specify the path yourself.

What is the purpose of


ifneq ($(GFXDRIVERS),)
include $(patsubst %,$(GFXLIB)/drivers/%/driver.mk,$(GFXDRIVERS))
endif

GFXDRIVERS can take a list of parameters, not just one value. Eg. you might want to do GFXDRIVERS = SSD2119, STMPE811 to include both a display and a touchscreen driver. The line you are referring to creates one valid Makefile inclusion statement for each driver entry in the list.

Is it possible to use graphics capability of uGFX by only having the display drivers, or it needs always also the board?

You can just include a display driver, no need to use board files. Board files are really just a Makefile which will automatically include the necessary driver files to use all the features of the board. When you take a look at some of the board files you will find out that it really doesn't do much beside manually including the display and the corresponding touchscreen driver for that board. eg:


GFXINC += $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB
GFXSRC +=
GFXDEFS += -DGFX_USE_CHIBIOS=TRUE

include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/chibios_board/board.mk
include $(GFXLIB)/drivers/gdisp/SSD2119/driver.mk
include $(GFXLIB)/drivers/ginput/touch/STMPE811/driver.mk

Board files are just for the convenience for the user. No need to use them or create them. Just include the driver(s) manually in your Makefile and you will be fine.

besides I'd like to point out that from: http://wiki.ugfx.org/index.php?title=ChibiOS/RT

the example of makefile (I know it is only an example, so I have copied only the enlightened part) there are those rows


include $(GFXLIB)/gfx.mk

include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/board.mk # board

include $(GFXLIB)/drivers/gaudio/vs1053/driver.mk # additional driver

but from Tectu it seems not to be right? I must include only


include $(GFXLIB)/gfx.mk

include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/board.mk # board

or if I define in the makefile


GFXBOARD = STM32F429i-Discovery

then I only have to include


include $(GFXLIB)/gfx.mk

The board file included in the Makefile from that article will include the display and the touchscreen driver for that board. The board itself does not have an audio codec chip and therefore the board file does not include a corresponding driver but a user might add an audio codec add-on himself. Then he has to include the appropriate driver in the Makefile. The example shows how to include the board file and an additional driver (for the VS1053 in this case). Hence the commend "additional driver" (as it is not part of the board file).

I hope that answers your questions.

~ Tectu

Link to comment
Share on other sites

  • 1 month later...

I have succeeded to put chibios with ugfx (half a day)

1) download chibios 3.01 and switch to demos/RT-STM32F429-DISCOVERY example folder, do make and check if the compilation complete

2) download and copy ugfx folder

3) you have to modify a little few .mk files, since the path iside them is missing a folder sometimes

4) in the makefile of chibios, you have to add


CHIBIOS_CPUCLASS = ARMCMx
CHIBIOS_PORT = v7m

#uGFX path
GFXLIB = $(CHIBIOS)/ugfx

GFXBOARD = STM32F429i-Discovery

# General settings
OPT_OS = chibios
OPT_THUMB = yes
OPT_LINK_OPTIMIZE = yes
OPT_CPU = stm32m4

# ChibiOS settings
ifeq ($(OPT_OS),chibios)
# See $(GFXLIB)/tools/gmake_scripts/os_chibios.mk for the list of variables
CHIBIOS_BOARD = ST_STM32F429I_DISCOVERY
CHIBIOS_PLATFORM = STM32F4xx
CHIBIOS_PORT = GCC/ARMCMx/STM32F4xx
CHIBIOS_LDSCRIPT = STM32F429xI.ld
endif

include $(GFXLIB)/gfx.mk


CSRC = $(STARTUPSRC) \
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
--> $(GFXSRC) \
$(SNSR_SRC) \
main.c


INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \
---> $(GFXINC)

be aware to remove the test.h from the main.c and remove all related code that belong to test (since with me I got error when it is enabled)

then you can try some example from ugfx

be aware that gfxInit(); will call the initialization of chibios so, you have to avoid call them twice, removing

halInit(); chSysInit(); from main.c

Link to comment
Share on other sites

Beside chibios if I want to use ugfx with bare metal, with stm32f429-discovery, after the implementation of the 3 functions for delay. Is it possible to use the simple example from ugfx demo? like clear the screen and draw some text?

Because I haven't succeeded to port some st function into chibios and I have to give up using it :(

I had to modify some files of ugfx in order to compile the project without error (some definition was missing,like SDRAM_BANK_ADDR and I had to include manually a file from /board that are only included if I use chibios to find the symbols)

Link to comment
Share on other sites

Thank you for sharing your experience!

be aware that gfxInit(); will call the initialization of chibios so, you have to avoid call them twice, removing

halInit(); chSysInit(); from main.c

Note that there is a macro called GFX_OS_NO_INIT in the configuration file. If you set that to TRUE then gfxInit() will not automatically call the chSysInit() and halInit() functions.

Furthermore, note that we provide a high-level makefile for using uGFX with ChibiOS. That file is a lot shorter than the ChibiOS Makefile and keeps things clear and tidy. You can find those in the various /boards/base/xxx/example_* directories. The STM32F429i-Discovery board file comes with an example for both ChibiOS/RT 2.x and ChibiOS/RT 3.x.

Beside chibios if I want to use ugfx with bare metal, with stm32f429-discovery, after the implementation of the 3 functions for delay. Is it possible to use the simple example from ugfx demo? like clear the screen and draw some text?

Because I haven't succeeded to port some st function into chibios and I have to give up using it :(

Why three functions? There should only be two functions you have to implement yourself: gfxSystemTicks() and gfxMillisecondsToTicks().

Generally speaking uGFX should run out of the box on a bare-metal system when you select the RAW32 operating system in the configuration file and implement the two functions mentioned above. uGFX is widely used on bare-metal systems without any known issues.

However, please note: We implemented a new scheduler a few months ago. Please use the latest master branch and not the latest stable release. The new scheduler allows you to either select the generic setjmp()/longjmp() scheduler or the specific Cortex-Mx scheduler. You can find more information about this here: http://wiki.ugfx.org/index.php?title=GOS

~ Tectu

Link to comment
Share on other sites

Yes, only 2 functions like the ones written at

http://wiki.ugfx.org/index.php?title=BareBone

but when I try this code (it works fine with the chibios )


gfxInit();

// Get the screen size
int width = gdispGetWidth();
int height = gdispGetHeight();
int i,j;
// Code Here
gdispDrawBox(10, 10, width/2, height/2, Yellow);
gdispFillArea(width/2, height/2, width/2-10, height/2-10, Blue);
gdispDrawLine(5, 30, width-50, height-40, Red);

for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
gdispDrawPixel(i, j, White);

I got the correct width and height but the screen remain blank.

In the makefile I put

GFXDRIVERS = STM32F429iDiscovery

and

include $(GFXLIB)/gfx.mk.

The gfxconf.h is (barely the same I used with chibios plus #define GFX_NO_OS_INIT TRUE since with bare metal I already done the init before call ugfx)


/* The operating system to use. One of these must be defined - preferably in your Makefile */
#define GFX_USE_OS_RAW32 TRUE
#define GFX_NO_OS_INIT TRUE

/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_ANTIALIAS TRUE
#define GDISP_NEED_PIXELREAD TRUE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE

#define GDISP_TOTAL_DISPLAYS 1
#define GDISP_NEED_STARTUP_LOGO FALSE
#define GDISP_STARTUP_LOGO_TIMEOUT 0

/* GDISP - fonts to include */
#define GDISP_INCLUDE_USER_FONTS TRUE
#define GDISP_INCLUDE_FONT_UI1 FALSE
#define GDISP_INCLUDE_FONT_UI2 FALSE
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE
#define GDISP_INCLUDE_FONT_FIXED_10x20 FALSE
#define GDISP_INCLUDE_FONT_FIXED_7x14 FALSE
#define GDISP_INCLUDE_FONT_FIXED_5x8 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE

Any suggestion? (I modify a little the contents inside drivers/gdisp/STM32F429iDiscovery to be able compiling my project, there were some definitions missing)

Link to comment
Share on other sites

inside board_STM32F429iDiscovery.h

I see that

static inline void init_board(GDisplay *g) {

// As we are not using multiple displays we set g->board to NULL as we don't use it.
g->board = 0;

switch(g->controllerdisplay) {
case 0: // Set up for Display 0
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7)); // UART_TX
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7)); // UART_RX
palSetPadMode(GPIOF, GPIOF_LCD_DCX, PAL_MODE_ALTERNATE(5));
palSetPadMode(GPIOF, GPIOF_LCD_DE, PAL_MODE_ALTERNATE(14));

#define STM32_SAISRC_NOCLOCK (0 << 23) /**< No clock. */
#define STM32_SAISRC_PLL (1 << 23) /**< SAI_CKIN is PLL. */
#define STM32_SAIR_DIV2 (0 << 16) /**< R divided by 2. */
#define STM32_SAIR_DIV4 (1 << 16) /**< R divided by 4. */
#define STM32_SAIR_DIV8 (2 << 16) /**< R divided by 8. */
#define STM32_SAIR_DIV16 (3 << 16) /**< R divided by 16. */

#define STM32_PLLSAIN_VALUE 192
#define STM32_PLLSAIQ_VALUE 7
#define STM32_PLLSAIR_VALUE 4
#define STM32_PLLSAIR_POST STM32_SAIR_DIV4

/* PLLSAI activation.*/
RCC->PLLSAICFGR = (STM32_PLLSAIN_VALUE << 6) | (STM32_PLLSAIR_VALUE << 28) | (STM32_PLLSAIQ_VALUE << 24);
RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | STM32_PLLSAIR_POST;
RCC->CR |= RCC_CR_PLLSAION;

// Initialise the SDRAM
SDRAM_Init();

// Clear the SDRAM
memset((void *)SDRAM_BANK_ADDR, 0, 0x400000);

spiStart(SPI_PORT, &spi_cfg);
break;
}
}

What will happen if I use the UART1 as my debug serial port? do I have a conflict? so I have to choose another uart (not that I have too much since all pins are already occupied with other functions...)

Link to comment
Share on other sites

Sorry for the late reply. We are currently very busy and sadly we have to handle support request of the paying customers with a higher priority so usually we moderate this forum during our spare time (when we get to it).

I never used the STM32F429i-Discovery board bare metal myself but I gave the schematics a quick look. PA9 and PA10 are definitely not used for the display/touchscreen and I am not sure why those definitions are in the board file. They should not have any effect and you should be able to just remove them without any issues.

Anyway, you cannot use the ChibiOS/RT board files when you are not using ChibiOS/RT. You have to implement your own board files. For this, copy the \drivers\gdisp\STM32F429iDiscovery\board_STM32F429iDiscovery_template.h file to your project directory (remove the _template part of it) and implement the corresponding functions.

The board files that we provide are for use with ChibiOS/RT only. When using your own library/HAL you have to make sure that all peripherals and pins are configured correctly.

~ Tectu

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