This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

i want to send the data to esp8266 via rx,tx

hi...  I am working on nRF52832 . nRF52832 ,RX TX is connected to the esp8266 of tx,rx . i want to send the data from nRF52832 TO ESP8266 via uart . which function can i use ? printf or app_uart_put . how to send ?   my connections    suggest me

nRF52832       esp8266

RX                 TX

TX                 RX

GND             GND 

Parents Reply
  • Hi,

    This is hard to say, based on the information you have provided.

    Could you tell me the following:
    - Are you working on a development kit? Which pins are you using for your UART?
    - Which SDK version are you using?
    - Do you mean that you are making modifications to the UART example i linked earlier, or that you are using the app_uart library?
    - If you are working out of the ble_uart_example, could you tell me which modifications you have made?
    - What do you mean by freeze condition? Are you able to see where the application freezes?

    Please provide the answers to the aforementioned, so I may better help you.

    Best regards,
    Karl

Children
  • i am working on development kit , i am using same rx and tx pins .. RX 8 PIN , TX 6 pin .  

    sdk 15.2 version.  just i am sending the data to uart using app_uart_put

    static char lora[3]="azi";
    
    
    // in the main loop i am adding the below code 
        while(1)
        {
    
        for(int k=0;k<3;k++)
            {
                  err_code = app_uart_put(lora[k]);
           
    
                }
     printf("\n");
                nrf_delay_ms(500);
                 
                
    }
    

    3. Freezing is the sense , my device is not advertising when i connect this. 

    4. with the same code i worked with arduiino nano is worked fine. 

  • You did not answer whether you are working out of an example or not.
    I highly recommend that you start with an example provided in the SDK, for example the BLE UART example, and make modifications to it as needed.

    ps_anu said:
    just i am sending the data to uart using app_uart_put

    You will need to initialize the UART either way.
    If you want to see the device advertising, then you also need to initialize and enable the radio(which there are no mention of in the code).

    ps_anu said:
    3. Freezing is the sense , my device is not advertising when i connect this. 

    What do you mean by "connect this". Is your device advertising as expected before you make the physical UART hardware connection, but stops once you connect it?
    Please be specific.
    Are you developing using Segger? In that case, you can debug the application by jumping through the code line-by-line. This would highlight where the application stops.

    ps_anu said:
    4. with the same code i worked with arduiino nano is worked fine. 

    What do you mean by this. Do you mean that the code you have posted above works on your other devices?
    Based on the very few lines you posted, all I can say is that you are not initializing the UART(or anything else, for that matter).
    The sparse code you posted will neither compile or run.

    It would be beneficial if you could share the entire source code, so I better can understand where you might be going wrong.

    I am looking forward to resolving this issue together!

    Best regards,
    Karl

  •  am sorry , yes i have modified the ble_app_uart example . Here is the zip file ,, please have a look . i am directly connecting the esp8266 to nRF52832 development kit using jumper wires . RX----TX , TX----RX, GND ---GND 

    RX --- 8 PIN IN NRF52832 , tx ----6 pin in nrf52832 . i checked the connections everything is fine. 

    7532.main.zip 

  • It is no problem at all. Thanks for sharing the source code.
    These are my initial thoughts, when looking over the code:

    - For readability and debugging, you should be consistent with your indention and remove all the comments and magic numbers floating around.

    - Your main code is very cluttered and hard to read. You call functions multiple times, and it is unclear what you are trying to achieve from the code alone.

    As a general advice to you, it will make all your future work easier(for your own sake) if you make sure your code is formatted properly. It makes it easier to identify bugs, and to understand what is going on in general.

    ps_anu said:
    RX --- 8 PIN IN NRF52832 , tx ----6 pin in nrf52832 . i checked the connections everything is fine. 

    By this, do you mean that the  ESP TX pin is connected to the nRF pin 8 RX pin?
    The 8 pin on the nRF is the RX pin, and the 6 pin is TX, by default. From the tx ----- 6 pin line, it seems you might have connected them in opposite. Could you try to connect them the other way around?
    What do you mean when you say that you checked the connections everything is fine?

    Could you tell me where in the code your application stops, do you make it to the while loop?
    I still have not understood what you mean when you say that your code freezes when you connect UART.

    Best regards,
    Karl

  • 4073.main.zip

    look at the above code , now it is clear and neat . I am very clear , at the initially  conversion itself i have mentioned about my connections. 

    ESP8266    nRF52832 

    RX                TX

    TX                RX

    GND            GND 

    i tried using debugger , i am getting   NRF_BREAKPOINT_COND; , when i step into uart_init , i am getting the error when i reach the  line  628 a  APP_ERROR_CHECK(err_code); 

     i can able to connect to the device using nrf_toolbox app , i am receiving the data for few secs , after that i am getting connection lost .  

Related