how can nrf51822 make 2.4G communication and BLE communication arbitrary switch?
how can nrf51822 make 2.4G communication and BLE communication arbitrary switch?
Sligthly old blog post, but in principle should still be valid:
https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/running-micro-esb-concurrently-with-ble
I got idea for switching between BLE and 2.4GHZ.But when i was disabled to softdevice using "sd_softdevice_disable()",the program come in "while (loop);". If i want to close the softdevice, what am i going to do? My idea is this code for switching between BLE and 2.4GHz.
nrf_gpio_cfg_output(LED_BLE); //ble±êÖ¾ nrf_gpio_pin_write(LED_BLE, 0); //³õʼ״̬µçƽÀµÍʹ֮²»ÁÁ nrf_gpio_cfg_output(LED_TXS); //2.4G±êÖ¾ nrf_gpio_pin_write(LED_TXS, 0); //³õʼ״̬µçƽÀµÍʹ֮²»ÁÁ nrf_gpio_cfg_input(switch_24toble,NRF_GPIO_PIN_NOPULL); ble_stack_init(); ble_app_cfg_start(); // Enter main loop. for (;;) { pinvalue = nrf_gpio_pin_read(switch_24toble); if (pinvalue == 1) { running_mode = BLE; } else { running_mode = GHZ; } power_manage(); if (running_mode != previous_mode) { previous_mode = running_mode; if (running_mode == BLE) { AppTx_stop(); //Í£Ö¹·¢ËÍ£¬¿ªÊ¼ble ble_stack_init(); ble_app_cfg_start(); } else if (running_mode == GHZ) { //ble_app_cfg_stop(); ble_stack_stop(); //Í£Ö¹ble£¬×¢Òâֹͣ˳Ðò£»¿ªÊ¼2.4GHZ esb_tx_init(); //³õʼ»¯·¢ËÍÅäÖà ret = AppTx_Send((uint8_t *)buf,5); //·¢ËÍÒ»Ö¡¹Ì¶¨Ö¡£¬²âÊÔÓà if (ret < 0) { ret = 0; } } void ble_stack_stop(void) { uint32_t err_code; err_code = softdevice_handler_sd_disable(); APP_ERROR_CHECK(err_code); } uint32_t softdevice_handler_sd_disable(void) { uint32_t err_code = sd_softdevice_disable(); #if 1 if (err_code == NRF_SUCCESS) { m_softdevice_enabled = false; nrf_drv_clock_on_sd_disable(); } #else m_softdevice_enabled = !(err_code == NRF_SUCCESS); #endif return err_code; }
"2.4GHz" is just a frequency
BLE operates at 2.4GHz
So "switching between BLE and 2.4GHZ" means nothing.
You mean, "switching between BLE and a proprietary protocol"
"2.4GHz" is just a frequency
BLE operates at 2.4GHz
So "switching between BLE and 2.4GHZ" means nothing.
You mean, "switching between BLE and a proprietary protocol"
yes,I know the example of "\examples\multiprotocol\ble_app_gzll",but i have some troubles when i transplant to my project of "ble_uart_app".
// Enter main loop. for (;;) { power_manage(); //pinvalue = nrf_gpio_pin_read(switch_24toble); //pinvalue = 0 if (pinvalue == 1) { running_mode = BLE; } else { running_mode = GHZ; } if (running_mode != previous_mode) { previous_mode = running_mode; if (running_mode == BLE) { AppTx_stop(); ble_stack_init(); ble_app_cfg_start(); } else if (running_mode == GHZ) { //ble_app_cfg_stop(); ble_stack_stop(); esb_tx_init(); ret = AppTx_Send((uint8_t *)buf,5); if (ret < 0) { ret = 0; } if (TxRxPacket.TxFlage == 1) { TxRxPacket.TxFlage = 0; // Toggle one of the LEDs. nrf_gpio_pin_write(LED_TXS, 1); nrf_delay_us(100000); nrf_gpio_pin_write(LED_TXS, 0); nrf_delay_us(100000); } } }
first,the code dehind of "power_manage()" is not running when the "power_manage();"has executed. when i put him somewhere else the softdevice is not close(sd_softdevice_disable() running will lead to program go into "while (loop);" in the "app_error.c").