UM-B-047
DA1468x Getting Started with the Development Kit
User Manual
Version 7.0
23-Jul-2018
CFR0012
27 of 36
© 2018 Dialog Semiconductor
8
Your First DA1468x Application
– Blinky
8.1
Introduction
The following sections explain how the user can build, program and run a simple software application
called
Blinky
on the ProDK development board using the
SmartSnippetsTM
DA1468x SDK.
This application is based on a pre-defined project template called
freertos_retarget_template
which is
located at
<sdk_root_directory>\projects\dk_apps\templates.
After modification the
application will toggle an on-board LED with a pre-defined frequency.
The application is first described, then step by step instructions are given to build and run it.
8.2
Software Architecture
The
freertos_retarget_template
project is set to run in release mode from DA1468x internal RAM
by default. This is the easiest setup and does not need any flash programming prior to executing the
binary.
When the application starts running the first thing that is executed is the
Reset_Handler
, which is
located in
startup > startup_ARMCM0.s.
This is followed by setting IRQ priorities and initializing
variables.
Next, code execution continues with the main subroutine in file
main.c
. Here, trim values are applied
to the DA1468x device. When the clock has been set up properly, the main routine creates task
SysInit
and starts the RTOS scheduler. Now the RTOS scheduler is running it will start its first task
which is
SysInit
.
In the
SysInit
task the power and clock management module is started. Next, the hardware
peripherals which are used by this particular project are initialized. This includes setting up the
correct GPIOs, enabling clocks and setting initial values to the hardware peripherals in use. Last
thing done before
SysInit
task exits is to create another task which is the main application task
running until the program gets stopped. The function code implementing the main task is as follows:
static void prvTemplateTask( void *pvParameters )
{
OS_TICK_TIME xNextWakeTime;
static uint32_t test_counter=0;
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = OS_GET_TICK_COUNT();
for( ;; ) {
/* Place this task in the blocked state until it is time to run again.
The block time is specified in ticks, the constant used converts ticks
to ms. While in the Blocked state this task will not consume any CPU
time. */
vTaskDelayUntil( &xNextWakeTime, mainCOUNTER_FREQUENCY_MS );
test_+;
if (test_counter % (1000 / OS_TICKS_2_MS(mainCOUNTER_FREQUENCY_MS)) == 0)
{
printf("#");
fflush(stdout);
}
}
}
Code 1: The main task in SysInit() the prvTemplateTask()
The software as provided in the
SmartSnippetsTM
DA1468x SDK
– once up and running - interacts
with a host PC and sends the character ‘#’ via the serial UART interface every 1sec. This can be