:::: MENU ::::
Posts tagged with: nrf

BLE over UART throughput

Adafruit사의 Feather m0 bluefruit 보드의 UART to BLE Throughput 측정. PC측에는 nRF Connect 앱인 BLE 앱을 사용함.

이 앱에서 연결을 하고 데이터를 수신한다. 보내는 측의 로그를 확인하면 대략 4.71KB/S 정도 나오는데, 핸드폰 앱에서 확인해보니 4KB/S 정도 나옴.

성능도 중요하지만 무선이므로 데이터 손실이 없을 수 없으며, 찾아보니 그 이유중 하나는 다음과 같다. (출처 – https://interrupt.memfault.com/blog/ble-throughput-primer)

Counterintuitively, even though the Link Layer of BLE is reliable, packet loss is still something to be concerned about for BLE. This is because many many stacks drop data within the software stack. For example, BLE messages get queued up in the stack and when the heap holding the packets runs out of memory, some stacks will silently drop data. This means if you are sending large amounts of data over BLE you will usually want to add some sort of reliability layer that can detect & retransmit messages when data is dropped. The way this is implemented can have sizeable impacts on throughput. For example, if you have designed your own protocol on top of L2CAP or GATT and every message sent requires an acknowledgement before another message is sent, you’ll typically wind up adding a connection interval worth of latency getting the data sent out, effectively halving the max throughput which can be achieved.

즉 BLE Link Layer는 reliable하지만 BLE stack에서 힙의 메모리가 부족할 때 일부 스택은 자동으로 데이터를 삭제된다. 따라서 상위레벨의 프로토콜에서 재전송 기법을 사용해야 함.

Mitigation of Data Packet Loss in Bluetooth Low Energy-Based Wearable Healthcare Ecosystem 이 문서의 내용 참고

 


Mac OSX에 nRF52 개발 환경 설정하기

2년전에 작업한 Mac OS X에 nRF51 개발 환경 설정하기 포스팅을 보면서 nRF52 환경을 설정하다가 달라진 점이 있어서 다시 쓰게된 포스팅.

개념은 다음과 같다. 1) gcc 와 툴체인 설치 2) OSX용 nRF5x Command Line Tools 설치 3) SDK 설치.  이 과정에서 gcc 실행파일 위치를 bash_profile에 입력하고, SDK의 gcc 컴파일 설정을 이에 맞게 하면 된다.

gcc 와 툴체인 설치

여기에서 최신 버전 다운로드 및 다음과 같이 압축을 푼다. 설치 위치는 크게 중요하지 않다. 만약 이전에 설치를 했을 경우 ~/usr/local/bin 아래 설치를 했을 수도 있음.

$ mkdir /usr/local/
$ tar -xjf gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2 -C /usr/local/

nRF5x Command Line Tools 다운로드 및 설치

위 gcc경로와 nrfjprog, mergehex의 경로를 bash_profile 입력한다.

export PATH=/usr/local/gcc-arm/gcc-arm-none-eabi-8-2019-q3-update/bin:$PATH
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/nrfjprog:$PATH

SDK 다운로드 및 설치

components/toolchain/gcc/Makefile.posix 파일을 다음과 같이 수정한다. GNU_VERSION은 다음과 같이하면 알 수 있다.

$ arm-none-eabi-gcc –version

GNU_INSTALL_ROOT := /usr/local/gcc-arm-none-eabi-8-2019-q3-update/bin/
GNU_VERSION := 8.3.1
GNU_PREFIX := arm-none-eabi

컴파일 및 다운로드

example 폴더의 예제를 컴파일 및 다운로드 해 본다. 참고로 PCA10040 보드가 nRF52832칩을 사용한 보드이니 이 에제를 사용해야 함.

nRF52832-MDK를 사용할 경우에는 nRF SDK를 nRF52832-MDK를 설치한 위치에 nrf_sdks 아래 copy를 하고, make 파일을 수정해야 한다. 그리고 다운로드를 위해 pyocd도 설치해야 함.

$ make
$ make flash

참고 : https://wiki.makerdiary.com/nrf52832-mdk/nrf5-sdk/