Quick start guide
Hardware requirements
- Silica Liberty Board kit
- One TTL-USB adapter (for communication dump)
- Renesas E1 on-chip debugger
- PC with terminal software (such as HyperTerminal)
Board features
Liberty board has a 6 pin header connector (yellow circled in figure below) that can be used for:
- debug (with E1 pod - see hardware documentation for pinout)
- connect TTL-USB converter to see a “dump” of all comunication between Host MCU and BLE ML7105 module
Liberty has a RGB led that monitor main BLE state (red circled in figure below)
Note
see hardware documentation for Liberty header pinout and how to connect for debug and serial dump
Software requirements
- e2studio Version 2.2.0.13 and KPIT GNURL78 Version 13.02-ELF-MP1 compiler
- Liberty_BLE_v1 firmware
- PC terminal emulator (such as HyperTerminal)
- Liberty Software Application for PC or SmartPhone (to connect with Liberty board)
Note
If you have not yet installed e2studio develepoment suite, before proceeding, go to:
Communication dump
If you like to use serial dump to monitor communication between CPU and ML7105, connect a TLL-USB converter as described in Board features note. You can use a terminal software on your PC to see this dump.
Here settings required for HyperTerminal COMx parameter:
speed = 115200 baud
data with = 8
parity = none
stop bit = 1
flow control = none
Hardware setup
Plug the Battery into socket adapter (see figure below)
Red led will ON to indicate initial settings (if connected, you can see the commnication dump on PC HyperTerminal)
After initialization, the green led will flash every 2 second to indicate that Liberty is in active state waiting connection.
Try to connect an pair with Liberty Software Application, the green led will lamp (half second period), and after the green ON means “device paired”
Use Liberty Application (PC or Smartphone) Software to perfom basic functions with Liberty board.
For debugging purpose, you can use Renesas E1 on-chip debugger. You must have a cable adapter to connect emulator pod with Liberty board (see hardware documentation)
Installing E2studio Developement Suite
This small guide is intended to explain the main steps to properly install the E2studio developement suite.
As possibly not shown here, refer to the E2studio quick start guide r20ut2771ej0100_e2_start_s.pdf.
All steps here described are performed with WINDOWS 7 OS
First step
Download E2studio version 2.2.0.13 and KPIT GNURL78 Version 13.02-ELF-MP1. Yuo can find how to make here Liberty developement tools for tools setup
You must have these two files:
Then, you are ready for E2studio Developement Suite setup.
Starting Install E2studio environment
Double click on Renesas_e2_studio_2.2.0.13.exe.
First of all, it will ask you to upgrade these OS system settings. If your OS is already updated, this popup will not open
Wait for OS system update. This can take much time
When update ends E2studio starts decompressing
When the followiong sceern will appear, you are ready to install E2studio suite:
click “next” button, and setup will ask you to agree license
check ‘I accept ...’ then click “next”
leave unchanged the destination folder and click “next” button
click “install” button to start intallation
E2studio installation steps
Wait for Wizard operations end.
Now Wizard ask for harware device driver installation: for every popup, click “Install” button
Wait for E2studio validation
E2 studio succesfull installed on your system
click “Finish” to end wizard.
Installing GNURL78 KPIT compiler
Double click on GNURL78v1302-ELF-MP1.exe.
When wizard starts, a first popup will appear
Leave unchanged “Default” radio button an click “OK”
Important
The steps following are needed only first time you install GNURL78 compiler.
The data needed for activate license are in the email received after registration :GNURL78 registration email
GNURL78 wizard now ask for activation code. Check “I am a registered user”, then click “Next” button and take care at registration email.
Insert YorEmail and YourCode as received in GNURL78 registration email and then click “Next” button
Click “Next” button
Click “Yes” button to agree License
GNURL78 wizard ask for confirm E2studio toolchain integration. Check and click “Next” button
Wait for wizard ...
GNURL78 features settings. Set as image above then click “Next” button
GNURL78 install folder. Leave unchanged then click “Next” button
GNURL78 settings summary. Click “Next” button
Wait for GNURL78 integration inside E2studio suite
Activation of GNURL78 Maintenance Pack 1. Click “Next” button
GNURL78 compiler successfull installed and configured for E2studio suite!
Firmware specification
Firmware overview
The Liberty_BLE_v1 firmware has been developed starting from VSSPP_ML610QXXX_Ver0_094_beta firmware revision developed from Lapis to use with your PEXL7105_WSN kit.
This “beta” revision include basic BLE stack, an example of GATT database and some function that may be usefull for end-user application development.
More detail regarding ML7105 application and “beta” firmware can be found in “BLE_doc\ML7105_kit” folder included in Liberty_doc.zip archive file
Other documents:
FEXL7105_BACI_Manual-01.pdf — ML7105 Baci reference guide
FEXL7105_AppDevelopersGuide-01.pdf — Summary of basic BLE stack functions
Firmware restrictions
The Libert_BLE_v1 firmware assumes the following restrictions:
• It is designed and configured only for VSP application.
• No testing has been made for VSSPP application.
• No very Low Power mode available. Liberty low-power mode is only for evaluation
• Support few examples of ATT and GATT database (only basic tables)
• There will be no security implemented.
Main firmware features
Liberty_BLE_v1 firmware is designed for demo application. It’s also possible, starting from it, to develope user’s application. In this case, debug and testing are charged to the end user.
By using PC or SmartPhone Liberty Software, you can perform:
- Reading or writing caracteristic handle
- Discover and pair device
- Read sensor’s data stored in GATT database
- Read sensor’s data immediatly (real time value)
- ON/OFF blue led
Liberty firmware also “dump” continuosly the communication between Renesas CPu an ML7105 module. Please refer to Hardware setup in “Quick Start Guide”
Project structure
The application’s file structure includes the following folders:
- Sample_Program – contains source files imported from VSSPP_ML610QXXX_Ver0_094_beta
- appl specific BLE application file
- btstack specific BLE stack management application file
- common BLE application main file and common definition
- platform specific Platform application file: U8 suffix original file are adapted fo Renesas CCPU
- src – Renesas RL78 Hardware setup and driver (generated by Code Generator integrated in E2studio)
Brief of firmware performance
The firmware will include a minimal example to initialize the ML7105 and functions to store periodically (every 30 seconds) the sensors data and to perform pairing with PC or SmartPhone. When paired, using a PC or SmartPhone Liberty Software application, it’s also possible to read/write both Characteristic Value Handle and Caracteristic UUID, set/clear periodically notify (only for Accelerometer data), read Temperature value and Accelerometer data (periodically stored by 30 seconds internal timer) or make a flash read of data from sensors (Temperature and Accelerometer). It’s also possible (writing into reserved Caracteristic Value Handle) turn on and turn off the blue LED on the board.
Using “dump” you can see and store all BACI packet between RL78 cpu and ML7105 BLE module, and you can analyze much more detail about Liberty Board state.
When board startup, in the terminal windows you can see
The RED led will on, and in a few seconds start the initial settings communication.
Here above the last BACI packets that end initial settings
t[hex value] means data from CPU to MODULE
r[hex value] means data from MODULE to CPU
The green led flash (50msec every 2 seconds) to indicate that Liberty is in standby state, waiting for connection or pairing.
When in this state, every 180 seconds the firmware will reset thne ML7105 module and clear pairing information stored in the eeprom
If connection is established, the green led lamps regullary (0,5 seconds ON, 0,5 seconds OFF) to indicate that Liberty is in active state, but not yet paired. When in active state, after 180 seconds the firmware reset the module as when in standby state
The funcion called to perform this is:
BLEutil_StartTimer( BLE_APP_TIM_PAIR_INFO_CLEAR, BLE_TIM_180S, BLE_App_Pairing_Info_Clear_Timer_Handler )
(see inside file ble_app.c at function BLE_App_Fsm)
When green led ligth on, Liberty is active and paired. The 180 seconds timer is disabled.
Note
Yellow led will flash when Liberty are in “unpaired state” (not yet cleared pairing informations stored in the module). In this state, connection or pairing requests are refused.
You must wait for expire of pairing timeout (about 30 seconds). The green led will return as in standby state and new connections are enabled.
Low-power evaluation
Liberty Firmware has a low-power mode capability (only for demo purpose) When compiling, the Macro define LOWP_EN is used to enable/disable auto low-power mode. If enabled, when a 60 seconds timer expires, CPU will enter in stop mode. The CPU will awake from ML7105 IRQ request.
Important
Low Power evaluation with I[average]<80uA is available ONLY WHEN ML7105 IS PAIRED. The Low Power evaluation mode, if entered when ML7105 is unpaired, take a current I[average] of about 2mA. This is because ML7105 (if not yet paired) enable power to radio reception every 5msec.
The maximum time before battery cutoff is about 2000 hours (whith device paired, receive and transmit never used)
Note: default setting for macro LOWP_EN is TRUE (Low-power enabled)
The 60 seconds low-power timer will recharge every time that ML7105 assert IRQ signal
Firmware & documents download
Firmware project file Liberty.zip and Liberty_doc.zip can be found at Silica ArchiTech page. Registration is needed to access at download section.
Click here to go to ArchiTech main page.
Project tips
Important
Liberty_BLE_v1 firmware use “Code Generator” as integrated in E2studio suite to make source file for vector table, hardware driver and reset.
For more detail about, read Code Generator user’s manual in Renesas official site
Important
Take care at changes on hardware driver using Code Generator –> Peripheral Functions. (red circled on image above) It’s important to check if all peripheral settings are correct for the actual project, before generate new code.
Project properties
To access at project properties, righ click on Liberty_BLE_v1 on the Project Explorer window of E2studio suite
In the popup menu that appear, select and click on Property (orange circled in figure above)
Expand C/C++ Build and click on Settings
Project settings window will appear. Now you are ready to check and change main project configurations
Macro defines
There are some macros defined in the project. The main macro defines are in the Compiler–>Source settings
- Details of macro
- __rl78__ macro defines: used to adapt hardware driver for Renesas Cpu. The source file inside Platform folder (all named U8_xxx) use this macro for hardware adapting. This macro is also used in some application files for the same scope.
- VSSPP_DI macro define: this macro disable all VSSPP functionallity (not performed in this firmware revisione)
- NO_CG macro define: Used only in source files automatically generated by “Code Generator”.
Note
If you change setting of “Code Generator” the macro NO_CG can be erased. Please, before change, note your use inside files:
r_cg_adc.c
r_cg_serial_user.c
r_cg_serial.c
Other macros
- Inside file RL78_def.h there are these user macro defines:
- #define PAIR_WDOG FALSE Used in BLE_App_Fsm function. If true, after 180 seconds timer expire, the system will wait for WatchDog reset. If false, the system performs a sofware initialization.
- #define T_FILTER FALSE enable/disable Temperature sensor average readings
- #define READ_RF FALSE enable/disable during initial configuration of ML7105 module of the external low power crystal oscillator.
- #define BTOOL FALSE only for testing purpose. Do not change
- #define CLR_PAIR_AT_RESET TRUE enable/disable automatically clear of paring information stored in the eeprom every time that system is power_up or reseted by WatchDog.
- #define READ_IMMEDIATE TRUE If true, when external application ask for reading a properly UUID characteristic, the system perform a “flash reading of sensors value and send it as answer. If false, the system ask with last stored read.
- #define LOWP_EN TRUE enable/disable a demo feature of low power mode. This mode is available only when Liberty is in paired state
Sections settings
Go to the project property window (as decribed in Project properties)
Then select Setting –> Sections as blue circled in figure below
The Sections main tab will open
You can check if settings are the same as in figure above
Important
If you make changes in Code Generator and generate new code, the section mapping in this graphical interface is lost. However, the linker file is not changed and maintains correct settings. If needed, you can see the linker file contents Linker file contents
Memory region settings
As section settings, go to project property window, then select Settings –> Sections and click on Memory Region tab
Note
The same effect will be done as in Importan notice described in paragraph Section settings
Optimization
Some files in the project are optimized by code and size, and no debug information will be issued. Debbuggin inside these files is not allowed. If you want it, you must change compiler setting.
The files optimizer are listed in box below
Optimization level: Speed and code size
Debug level: none
\Sample_Program\btstack\export\appl\appl_att_server.c
\Sample_Program\btstack\export\appl\appl_baci.c
\Sample_Program\btstack\export\appl\appl_smp.c
\Sample_Program\btstack\export\appl\appl_l2cap.c
\Sample_Program\btstack\export\baci\baci_transport\baci_transport.c
\Sample_Program\btstack\export\baci\baci_client\baci_client.c
To change optimization level, you must go to the file property
Right click on selected file, then click on Properties.
You can see optimization levels and change it (only for the selected file)
Linker file contents
This is the contents of linker file named Liberty_BLE_v1_HardwareDebug_auto.gsi
MEMORY
{
VEC : ORIGIN = 0x0, LENGTH = 4
IVEC : ORIGIN = 0x4, LENGTH = 124
SEC_ID : ORIGIN = 0xC4, LENGTH = 12
OPT_BYTES : ORIGIN = 0xC0, LENGTH = 4
ROM : ORIGIN = 0xD8, LENGTH = 65320
RAM : ORIGIN = 0xFEF00, LENGTH = 3872
}
SECTIONS
{
.vec 0x0 : AT (0x0)
{
KEEP(*(.vec))
} > VEC
.vects 0x4 : AT (0x4)
{
KEEP(*(.vects))
} > IVEC
.option_bytes 0xC0 : AT (0xC0)
{
*(.option_bytes)
} > OPT_BYTES
.security_id 0xC4 : AT (0xC4)
{
*(.security_id)
} > SEC_ID
.secti_rom 0xD8 : AT (0xD8)
{
} > ROM
.rodata 0x2000 : AT (0x2000)
{
. = ALIGN(2);
*(.rodata)
*(.rodata.*)
_erodata = .;
} > ROM
.text :
{
*(.text)
*(.text.*)
etext = .;
. = ALIGN(2);
} > ROM
.init :
{
*(.init)
} > ROM
.fini :
{
*(.fini)
} > ROM
.got :
{
*(.got)
*(.got.plt)
} > ROM
.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > ROM
.eh_frame :
{
*(.eh_frame)
} > ROM
.jcr :
{
*(.jcr)
} > ROM
.tors :
{
__CTOR_LIST__ = .;
. = ALIGN(2);
___ctors = .;
*(.ctors)
___ctors_end = .;
__CTOR_END__ = .;
__DTOR_LIST__ = .;
___dtors = .;
*(.dtors)
___dtors_end = .;
__DTOR_END__ = .;
. = ALIGN(2);
_mdata = .;
} > ROM
.data 0xFEF00 : AT (_mdata)
{
. = ALIGN(2);
_data = .;
*(.data)
*(.data.*)
. = ALIGN(2);
_edata = .;
} > RAM
.bss :
{
. = ALIGN(2);
_bss = .;
*(.bss)
*(.bss.**)
. = ALIGN(2);
*(COMMON)
. = ALIGN(2);
_ebss = .;
_end = .;
} > RAM
.stack 0xFFE00 (NOLOAD) : AT (0xFFE00)
{
_stack = .;
} > RAM
}