본문 바로가기

Nordic/nRF51

(15)
[nRF51822 xBee EVM] Arduino BLE Keyboard Test BLE테스트를 위한 기본 설정은 [nRF51822 xBee EVM] Arduino BLE UART Test 를 참고로 해서 설정해 주면 되고 BLE KeyBoard 예제를 구동하면 #include #include // define pins (varies per shield/board) #define BLE_REQ 6 #define BLE_RDY 7 #define BLE_RST 4 //#define ANDROID_CENTRAL // create peripheral instance, see pinouts above BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST); BLEKeyboard bleKeyboard; voi..
[nRF51822 xBee EVM] Arduino BLE UART Test nRF51822의 BLE기능을 Arduino에서 사용하기 위해 소프트디바이스 설정과 BLE 라이브러리 설치를 해야 한다. 소프트디바이스 설정은 [nRF51822 xBee EVM] BLE 테스트 - BLE UART(IAR) 를 참고 해서 설정하고 Arduino IDE에서 사용여부를 설정해 주면 된다. BLE 라이브러리는 BLEPeripheral 을 설치 해 주면 된다. 기본 으로 제공되는 BLE UART 예제를 수정해서 앱에서 전송되는 UART 값에 따라 LED On/Off 하는 예제를 작성해 보았다. #define PIN_LED1 13 // create ble serial instance, see pinouts above BLESerial BLESerial(BLE_REQ, BLE_RDY, BLE_RST)..
[nRF51822 xBee EVM] Arduino 테스트 - I2C VL53L0X, PCF8574 #include #include #define PCF_8574_ADDR 0x20 void write8(uint8_t Address, uint8_t Value) { Wire.beginTransmission(Address); Wire.write(Value); Wire.endTransmission(); } uint8_t read8(uint8_t Address, uint8_t Value) { uint8_t ret; Wire.beginTransmission(Address); Wire.write(Value); Wire.endTransmission(); Serial.println("1"); Wire.requestFrom(Address, (uint8_t)1); ret = Wire.read(); return ret; }..
[nRF51822 xBee EVM] Arduino 테스트 - SSD1306 OLED 테스트 [xBee-S EVM] 보드를 이용하면 I2C 인터페이스의 OLED를 연결해서 테스트 가능하다 Arduino에서 SSD1306 OLED제어를 위한 라이브러리를 사용하면 쉽게 LCD에 출력 할 수 있다. SSD1306 라이브러리 기본예제를 수정해서 간단히 OLED에 출력하는 예제를 구동하면 정상 동작하는 것을 확인 할 수 있다. #define LED_PIN1 13 #define PCF_8574_ADDR 0x20 #include #include #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an S..
[nRF51822 xBee EVM] Arduino 테스트 - I2C PCF8574 Test nRF51822의 I2C 테스트를 위해 가장 쉽게 테스트 해 볼 수 있는 I2C GPIO확장 모듈 [PCF8574 SSM EVM] 보드를 테스트 해 보았다. [nRF51822 xBee EVM] 보드의 I2C 는 아래와 같이 할당되어 있다. SCL -> IO21 SDA -> IO20 Arduino에서 PCF8574 제어를 위한 기본 코드를 실행하면 정상적으로 동작하는것을 확인 할 수 있다. #include #define LED_PIN1 13 #define PCF_8574_ADDR 0x20 void write8(uint8_t Address, uint8_t Value) { Wire.beginTransmission(Address); Wire.write(Value); Wire.endTransmission(); }..
[nRF51822 xBee EVM] - Arduino Serial, ADC Test [nRF51822 xBee EVM] 보드의 IO2는 [xBee EVM]보드의 표준 핀맵중 ADC에 할당되어 있다. Arduino 기본 예제를 이용해서 ADC 테스트 결과 값이 이상하게 출력된다. 핀맵 설정에 문제가 있을것 같은데... 뭐가 문제일까? variant.h 파일의 ADC 핀맵 정의를 보니 IO2가 PA1에 할당이 되어 있다. #define PIN_A1 (2) // P0.02 그래서 소스코드에서 ADC 핀설정을 A1으로 하니 nRF51822의 ADC값이 정상적으로 출력 되는것을 확인 할 수 있다. #define LED_PIN1 13 #define LED_PIN2 14 const int analogInPin = A1; int sensorValue = 0; void setup() { pinMode(..
[nRF51822 xBee EVM] - Arduino 성능 측정 nRF51822는 16Mhz로 구동되는 Cortex-M0 코어로 Arduino에서 GPIO 제어 속도를 측정해 보았다. 우선 Arduino에서 제공되는 기본 GPIO 제어 함수로 테스트 해 보면.. #define LED_PIN1 13 void setup() { Serial.begin(115200); pinMode(LED_PIN1, OUTPUT); } void loop() { digitalWrite(LED_PIN1, 1); digitalWrite(LED_PIN1, 0); } 1.8us로 상당히 느리다. GPIO를 레지스터로 직접 제어 해보자 GPIO 직접 제어 함수가 어디에 정의 되어 있을까? digitalWrite() 함수를 보면 아래와 같이 제어 하고 있다. void digitalWrite( uint3..
[nRF51822 xBee EVM] - Arduino Board 만들기 [xBee EVM] 보드는 ESP32 Arduino 확장 테스트 보드를 이용하여 쉽게 Arduino 보드로 제작 가능하도록 설계 하였다. Arduino IDE에서 nRF5x 를 보드 매니저 추가 하기 위해 하기 링크를 추가 해 주어야 한다. https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json 보드 매니저에서 nRF5 를 검색하면 Arduino nRF5 Board를 설치 할 수 있다. 보드 파일이 추가 되었다면 보드를 "Generic nRF51" 로 설정하고 하면 된다. [nRF51822 xBee EVM] 보드에 실장되어 있는 LED(IO13, 14)를 제어 해 보자 #define LED_PIN1 13 #define LED..

반응형