I am using sdk12.2 and pca10028. I have implemented rtt viewer so that I dont need uart to debug or to print something. I am using uart to send AT commands to esp8266. I have tested individually and my uart code can send AT commands and I am getting response back.
Now I am combining this code with ble_app_uart_c(central ) for scanning nearby ble devices.
scan function - New Text Document (3).txt.
Uart_loopback_test - New Text Document (3).txt
Uart_terminal - uart_terminal.PNG
RTT_Terminal - rtt_terminal.PNG
main.c - New Text Document (3).txt
Have you tried to debug to figure out why your scanning stops? Do you get an error somewhere that resets the device? This might give some insight.
I figured out the challenge. I am actually trying to scan the nearby ble devices using the code ble_app_uart_c . Now I want to send this data through esp8266 using at commands. Now unfortunately nrf51822 has only 1 uart so I am using rtt viewer to see the data of scan devices. So the left uart I am using now to send AT commands to esp8266.
Now my challenge is when I am using the function of uart in function of scan response is attached in question above.
I am not getting output as expected.
Although I am successful in sending data through uart to Esp8266 wifi module.
For your reference I am attaching the uart code for esp8266 above in question.
Please suggest me changes.
Ok. So what do you get? Have you tried to debug? Have you checked if you get any errors?
I am not getting errors. I am attaching screenshot of the function and output from uart as well as rtt viewer above in question. My function call uart_loopback_test() is not getting executed when I am calling this in case BLE_GAP_EVT_ADV_REPORT: I want to send the mac address, rssi and UUId via esp8266 to server.
Maybe this is happening because you are calling it from interrupt context? Does it work if you set a flag when you get the BLE_GAPEVT_ADV_REPORT and call uart_loopback_test() from main instead? Or you could try to increase the interrupt priority of the uart?