Code Monkey home page Code Monkey logo

mbed-os-example-ble's Introduction

BLE Examples

This repo contains a collection of BLE example applications based on Mbed OS. Each example subdirectory contains a separate Mbed OS project, along with a description of the example and additional instructions for running it.

You can build each project with all supported Mbed OS build tools. However, this file specifically refers to the command-line interface tools, Arm Mbed CLI 1 and Mbed CLI 2.

The BLE documentation describes the BLE APIs on Mbed OS.

Mbed OS build tools

Mbed CLI 2

Starting with version 6.5, Mbed OS uses Mbed CLI 2. It uses Ninja as a build system, and CMake to generate the build environment and manage the build process in a compiler-independent manner. If you are working with Mbed OS version prior to 6.5 then check the section Mbed CLI 1.

Install Mbed CLI 2.

Mbed CLI 1

Install Mbed CLI 1.

Pre-Requisites

In order to use BLE in Mbed OS you need one of the following hardware combinations:

The BLE documentation describes the BLE APIs on mbed OS.

Targets for BLE

The following targets have been tested and work with these examples:

  • Targets with an ST BLE expansion board plugged in:

    • NUCLEO_F401RE
    • NUCLEO_L476RG
    • NUCLEO_L446RE
    • K64F
  • ST boards with embedded SPBTLE-RF module (BlueNRG-MS):

    • DISCO_L475VG_IOT01A (ref B-L475E-IOT01A)
    • DISCO_L562QE (ref STM32L562E-DK)
  • Board with wireless STM32WB microcontrollers:

    • NUCLEO_WB55RG
  • Nordic:

    • NRF52_DK
    • NRF52840_DK
  • Embedded Planet:

    • EP_AGORA

Important: If an ST BLE expansion is used with the K64F board, a hardware patch is required. Check out X-NUCLEO-BNRG2A1 or X-NUCLEO-IDB05A1 for more information.

The following board is currently not supported as it doesn't yet support the Cordio stack: * NRF51_DK

Using ST BLE expansion board on other targets

It is possible to use the ST BLE expansion on boards not directly supported by these examples as long as the board has an Arduino UNO R3 connector.

To make the board compatible with the ST BLE expansion three things are required:

  • Add the BLE feature to your target.
  • Add the BLE implementation for the ST BLE expansion to the list of modules which have to be compiled.
  • Indicate to the BLE implementation that your board uses an Arduino connector.

All these operations can be done in the file mbed_app.json present in every example.

In the section target_overrides, add a new object named after your target with the following three fields:

  • "target.components_add": ["BlueNRG_2"] Add the BlueNRG-2 component to the target.
  • "target.features_add": ["BLE"] Add the BLE feature to the target.
  • "target.extra_labels_add": ["CORDIO"]: Add the BLE implementation of the ST BLE expansion to the list of the application modules.

Below is an example of the JSON to be added in the target_overrides section of mbed_app.json, with the NUCLEO_F401RE board.

        "NUCLEO_F401RE": {
            "target.components_add": ["BlueNRG_2"],
            "target.features_add": ["BLE"],
            "target.extra_labels_add": ["CORDIO"]
        },

Note: Further information about the configuration system is available in the documentation.

Important: It is required to apply an hardware patch to the ST BLE expansion if it is used on a board with an Arduino connector. Check out X-NUCLEO-BNRG2A1 or X-NUCLEO-IDB05A1 for more information.

Building the examples

  1. Clone the repository containing the collection of examples:

    $ git clone https://github.com/ARMmbed/mbed-os-example-ble.git

    Tip: If you don't have git installed, you can download a zip file of the repository.

  2. Using a command-line tool, navigate to any of the example directories, like BLE_Advertising:

    $ cd mbed-os-example-ble
    $ cd BLE_Advertising
  3. Update the source tree:

    • Mbed CLI 2
    $ mbed-tools deploy
    • Mbed CLI 1
    $ mbed deploy
  4. Connect a USB cable between the USB port on the board and the host computer.

  5. Run the following command: this will build the example project, program the microcontroller flash memory, and then open a serial terminal to the device.

    • Mbed CLI 2
    $ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm --baudrate 115200
    • Mbed CLI 1
    $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm --baudrate 115200

Your PC may take a few minutes to compile your code.

The binary will be located in the following directory:

  • Mbed CLI 2 - ./cmake_build/<TARGET>/<PROFILE>/<TOOLCHAIN>/
  • Mbed CLI 1 - ./BUILD/<TARGET>/<TOOLCHAIN>/

You can manually copy the binary to the target, which gets mounted on the host computer through USB, rather than using the --flash option.

You can also open a serial terminal separately, as explained below, rather than using the --sterm and --baudrate options.

Running the examples

When example application is running, information about activity is printed over the serial connection. The default serial baudrate has been set to 115200 for these examples.

If not using the --sterm and --baudrate options when flashing, have a client open and connected to the board. You may use:

  • Mbed CLI 2

    $ mbed-tools sterm -b 115200
  • Mbed CLI 1

    $ mbed sterm -b 115200
  • Tera Term for Windows

  • screen or minicom for Linux

    screen /dev/serial/<your board> 115200

