본문 바로가기

ble_app_uart nrf51822와 usb serial로 통신할 때 예제 소스를 실행하면 pc에서 데이터를 전송할때 데이터 마지막에 \n 문자가 들어가서나 20바이트 이상 보내야지만 휴대폰에 출력된다.1바이트씩 통신하기 위해서는 아래와 같이 수정하면 된다.main.c를 열어보면 void uart_event_handle(app_uart_evt_t * p_event) 함수가 존재한다.123456789101112131415case APP_UART_DATA_READY: UNUSED_VARIABLE(app_uart_get(&data_array[index])); index++; if ((data_array[index - 1] == '\n') || (index >= (BLE_NUS_MAX_DATA_LEN))) { err_code = ble_nus_string_send(&m_nus, ..
ble_app_uart 인디케이터 LED 설정 변경 bsp.c를 열어보면12#define ADVERTISING_LED_ON_INTERVAL 200#define ADVERTISING_LED_OFF_INTERVAL 1800cs블루투스 방송중일때 LED1번이 깜밖이는 속도 조절 하는 부분입니다. 저는 아래와 같이 수정하였습니다.12#define ADVERTISING_LED_ON_INTERVAL 200#define ADVERTISING_LED_OFF_INTERVAL 200cs 또 연결이 완료된 후 LED1이 켜져 있는것을 끄기 위해static uint32_t bsp_led_indication(bsp_indication_t indicate) 함수의 아래 부분을123456case BSP_INDICATE_CONNECTED: LEDS_OFF(LEDS_MASK & ~BS..
시중에 판매중인 모듈 사용하기 시중에 판매중인 nrf51822 모듈을 보면 2개의 크리스탈이 달려있습니다.위 사진처럼 첫번째 모듈은 2개가 달려있는데 2번째와 4번째 모듈은 크리스탈이 하나만 달려있습니다. 크리스탈이 하나이거나 크리스탈 값이 다르면 기본 예제 프로그램이 LED나 버튼 등은 동작하는데 BLE는 동작하지 않을것입니다.이부분은 아래 처럼 수정하면 해결 가능합니다.기본 예제인 ble_app_uart의 한 부분입니다.123456789101112131415161718192021222324/**@brief Function for the S110 SoftDevice initialization. * * @details This function initializes the S110 SoftDevice and the BLE event i..
외부 인터럽트 & 타이머 인터럽트를 이용한 롱버튼 구현 timer 예제 이용해서 수정하였습니다.버튼을 3초이상 누르면 불이켜지고 다시 3초 이상 누르면 불이 꺼집니다.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091#include #include #include "nrf.h"#include "bsp.h" #include "nrf_drv_timer.h"#include "bsp.h"#include "app_error.h" #define LED 22#define BUTTON 16 const nrf_drv_t..
pin change interrupt 123456789101112131415161718192021222324252627282930313233343536373839404142#include "nrf.h"#include "boards.h" #define LED 22#define BUTTON 16 void GPIOTE_IRQHandler(void){ // Event causing the interrupt must be cleared. if ((NRF_GPIOTE->EVENTS_IN[0] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN0_Msk)) { NRF_GPIOTE->EVENTS_IN[0] = 0; nrf_gpio_pin_toggle(LED); }} static void gpio_init(void)..
-Z(IDATA)ISTACK 에러 해결법 segment placement command "-Z(IDATA)ISTACK+_IDATA_STACK_SIZE#08-_IDATA_END", where at the moment of placement the available memory ranges위 에러가 나오면C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\common\cc2540\ti_51ew_cc2540b.xcl위링크 파일을 메모장등으로 열어서 -Z(DATA)VREG+_NR_OF_VIRTUAL_REGISTERS=08-7F위 줄을 -Z(DATA)VREG=08-7F위와 같이 변경하고 저장하면 에러가 해결됩니다.
LED 깜빡이기 123456789101112131415161718#include #include #include "nrf_delay.h"#include "nrf_gpio.h"#include "boards.h" int main(void) { // Configure LED-pins as outputs. nrf_gpio_cfg_output(LED_1); // Toggle LEDs. while (true) { nrf_gpio_pin_set(LED_1); nrf_delay_ms(500); nrf_gpio_pin_clear(LED_1); nrf_delay_ms(500); }}Colored by Color Scriptercs
타이머 인터럽트 예제 blinky_rtx_pca10028을 이용해서 변경한것입니다.rtx는 CMSIS-RTOS를 나타낸다고합니다.1234567891011121314151617181920212223242526272829303132#include #include #include "nrf_gpio.h"#include "bsp.h"#include "cmsis_os.h" //인터럽트 인터벌#define LED_1_INTERVAL 100 void timer1_handler(void const * arg) { //타이머 인터럽트가 발생할때 해야할 일 nrf_gpio_pin_toggle(LED_1);} //타이머 콜백 함수osTimerDef(led_toggle_timer1, timer1_handler); int main(void) {..