This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using RTT viewer and Uart to send ESP8266 AT commands

Hello , 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

Thanks, Shailav

  • Hi, Can you please show me code snippet to implement your suggestions? Thanks, Shailav


  • bool flag = 0;
    on_ble_evt()
    {
        BLE_GAP_EVT_ADV_REPORT:
        flag = 1;
    }
    
    main()
    {
        for
        {
              if(flag==1)
              {
                   flag = 0;
                   uart_loopback_test();
              }
              power_manage();
        }
    }
    

    The interrupt priority can be changed in sdk_config.h, try setting UART_DEFAULT_CONFIG_IRQ_PRIORITY 1

  • Hi, My main challenge is I want to pass the parameters like

    p_adv_report->peer_addr.addr[4], p_adv_report->peer_addr.addr[3], p_adv_report->peer_addr.addr[2], p_adv_report->peer_addr.addr[1], p_adv_report->peer_addr.addr[0] in my function uart_loopback_test();. In my uart_loopback test there is one function to send data for example:

    	    for (uint32_t i = 0; i < 40; i++)
    {
        tx_DATA[i] =  p_adv_report->peer_addr.addr[i],
        while (app_uart_put(tx_DATA[i]) != NRF_SUCCESS);
     }
    	 nrf_delay_ms(10000);
    

    So how should I implement this? Thats why I was trying to call uart_loopback_test in BLE_GAP_EVT_ADV_REPORT. Thanks,

  • Can't you just copy the address to a global array?

  • Hi, I can copy that.I have 2 functions in my main loop: uart_loopback_test(); scan_start(); So when the scan_start(); my code starts scanning nearby devices and it never returns to main function again. So I was trying to call uart_loopback_test(); in BLE_GAPEVT_ADV_REPORT. But unfortunately my uart_loopback_test is not working in BLE_GAPEVT_ADV_REPORT function. I am attaching my main file in question above. Please suggest me changes. Thanks

Related