To observe and/or interact with example applications please use any BLE scanner on a smartphone. If you don't have a scanner on your phone, please install:

Using bare metal profile

MBED BLE can support bare metal profile: https://os.mbed.com/docs/mbed-os/v6.10/bare-metal/using-the-bare-metal-profile.html

Here is an example with NUCLEO_WB55RG, update your local mbed_app.json:

{
    "requires": ["bare-metal", "events", "cordio-stm32wb"],

How to reduce application size

Here are few tips to reduce further application size (this could be in addition of baremetal)

Update in mbed_app.json:

{
    "target_overrides": {
        "*": {
            "target.c_lib": "small",
            "target.printf_lib": "minimal-printf",
            "platform.minimal-printf-enable-floating-point": false,
            "platform.stdio-minimal-console-only": true,
...

Troubleshooting

If you encounter problems with running the example, first try to update to the development branch of the example and see if the problem persists. Make sure to run mbed update after you checkout the development branch to update the libraries to the versions in that branch.

If the problem persists, try turning on traces in the example. This is done by changing the config in mbed_app.json:

		"mbed-trace.enable": true,
		"mbed-trace.max-level": "TRACE_LEVEL_DEBUG",
		"cordio.trace-hci-packets": true,
		"cordio.trace-cordio-wsf-traces": true,
		"ble.trace-human-readable-enums": true

Compile with --profile debug and run with the serial connected to your PC.

This will enable all the traces in BLE. If the number of traces is too big for the serial to handle or the image doesn't fit try turning off all except the first one (mbed-trace.enable) and/or lowering the max-level to "TRACE_LEVEL_WARNING".

Save the output of the serial to a file. Please open an issue in this repo, describe the problem and attach the file containing the trace output.

License and contributions

The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see CONTRIBUTING.md for more info.

Branches

Master branch is for releases only. Please target the development branch for all your PRs.

mbed-os-example-ble's People

Contributors

0xc0170 avatar adbridge avatar apalmierigh avatar bcostm avatar bogdanm avatar bridadan avatar cmonr avatar conradbraam avatar garyswansonarm avatar geky avatar gpsimenos avatar hugueskamba avatar iriark01 avatar janjongboom avatar jaustin avatar jeromecoutant avatar ldong-arm avatar liyouzhou avatar lmestm avatar marcbonnici avatar marcelosalazar avatar pan- avatar patater avatar paul-szczepanek-arm avatar rajkan01 avatar rgrover avatar rwalton-arm avatar sg- avatar theotherjimmy avatar urutva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbed-os-example-ble's Issues

BLE Frequent disconnects and instability with SPBTLE-RF0

Reported by @alphatronicstva - Mbed Cloud customer.
Internal Ref: IOTPAN-60

Background Information
Mbed OS 5.7.5

Description
Custom designed hardware, based on the STM32 F429ZI, with an SPBTLE-RF0 module soldered directly on the board. They have successfully ported this to work with their board.

Using the BLE Heart Rate monitoring application: https://github.com/ARMmbed/mbed-os-example-ble/blob/master/BLE_HeartRate reporting frequent disconnects and instability.

Connects sometimes, very unstable and disconnects after some time automatically.

100% reproducibility from the customer.

nRF51 unresponsive for the BLE_Beacon example

What is the problem

The nRF51 board is unresponsive for the BLE_Beacon example on the mbed-os-5.7.0-oob branch.
The board doesn't print anything on the serial port and the device doesn't appear on the Nordic mobile app. I have this problem with the three compilers

What have I tried

I monitor the serial port at 9600b/s and at 115200b/s - it doesn't help
I updated the firmware of the board - it doesn't help
I deleted and imported again the example repository - it doesn't help

Do you have any suggestions what to do in order to make this example working?

Thanks and regards,
George

[NRF5] Impossible to debug or flash the examples with IAR

  • Description: It is not possible to flash or debug an application with IAR on the Nordic target. This issue is caused by a bad interaction between CMSIS-DAP IF present on the Nordic boards and IAR CMSIS-DAP debug driver.
  • Workaround: The best solution is to switch to the JLINK IF image and configure the IAR project to use it.
    • Download the JLink IF and install it on the board.
    • Open the exported project in IAR then go to its options.
    • Go to the debugger section
      • In the setup tab choose J-link/J-trace as the debug driver.
      • In the Download tab disable the Use flash loader(s) option.
      • In the Extra options tabs, tick the Use command line options and add the following content: --drv_vector_table_base=0x0.

WARNING: Program ... does not use source control management

If you clone this repo from git, then cd into a sub folder like BLE_Beacon. The mbed-cli command 'mbed ls' results in the following warning message, with a bad suggestion.

xxx@xxx-VirtualBox:~/Documents/Projects/mbed-os-example-ble/BLE_Beacon$ mbed ls
[mbed] WARNING: Program "BLE_Beacon" in "/home/xxx/Documents/Projects/mbed-os-example-ble/BLE_Beacon" does not use source control management.
[mbed] WARNING: To fix this you should use "mbed new ." in the root of your program.

My mobile phone can not connect to nRF52-DK

Hi

Test APP is nRF Connect for Mobile (https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=zh_TW)

EVB: Nordic nRF52-DK (https://os.mbed.com/platforms/Nordic-nRF52-DK/)

Use the mbed compiler

step:

  1. BLE LED image(nrf52-DK mbed source code) burn into the nrf52-DK
  2. download nRF Connect app
  3. Search device -> can search for LED
  4. Click CONNECT

result:
CONNECTING ... -> DISCONVERING ... -> DISCONNECTED

update:
The old sample code(BLE_Thermometer) can connected, but if I update the mbed folder the issue will reproduce

[email protected]
Thanks
Fred

[OoB_5.5-RC2]: arm_beetle_soc, can not update the URL by app

BLE_EddystoneService example does not work as expected.

Steps:

  1. Clone repo, update to mbed-os-5.5.0-rc2-oob branch.

  2. cd BLE_EddystoneService and mbed compile -t ARM -m arm_beetle_soc

  3. Flash BLE_EddystoneService.bin to target.

  4. Reset and run.

  5. Start nRF Connect app

  6. Scan device and connect to the EDDISTONE CONFIG device

  7. Open Data part and write 0x0161726d00 value

  8. Read the Value in Data, but it is empty (expected Value: https://www.arm.com)

  9. Disconnect from device, and scan again

  10. Eddystone service is up, but the URL is www.mbed.com, not www.arm.com

SHA's:

BLE_EddystoneService (None)
|- mbed-os (162f80099d94)
`- shields\TARGET_ST_BLUENRG (6670a4495aaf)

Note: Same issue found on both GCC_ARM and IAR build.

Related to : #37

OOB: Bluetooth device fails to connect to running examples (NRF52_DK)

Trying to run example applications BLE_LED and BLE_LEDBlinker for 5.8 OOB testing using mbed-os-5.8.0-oob branch with suggested mbed-os branch https://github.com/ARMmbed/mbed-os/#d1ba1089a31ffab6b6a8887092b3d1fcc7c23b72

Connecting to the serial port of the device shows the correct output (BLE_LED in this case):

DEVICE MAC ADDRESS: e8:10:a0:6c:32:af

Connecting to the running device fails on NRF52_DK, however the same examples with the same configurations succeeds when running on an NRF51_DK.

capture

BLE_UART service

Hi,
I would like to port a custom bootloader which uses UART actually. So is there any UART Service Example around like this one here: https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_UARTConsole/ or here https://developer.mbed.org/teams/Bluetooth-Low-Energy/wiki/UART-access-over-BLE

Sorry I am new to BLE and the new mbed-os, I am always wondering which one is for the old and which one is for the new mbed-os.
Which service uses the UART service? I do not found any information of this service here. https://www.bluetooth.com/specifications/adopted-specifications#gattspec

Or is there any better Service I should use for a Bootloader?

Error: L6406E: No space in execution regions with .ANY selector matching ...

Hi,
i compile example from BLE_Beacon example for HRM1017 board under mbed-cli and online compiler.

But only this messages on link
Link: BLE_Beacon
Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching retarget.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching stdio_streams.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching stdio_streams.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching stdio_streams.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching btle.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching ble_conn_params.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching rt_Task.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching equeue_mbed.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching pstorage.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching rt_List.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching pstorage.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching RTX_Conf_CM.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching FileBase.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching BLE.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching RTX_Conf_CM.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching us_ticker.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching pwmout_api.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching softdevice_handler.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching RTX_Conf_CM.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching serial_api.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching device_manager_peripheral.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching fds.o(fs_data).
Error: L6406E: No space in execution regions with .ANY selector matching RTX_Conf_CM.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching RTX_Conf_CM.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching rt_CMSIS.o(.bss).
Error: L6406E: No space in execution regions with .ANY selector matching rt_CMSIS.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching BLE.o(.data).
Error: L6406E: No space in execution regions with .ANY selector matching nordic_critical.o(.data).
...

Can you help to resolve this issue ?

Thanks

IAR EWARM generates compile error

Detected by OOB test RC#1

X:\BLE_BatteryLevel>mbed compile -m NUCLEO_F401RE -t IAR
Building project BLE_BatteryLevel (NUCLEO_F401RE, IAR)
Scan: .
Scan: FEATURE_BLE
Scan: FEATURE_UVISOR
Scan: mbed
Scan: env
Compile: events.c
[ERROR]
      return equeue_cancel(q, id);
             ^
"X:\BLE_BatteryLevel\mbed-events\events-c\events.c",282  Error[Pe118]: a void function may not return a value

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u X:\BLE_BatteryLevel\mbed-os\tools\make.py -t IAR -m NUCLEO_F401RE --source . --build .\.build\NUCLEO_F401RE\IAR" in "X:\BLE_BatteryLevel"

My IAR EWARM version is 7.70.1.

Online IDE compile error for Beacon

Error: Cannot open source input file "nrf.h": No such file or directory in "extras/BLE_Thermometer/mbed-os.lib/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/device/cmsis.h", Line: 21, Col: 18

mbed import fails

(workspace) C:\Development>mbed import mbed-os-example-ble
[mbed] Importing program "mbed-os-example-ble" from "https://github.com/ARMmbed/mbed-os-example-ble/" at latest revision in the current branch
[mbed] WARNING: Cannot find the mbed tools directory in "C:\Development\mbed-os-example-ble"

---
(workspace) C:\Development>mbed --version
0.8.2

[OOB_5_4_RC1] NUCLEO_F207ZG Pinmap not found

Hi all,

working on the 5.4 oob for mbed-os-example-ble/BLE_URIBeacon on the Nucleo f207zg board and I am getting "pinmap not found for peripheral" when I run the compiled code.

nucleof207zg

[OoB_RC1_5.4] : FLASH size exceeds when using make_gcc_arm on nRF51_DK.

Steps to reproduce:

  1. Import the example, switch to OoB branch.
  2. mbed export -i make_gcc_arm -m nRF51_DK
  3. make clean
  4. make.

Compiles fine, but at link time, fails due to FLASH overflow.

C:\Ashok\mbed_CLI\v5_4_OoB\mbed-os-example-ble\BLE_EddystoneService>mbed export -i make_gcc_arm -m nRF51_DK
c:\python27\lib\site-packages\fuzzywuzzy\fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
Scan: .
Scan: FEATURE_BLE
Scan: FEATURE_COMMON_PAL
Scan: FEATURE_LWIP
Scan: FEATURE_UVISOR
<snip>

C:\Ashok\mbed_CLI\v5_4_OoB\mbed-os-example-ble\BLE_EddystoneService>make clean
rmdir /S /Q "BUILD"

C:\Ashok\mbed_CLI\v5_4_OoB\mbed-os-example-ble\BLE_EddystoneService>make
<snip>
"Compile: main.cpp"
In file included from .././mbed-os/platform/platform.h:28:0,
                 from .././mbed-os/features/filesystem/mbed_filesystem.h:23,
                 from .././mbed-os/mbed.h:51,
                 from ../source/main.cpp:19:
.././mbed-os/platform/toolchain.h:23:2: warning: #warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3] [-Wcpp]
 #warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3]
  ^
"link: BLE_EddystoneService.elf"
c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: BLE_EddystoneService.elf section `.text' will not fit in region `FLASH'
c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 17088 bytes
collect2.exe: error: ld returned 1 exit status
make[1]: *** [BLE_EddystoneService.elf] Error 1
make: *** [all] Error 2

The mbedtls/* definition in file .mbedignore causes a compile error

I compile BLE_BatteryLevel example for target NUMAKER_PFM_NUC472 but get a error.

The root cause is the NUC472 supports H/W SHA and need to include mbedtls header. Due to the mbedtls/* definition in file .mbedignore, the H/W SHA code cannot find the header and encounters an error. Please remove the mbedtls/* definition to fix this issue.

Below is the compile error message.

......
Scan: mbed
Scan: env
Compile [ 73.6%]: sha1_alt.c
[ERROR] .\mbed-os\targets\TARGET_NUVOTON\TARGET_NUC472\crypto\sha\sha1_alt.c:21:28: fatal error: mbedtls/config.h: No such file or directory
compilation terminated.
[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u C:\Users\cczhang\mbed\mbed-os-example-ble\BLE_BatteryLevel\mbed-os\tools\make.py -t GCC_ARM -m NUMAKER_PFM_NUC472 --source . --build .\BUILD\NUMAKER_PFM_NUC472\GCC_ARM" in "C:\Users\cczhang\mbed\mbed-os-example-ble\BLE_BatteryLevel"

[NUCLEO_F411RE]: Some BLE examples doesn't work with the X-NUCLEO BLE shield

  • Description: The following BLE examples doesn't work on the NUCLEO_F411RE with the ST shield:
    • BLE_BatteryLevel
    • BLE_Button
    • BLE_EddystoneObserver
    • BLE_EddystoneService
    • BLE_GapButton
    • BLE_HeartRate
    • BLE_LED
    • BLE_LEDBlinker
    • BLE_Thermometer
      The cause of the failure is the use of an LED and the SPI1 in the same application. Even if the board define 4 LED, only 1 LED is actually accessible to the programmer and the LED line is shared with the clock line of the SPI1. Using both at the same time will cause failure regarding SPI communication and in this case prevent the application to actually work.
  • Workaround: Remove the code related to the LED (including the declaration!), it is only use to show that the board is alive.

LEDBlinker: NUCLEO_F401RE+ST BLE NRG: Build errors - GCC OoB#3

Version: https://github.com/ARMmbed/mbed-os-example-ble/tree/mbed-os-5.1.0-rc3
OS: Mac 10.11.6
Toolchain: GCC_ARM
Target: NUCLEO_F401RE + ST BLUE NRG
Test: LEDBlinker

Compile: main.cpp
[Error] main.cpp@177,48: no matching function for call to 'events::EventQueue::post_every(void (&)(), int)'
[ERROR] ./source/main.cpp: In function 'int main()':
./source/main.cpp:177:48: error: no matching function for call to 'events::EventQueue::post_every(void (&)(), int)'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:176:9: note: candidate: template<class F> int events::EventQueue::post_every(int, F)
int post_every(int ms, F f) {
^
./mbed-events/EventQueue.h:176:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:190:9: note: candidate: template<class F, class A0> int events::EventQueue::post_every(int, F, A0)
int post_every(int ms, F f, A0 a0) {
^
./mbed-events/EventQueue.h:190:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:195:9: note: candidate: template<class F, class A0, class A1> int events::EventQueue::post_every(int, F, A0, A1)
int post_every(int ms, F f, A0 a0, A1 a1) {
^
./mbed-events/EventQueue.h:195:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:200:9: note: candidate: template<class F, class A0, class A1, class A2> int events::EventQueue::post_every(int, F, A0, A1, A2)
int post_every(int ms, F f, A0 a0, A1 a1, A2 a2) {
^
./mbed-events/EventQueue.h:200:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:205:9: note: candidate: template<class F, class A0, class A1, class A2, class A3> int events::EventQueue::post_every(int, F, A0, A1, A2, A3)
int post_every(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3) {
^
./mbed-events/EventQueue.h:205:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^
In file included from ./mbed-events/events.h:19:0,
from ./source/main.cpp:17:
./mbed-events/EventQueue.h:210:9: note: candidate: template<class F, class A0, class A1, class A2, class A3, class A4> int events::EventQueue::post_every(int, F, A0, A1, A2, A3, A4)
int post_every(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
^
./mbed-events/EventQueue.h:210:9: note:   template argument deduction/substitution failed:
./source/main.cpp:177:48: note:   cannot convert 'periodicCallback' (type 'void()') to type 'int'
eventQueue.post_every(periodicCallback, 500);
^

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u /Users/barsza01/devel/mbed/mbed-os-example-ble/BLE_LEDBlinker/mbed-os/tools/make.py -t GCC_ARM -m NUCLEO_F401RE --source . --build ./.build/NUCLEO_F401RE/GCC_ARM" in "/Users/barsza01/devel/mbed/mbed-os-example-ble/BLE_LEDBlinker"

---

OOB: BLE_Beacon example with make_gcc_arm has link error (using NRF52_DK)

command: >>mbed export -m NRF52_DK -i make_gcc_arm
>>make

Error message:

"link: BLE_Beacon.elf"
'arm-none-eabi-objcopy' -O binary BLE_Beacon.elf BLE_Beacon.bin
'arm-none-eabi-objcopy' -O ihex BLE_Beacon.elf BLE_Beacon.hex
"NOTE: the srec_cat binary is required to be present in your PATH. Please see http://srecord.sourceforge.net/ for more information."
srec_cat .././mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex  -intel BLE_Beacon.hex -intel -o BLE_Beacon-comb
ined.hex -intel --line-length=44
process_begin: CreateProcess(NULL, srec_cat .././mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/sdk/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex -intel BLE_Be
acon.hex -intel -o BLE_Beacon-combined.hex -intel --line-length=44, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [BLE_Beacon-combined.hex] Error 2
make: *** [all] Error 2

nRF51-DK printf() causes hang when PC serial port not active / not opened.

Already reported this once in the mbed OS codebase, here's another concrete example of this happening.

The problem is that, with the nRF51-DK hooked up to my computer, if I don't connect to and open the serial port exposed as /dev/ttyACM0, whatever software is running on the DK board will just hang. It seems like the Nordic serial port code locks up because it always expects some hardware flow control of some sort, so that if I don't have minicom running, it doesn't work. Also, if I run minicom then exit from it, the DK board will keep running for a while, then eventually hangs.

The Nordic serial port code simply does not work properly. Where, in the HAL (pun intended), do I fix that?

Here's a video of this happening.

The video shows the code example from my fork here, which is running:

  • At the start, the board is hung, because I don't have minicom open.
  • I open minicom, the board starts printing "Alive." again.
  • I close minicom, the board eventually hangs again.

compiling error with online compiler

Hi,

1, I tried to use mbed cli to compile the examples. I can compile successfully.
2, Because many developers are more familiar with the online compiler. https://developer.mbed.org/compiler
I try to import the mbed-os-example-ble to the online compiler(Import From URL) and succeed.
3, click compile. It will try to compile all the ble examples and compile failed with the BLE_Button. It shows:
Identifier "BLE_BUTTON_PIN_NAME" is undefined "InterruptIn button(BLE_BUTTON_PIN_NAME);"
4, Another question about the online compiler is:
With mbed cli, I can "cd BLE_HeartRate", then "mbed compile -t GCC_ARM -m K64F".
But in online compiler, I did not see the option to only compile one example like BLE_HeartRate. Any idea?

Thanks,
Nick

BLE examples use too much power

The power consumption of these examples seems to be in the range of a few milliamps which suggests that the processor doesn't go to any low power mode. The answer to this question suggested that low power operation will be default in the next release but it doesn't seem to be the case. Just updating the documentation with some advice about how to lower power usage would be helpful too.

Incorrect event size in eventQueue definitions

The eventQueue definition in the various BLE examples is too small:

static EventQueue eventQueue(
    /* event count */ 10 * /* event size */ 32
);

Shouldn't the event size should use the EVENTS_EVENT_SIZE define (which is currently 52 bytes)?

BLE_GAPButton: nRF52-DK advertised value not incrementing

Pressing the buttons doesn't change the value in the advertisement, but the device can be seen in the nRF Connect app

  • Tried all of the buttons to no avail
  • Scanned for the device multiple times, to ensure that the app was updating the value
  • Tried with the toolchains: ARM, GCC_ARM, and IAR

NRF52 DK does not connect

Hi
The NRF 52 DK (PCA 10040) s132 board does not work using ARM Mbed environment. The BLE_Battery_Level example sets the device to advertise as BATTERY_LEVEL but when I try to connect to it using my Samsung Galaxy 8+, it just disconnects and the device is not discover-able again. The device works with KEIL examples with latest SDK 15/16. The ARM Mbed uses SDK 11 and firmware 2.0 whereas the latest firmware (SDK 15 v5 works fine). Would it be possible to update the SDK for the ARM Mbed environment for NRF52 DK ?

Thanks
Chandra

Export to Keil

I just tried the HR example using a ST F401 board IBD05A1 peripheral board.
From the CLI, it seems to work fine which is nice.
When I export to uVision 5 and rebuild it however, (i) it does not work and (ii) I notice the LED is flashing faster.
Any ideas?

OOB: BLE_EddystoneService android application not working as in instructions

Installed "Physical Web" application from google apps. Current version is 0.2.1. Looks like it migth not support configuration edit interface anymore or there is some problem that since it does not appear. It also crashed several times on my Samsung J5 when making the scan when mbed device was on. After the crashes it sometimes displayed the mbed OS URL.

BLE_GAPButton: NUCLEO_F746ZG with the ST shield - Fails to compile using mbed-CLI

When compiling NUCLEO_F746ZG with the ST shield using GCC_ARM, ARM, and IAR toolchains, it fails to compile with different errors.

  • GCC_ARM toolcahin fails with:
[Error] main.cpp@22,20: 'BUTTON1' was not declared in this scope
[ERROR] .\source\main.cpp:22:20: error: 'BUTTON1' was not declared in this scope
 InterruptIn button(BUTTON1);
                    ^

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_F746ZG --source . --build .\.build\NUCLEO_F746ZG\GCC_ARM" in "C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton"
  • ARM toolchain fails with:
[Error] main.cpp@22,0:  #20: identifier "BUTTON1" is undefined
[Warning] main.cpp@197,0:  #111-D: statement is unreachable
[ERROR] "./mbed-os/features/FEATURE_BLE/ble/deprecate.h", line 26: Warning:  #1-D: last line of file ends without a newline
".\source\main.cpp", line 22: Error:  #20: identifier "BUTTON1" is undefined
".\source\main.cpp", line 197: Warning:  #111-D: statement is unreachable
.\source\main.cpp: 2 warnings, 1 error

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton\mbed-os\tools\make.py -t ARM -m NUCLEO_F746ZG --source . --build .\.build\NUCLEO_F746ZG\ARM" in "C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton"
  • IAR toolchain fails with:
[ERROR] Command line error: in "--cpu Cortex-M7":
          Invalid processor type: Cortex-M7

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton\mbed-os\tools\make.py -t IAR -m NUCLEO_F746ZG --source . --build .\.build\NUCLEO_F746ZG\IAR" in "C:\Work\OOB\mbed-os-example-ble\BLE_GAPButton"

[OOB_5_4_RC1] Probe not found error in exported IAR project

When exported IAR project is debugged, I got following error dialog.

iar_error

How to reproduce

$ git clone -b oob_test_mbed-os-5.4 https://github.com/ARMmbed/mbed-os-example-ble
$ cd mbed-os-example-ble\BLE_EddystoneService
$ mbed deploy
$ mbed export -m NRF52_DK -i iar

Open BLE_EddystoneService.eww and build the project.
Start debbugging by press [Download and Debug] button.

Conditions

  • IAR Embedded Workbench for ARM version : 7.80.4.12495
  • IAR Embedded Workbench shared components version : 7.5.6.4719
  • DAPLink version v0243 - 0243_sam3u2c_mkit_dk_dongle_nrf5x_0x5000.bin

Button: NUCLEO_F401RE + ST BLUE NRG: 'BUTTON1' was not declared in this scope GCC OoB RC#3

Version: https://github.com/ARMmbed/mbed-os-example-ble/tree/mbed-os-5.1.0-rc3
OS: Mac 10.11.6
Toolchain: GCC_ARM
Target: NUCLEO_F401RE + ST BLUE NRG
Test: Button

Compile: main.cpp
[Error] main.cpp@24,20: 'BUTTON1' was not declared in this scope
[ERROR] ./source/main.cpp:24:20: error: 'BUTTON1' was not declared in this scope
InterruptIn button(BUTTON1);
^

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u /Users/barsza01/devel/mbed/mbed-os-example-ble/BLE_Button/mbed-os/tools/make.py -t GCC_ARM -m NUCLEO_F401RE --source . --build ./.build/NUCLEO_F401RE/GCC_ARM" in "/Users/barsza01/devel/mbed/mbed-os-example-ble/BLE_Button"

[OOB_5_4_RC1] Compile error in BLE_URIBeacon for all toolchain

How to reproduce

$ git clone -b oob_test_mbed-os-5.4 https://github.com/ARMmbed/mbed-os-example-ble
$ cd mbed-os-example-ble\BLE_URIBeacon
$ mbed deploy
$ mbed compile -m NRF52_DK -t ARM
(snip)
[Error] main.cpp@96,0:  #20: identifier "DFUService" is undefined
[Error] main.cpp@96,0:  #20: identifier "dfu" is undefined
[Error] main.cpp@96,0:  #79: expected a type specifier
[ERROR] "./mbed-os/platform/toolchain.h", line 23: Warning:  #1215-D: #warning directive: toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3]
".\source\main.cpp", line 96: Error:  #20: identifier "DFUService" is undefined
".\source\main.cpp", line 96: Error:  #20: identifier "dfu" is undefined
".\source\main.cpp", line 96: Error:  #79: expected a type specifier
.\source\main.cpp: 1 warning, 3 errors

[mbed] ERROR: "python" returned error code 1.
[mbed] ERROR: Command "python -u C:\Users\toywat01\Documents\mbed\oob\mbed-os-example-ble\BLE_URIBeacon\mbed-os\tools\make.py -t ARM -m nrf52_dk --source . --build .\BUILD\nrf52_dk\ARM" in "C:\Users\toywat01\Documents\mbed\oob\mbed-os-example-ble\BLE_URIBeacon"

mbed ls

BLE_URIBeacon (None)
|- mbed-os (3a27568a505b)
`- shields\TARGET_ST_BLUENRG (a5d5d0b55839)

I got same compile error by IAR and GCC_ARM toolchain.

[OOB_5_4_RC1] link errors in exported uvision5 project

When exported uvision5 project is compiled, I got following link errors.

linking...
.\BUILD\BLE_EddystoneService.axf: Error: L6366E: analogin.o attributes are not compatible with the provided attributes .
Object analogin.o contains Build Attributes that are incompatible with the provided attributes.
    Tag_FP_arch = VFPv4 instructions were permitted, but only citing registers D0-D15 (=6)
    Tag_ABI_HardFP_use = This code should execute on the single-precision variant derived from Tag_FP_arch (=1)
    Tag_FP_HP_extension = Use of the optional half-precision extension to VFPv3/Advanced SIMDv1 was permitted (=1)

(snip)

Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 22982 information, 0 warning and 5745 error messages.
".\BUILD\BLE_EddystoneService.axf" - 5745 Error(s), 75 Warning(s).
Target not created.
Build Time Elapsed:  00:01:05

Full log output is here.
mbed-os-example-ble_error_log.txt

How to reproduce

$ git clone -b oob_test_mbed-os-5.4 https://github.com/ARMmbed/mbed-os-example-ble
$ cd mbed-os-example-ble\BLE_EddystoneService
$ mbed deploy
$ mbed export -m NRF52_DK -i uvision5

Open BLE_EddystoneService.uvprojx and build the project.

Conditions

  • MDK-ARM version : uVision V5.22.0.0
  • Pack : NordicSemiconductor.nRF_DeviceFamilyPack.8.3.2
  • Device : nRF52832_xxAA

[OoB_RC1_5.4]: BLEURIBeacon fails to advertise itself. Cannot be detected on Physical web app.

Steps to reproduce:

  1. Clone the example, update to mbed OoB branch. Install Android app. (Using version 0.2.1 - updated from Google)
  2. mbed compile -t ARM -m nRF51_DK
  3. Flash hex file, scan for beacons with the app.

Result:
The target enters config mode and exits after 60 sec but beacon cannot be detected on app.

Detailed description:
Using a generic BLE scanner app, the beacon is first detected in config mode (after reset). After 60 seconds or so, the beacon still is detected in config mode. The Physical web app does not detect any nearby beacons even after >120 sec

Edit: Issue also seen with GCC and IAR compilers.

Could not compile on target NRF52832, When apply debug profile. mbed-os5.8.1

When I apply debug.json only fail. release and develop profile are good.
Toolchain is GCC_ARM.
That is gcc-arm-none-eabi-7-2017-q4-major.
I tried.
cd BLE_LED
mbed compile --target RBLAB_BLENANO2 --toolchain GCC_ARM --profile ./mbed-os/tools/profiles/debug.json

result is.
[Error] sleep.c@74,1: unrecognizable insn:
[ERROR] ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c: In function 'hal_sleep':
./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c:74:1: error: unrecognizable insn:
}
^
(insn 16 15 17 2 (unspec_volatile [
(mem/c:SI (plus:SI (reg/f:SI 105 virtual-stack-vars)
(const_int -4 [0xfffffffffffffffc])) [3 fpscr+0 S4 A32])
] VUNSPEC_SET_FPSCR) "./mbed-os/cmsis/TARGET_CORTEX_M/cmsis_gcc.h":734 -1
(nil))
./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/sleep.c:74:1: internal compiler error: in extract_insn, at recog.c:2311
libbacktrace could not find executable to open
Please submit a full bug report,

Beacon not reported as iBeacon on iOS

Using mbed-os-5.0.1-rc1 tag beacon demo works fine using Android (nRF Master Control Panel), but on iOS is not being detected as iBeacon. Both LightBlue and nRF Connect detect and show it as nRF5x without any more information.

Thermometer change Notify to Indicate?

On the BLE_Thermometer: cannot find where it set the Notify, but it is Notify. If you want to use the nRF ToolBox we need an "Indicate" to follow the thermometer BLE specification. Do not find a clue on mbed where to change this and how to call the class to set this Indicate :-(
Can somebody help me?

BLE Heart Rate Monitor: nRF51-DK - Exported IAR not visible when built

The device does not show up when it has been built in IAR Embedded Workbench, after being exported from mbed-CLI.

  • It builds in IAR Workbench without any errors, but does not appear when put onto the device
  • Cannot see the device when scanning for it in nRF Connect
  • Works fine when compiled using mbed-CLI with the IAR toolchain

Are the BLE examples provided here power efficient?

I wrote my code following the same lines as the examples here.

When tested on a new coin cell battery, in an hour or so, the coin cell battery is completely drained up and the BLE connection becomes unstable.

I would like to know if the code here is power optimized or is there scope for improvement?

The following post describes that ble.waitForEvent() puts the ble into sleep in between events.. But we are not using it anywhere in the examples. Is it taken care of in other API's?

If there is a room for improvement, may be it is a good idea to write a fully power efficient BLE example which will act as reference to writing low power applications.

OOB: BLE_EddystoneServic compile error for NUCLEO-F429ZI

Command: mbed compile -m NUCLEO_F429ZI -t GCC_ARM
Error information:

[ERROR] In file included from .\source\EddystoneService.cpp:17:0:
.\source\EddystoneService.h:21:21: fatal error: ble/BLE.h: No such file or directory
 #include "ble/BLE.h"

OOB: BLE_EddystoneService beacon url configuration cannot be changed in beetle board

Beacon URL cannot be changed with Beetle with Android "nRF Master Control Panel" . With NUCLEO-F401RE and nRF-51dk URL does change.

With working boards "nRF Master Control Panel" configuration interface "Data" sections shows "Value: https:://www.mbed.com" or whatever is configured.

With Beetle when "Data" is read is shows empty value field "Value: "

Also in programs main display URL remains as mbed.com and is not changed to arm.com.

Happend with both online compiler and when compiling locally with ARM compliler.

BLE_GAPButton: nRF52-DK fails to export

When exporting using the IAR, GCC_ARM, and uvision toolchain, the nRF52-DK is reported as not being suported:

$ mbed export -m NRF52_DK -i IAR

Failed:
  * NRF52_DK::iar
Sorry, the target NRF52_DK is not currently supported on the iar toolchain.
Please refer to <a href='/handbook/Exporting-to-offline-toolchains' target='_blank'>Exporting to offline toolchains</a> for more information.

[OoB_5.5-RC2]: nRF52840_DK, ARMCC: Stack error.

Steps:

  1. Clone repo, update to RC2 branch.
  2. mbed compile -t ARM -m nRF52840_DK
  3. Flash BLE_EddystoneService.hex to target.
  4. Reset and run. Open a serial terminal connection to target.

Output on console:

CMSIS-RTOS error: Stack underflow (status: 0x1, task ID: 0x20003714, task name: )
CMSIS-RTOS error: Stack underflow (status: 0x1, task ID: 0x20003714, task name: )

SHA's:
mbed-os-example-ble (fc79579)
|- BLE_EddystoneService\mbed-os (162f80099d94)
|- BLE_EddystoneService\shields\TARGET_ST_BLUENRG (6670a4495aaf)

It however works perfectly fine with DEBUG profile.
mbed compile -t ARM -m nRF52840_DK --profile DEBUG

Edit: Issue also seen with GCC:

CMSIS-RTOS error: Stack underflow (status: 0x1, task ID: 0x200043D8, task name: (null))

And IAR:

CMSIS-RTOS error: Stack underflow (status: 0x1, task ID: 0x20009138, task name: )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.