Skip to content

Commit 654724f

Browse files
Initial commit for the active scanner example.
1 parent f458802 commit 654724f

File tree

10 files changed

+1513
-0
lines changed

10 files changed

+1513
-0
lines changed

connectivity/active_scanner_sample_code/.cproject

Lines changed: 334 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>active_scanner_sample_code</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>org.eclipse.cdt.core.cnature</nature>
23+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
24+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
25+
</natures>
26+
<linkedResources>
27+
<link>
28+
<name>sdk</name>
29+
<type>2</type>
30+
<locationURI>virtual:/virtual</locationURI>
31+
</link>
32+
<link>
33+
<name>startup</name>
34+
<type>2</type>
35+
<locationURI>SDKROOT/sdk/bsp/startup</locationURI>
36+
</link>
37+
<link>
38+
<name>sdk/FreeRTOS</name>
39+
<type>2</type>
40+
<locationURI>SDKROOT/sdk/free_rtos</locationURI>
41+
</link>
42+
<link>
43+
<name>sdk/adapters</name>
44+
<type>2</type>
45+
<locationURI>SDKROOT/sdk/middleware/adapters</locationURI>
46+
</link>
47+
<link>
48+
<name>sdk/ble</name>
49+
<type>2</type>
50+
<locationURI>SDKROOT/sdk/interfaces/ble</locationURI>
51+
</link>
52+
<link>
53+
<name>sdk/bsp_include</name>
54+
<type>2</type>
55+
<locationURI>SDKROOT/sdk/bsp/include</locationURI>
56+
</link>
57+
<link>
58+
<name>sdk/cli</name>
59+
<type>2</type>
60+
<locationURI>SDKROOT/sdk/middleware/cli</locationURI>
61+
</link>
62+
<link>
63+
<name>sdk/config</name>
64+
<type>2</type>
65+
<locationURI>SDKROOT/sdk/bsp/config</locationURI>
66+
</link>
67+
<link>
68+
<name>sdk/console</name>
69+
<type>2</type>
70+
<locationURI>SDKROOT/sdk/middleware/console</locationURI>
71+
</link>
72+
<link>
73+
<name>sdk/intrinsic</name>
74+
<type>2</type>
75+
<locationURI>SDKROOT/sdk/middleware/intrinsic</locationURI>
76+
</link>
77+
<link>
78+
<name>sdk/ldscripts</name>
79+
<type>2</type>
80+
<locationURI>SDKROOT/sdk/bsp/ldscripts/ble_projects</locationURI>
81+
</link>
82+
<link>
83+
<name>sdk/memory</name>
84+
<type>2</type>
85+
<locationURI>SDKROOT/sdk/bsp/memory</locationURI>
86+
</link>
87+
<link>
88+
<name>sdk/middleware_config</name>
89+
<type>2</type>
90+
<locationURI>SDKROOT/sdk/middleware/config</locationURI>
91+
</link>
92+
<link>
93+
<name>sdk/osal</name>
94+
<type>2</type>
95+
<locationURI>SDKROOT/sdk/middleware/osal</locationURI>
96+
</link>
97+
<link>
98+
<name>sdk/peripherals</name>
99+
<type>2</type>
100+
<locationURI>SDKROOT/sdk/bsp/peripherals</locationURI>
101+
</link>
102+
<link>
103+
<name>sdk/sys_man</name>
104+
<type>2</type>
105+
<locationURI>SDKROOT/sdk/bsp/system/sys_man</locationURI>
106+
</link>
107+
<link>
108+
<name>sdk/util</name>
109+
<type>2</type>
110+
<locationURI>SDKROOT/sdk/bsp/util</locationURI>
111+
</link>
112+
</linkedResources>
113+
<variableList>
114+
<variable>
115+
<name>SDKROOT</name>
116+
<value>$%7BWORKSPACE_LOC%7D</value>
117+
</variable>
118+
</variableList>
119+
</projectDescription>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Active Scanner Demonstration Example
2+
3+
This example demonstrating setting up the Bluetooth controller in central role. Active scanning can be initiated through the serial console. Once the active scanning session times out, scanning is allowed to be re-initiated. If logging is enabled (enabled by default) each device scanned along with its advertising data are displayed on the serial console.
4+
5+
## HW and SW Configuration
6+
7+
- **Hardware Configuration**
8+
- This example runs on the DA1459x family of devices.
9+
- A [Pro Development Kit](https://www.renesas.com/us/en/products/wireless-connectivity/bluetooth-low-energy/da14592-016fdevkt-p-smartbond-da14592-bluetooth-low-energy-52-soc-development-kit-pro) (DevKit) is needed for this example.
10+
- **Software Configuration**
11+
- Download the latest [SDK](https://www.renesas.com/us/en/products/wireless-connectivity/bluetooth-low-energy/da14592-smartbond-multi-core-bluetooth-le-52-soc-embedded-flash?gad_source=1) version for the target family of devices.
12+
13+
- SEGGER J-Link tools are normally downloaded and installed as part of the [e2 Studio](https://www.renesas.com/us/en/software-tool/smartbond-development-tools) installation.
14+
15+
## How to run the example
16+
17+
### Initial Setup
18+
19+
- Download the source code from [GitHub](https://github.com/dialog-semiconductor/BLE_SDK10_DA1459x_examples).
20+
- Import the project into your workspace (there should be no path dependencies). If you are not familiar with these processes it's advised that you first familiarize yourself with the [Getting Started](https://lpccs-docs.renesas.com/um-b-166-da1459x_getting_started/index.html) guide.
21+
- Connect the target device to your host PC via USB1. The mentioned port is used to power the device and to support serial and JTAG interfaces. These two interfaces can be used both for flashing and debugging purposes.
22+
- Compile the source code (either in Release or Debug mode) and flash it into the chip. Please note that the debug flavor should be used merely for debugging purposes since it should increase the generated binary file, significantly. In addition, the source code is built to work with the embedded flash Working with external flash memory devices is out of the scope of this demonstration example.
23+
- Open a serial terminal (115200/8-N-1).
24+
- Once the application image is flashed, press the RESET button on the daughter board to start executing the application.
25+
26+
- The terminal should display the random address generated for device.
27+
28+
- Scanning can be initiated by typing `active_scanner_start`. If the command is typed correctly, all scanned devices along with their data should be displayed.
29+
30+
## Known Limitations
31+
32+
There should be no known limitations for this example.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/**
2+
****************************************************************************************
3+
*
4+
* @file custom_config_eflash.h
5+
*
6+
* @brief Board Support Package. User Configuration file for cached eFLASH mode.
7+
*
8+
* Copyright (C) 2020-2024 Renesas Electronics Corporation and/or its affiliates.
9+
* All rights reserved. Confidential Information.
10+
*
11+
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
12+
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
13+
* revocable, non-sub-licensable right and license to use the Software, solely if used in
14+
* or together with Renesas products. You may make copies of this Software, provided this
15+
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
16+
* reserves the right to change or discontinue the Software at any time without notice.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
19+
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
21+
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
24+
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
25+
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
26+
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
27+
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
28+
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
29+
* SOFTWARE.
30+
*
31+
****************************************************************************************
32+
*/
33+
#ifndef CUSTOM_CONFIG_EFLASH_H_
34+
#define CUSTOM_CONFIG_EFLASH_H_
35+
36+
#include "bsp_definitions.h"
37+
38+
#define CONFIG_USE_BLE
39+
40+
#define CONFIG_RETARGET
41+
#define DBG_LOG_ENABLE ( 1 )
42+
#define GENERATE_RANDOM_DEVICE_ADDRESS ( 1 )
43+
44+
#define dg_configUSE_CLI ( 1 )
45+
#define dg_configUSE_CONSOLE ( 1 )
46+
#define dg_configUART_ADAPTER ( 1 )
47+
48+
/*************************************************************************************************\
49+
* System configuration
50+
*/
51+
#define dg_configEXEC_MODE ( MODE_IS_CACHED )
52+
#define dg_configCODE_LOCATION ( NON_VOLATILE_IS_EMBEDDED_FLASH )
53+
54+
#define dg_configUSE_WDOG ( 1 )
55+
#define dg_configUSE_SW_CURSOR ( 1 )
56+
57+
/*************************************************************************************************\
58+
* FreeRTOS configuration
59+
*/
60+
#define OS_FREERTOS /* Define this to use FreeRTOS */
61+
#define configTOTAL_HEAP_SIZE ( 24000 ) /* FreeRTOS Total Heap Size */
62+
63+
/*************************************************************************************************\
64+
* Peripherals configuration
65+
*/
66+
#define dg_configFLASH_ADAPTER ( 1 )
67+
#define dg_configNVMS_ADAPTER ( 1 )
68+
#define dg_configNVMS_VES ( 0 )
69+
#define dg_configNVPARAM_ADAPTER ( 1 )
70+
71+
/*************************************************************************************************\
72+
* BLE configuration
73+
*/
74+
#define CONFIG_USE_BLE_SERVICES
75+
76+
/* Default connection parameter */
77+
#define defaultBLE_PPCP_INTERVAL_MIN (BLE_CONN_INTERVAL_FROM_MS(15))
78+
#define defaultBLE_PPCP_INTERVAL_MAX (BLE_CONN_INTERVAL_FROM_MS(15))
79+
#define defaultBLE_PPCP_SLAVE_LATENCY (0) // 0 events
80+
#define defaultBLE_PPCP_SUP_TIMEOUT (BLE_SUPERVISION_TMO_FROM_MS(1000))
81+
82+
/*
83+
* Min. connection event length decides number of packets per connection.
84+
* Increasing this value will increase throughput if device is master.
85+
*/
86+
#define defaultBLE_CONN_EVENT_LENGTH_MIN BLE_CONN_EVENT_LENGTH_FROM_MS(10)
87+
88+
/*************************************************************************************************\
89+
* BLE configuration
90+
*/
91+
#define dg_configBLE_PERIPHERAL ( 0 )
92+
#define dg_configBLE_GATT_SERVER ( 0 )
93+
#define dg_configBLE_OBSERVER ( 0 )
94+
#define dg_configBLE_BROADCASTER ( 0 )
95+
#define dg_configBLE_L2CAP_COC ( 0 )
96+
97+
/* Include bsp default values */
98+
#include "bsp_defaults.h"
99+
/* Include middleware default values */
100+
#include "middleware_defaults.h"
101+
102+
#endif /* CUSTOM_CONFIG_EFLASH_H_ */
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
LDSCRIPT_PATH=../ldscripts
2+
3+
.PHONY: main-build pre-build generate_ldscripts FORCE
4+
main-build : | pre-build
5+
6+
FORCE:
7+
8+
generate_ldscripts : mem.ld sections.ld
9+
10+
%.ld : $(LDSCRIPT_PATH)/%.ld.h FORCE
11+
"$(CC)" -I "$(BSP_CONFIG_DIR)" -I "$(MIDDLEWARE_CONFIG_DIR)" $(PRE_BUILD_EXTRA_DEFS) -include "$(APP_CONFIG_H)" $(LD_DEFS) -Ddg_configDEVICE=$(DEVICE) -Ddg_configBLACK_ORCA_IC_REV=BLACK_ORCA_IC_REV_$(IC_REV) -Ddg_configBLACK_ORCA_IC_STEP=BLACK_ORCA_IC_STEP_$(IC_STEP) -E -P -c "$<" -o "$@"
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
****************************************************************************************
3+
*
4+
* @file misc.h
5+
*
6+
* @brief Miscellaneous functionality
7+
*
8+
* Copyright (C) 2015-2024 Renesas Electronics Corporation and/or its affiliates.
9+
* All rights reserved. Confidential Information.
10+
*
11+
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
12+
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
13+
* revocable, non-sub-licensable right and license to use the Software, solely if used in
14+
* or together with Renesas products. You may make copies of this Software, provided this
15+
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
16+
* reserves the right to change or discontinue the Software at any time without notice.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
19+
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
21+
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
24+
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
25+
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
26+
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
27+
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
28+
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
29+
* SOFTWARE.
30+
*
31+
****************************************************************************************
32+
*/
33+
34+
#ifndef MISC_H_
35+
#define MISC_H_
36+
37+
#include <stdio.h>
38+
#include "hw_gpio.h"
39+
40+
/*********************************************************************
41+
*
42+
* Defines
43+
*
44+
*********************************************************************
45+
*/
46+
#define KiB 1024
47+
48+
#if DBG_LOG_ENABLE
49+
#define DBG_LOG(_f, args...) printf((_f), ## args)
50+
#else
51+
#define DBG_LOG(_f, args...)
52+
#endif /* DBG_LOG_ENABLE */
53+
54+
#if DBG_IO_ENABLE
55+
#define DBG_IO_ON(_port, _pin) \
56+
{ \
57+
hw_sys_pd_com_enable(); \
58+
hw_gpio_set_pin_function((_port), (_pin), HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO); \
59+
hw_gpio_set_active((_port), (_pin)); \
60+
hw_gpio_pad_latch_enable((_port), (_pin)); \
61+
hw_gpio_pad_latch_disable((_port), (_pin)); \
62+
hw_sys_pd_com_disable(); \
63+
}
64+
65+
#define DBG_IO_OFF(_port, _pin) \
66+
{ \
67+
hw_sys_pd_com_enable(); \
68+
hw_gpio_set_pin_function((_port), (_pin), HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO); \
69+
hw_gpio_set_inactive((_port), (_pin)); \
70+
hw_gpio_pad_latch_enable((_port), (_pin)); \
71+
hw_gpio_pad_latch_disable((_port), (_pin)); \
72+
hw_sys_pd_com_disable(); \
73+
}
74+
75+
#else
76+
#define DBG_IO_ON(_port, _pin)
77+
#define DBG_IO_OFF(_port, _pin)
78+
#endif /* DBG_IO_ENABLE */
79+
80+
#endif /* MISC_H_ */

0 commit comments

Comments
 (0)