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
  • 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. 

Children
  • 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 .  

  • Thank you for formatting your code, it is now much more comprehensible.

    ps_anu said:
    I am very clear , at the initially  conversion itself i have mentioned about my connections. 

    Sorry for asking you about this so many times, but it is hard to be certain that we are talking about the same thing without a connection diagram, and when the answer is fractured in different replies. Your initial connection description does not include pin numbers, and you written reply contradicts itself when you use "----" to both symbolize a connection and then a descriptor in the very next sentence. I am just making sure I understand you correctly, so I may help resolve your issue.

    ps_anu said:

    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 . 

    Good, this is helpful.
    Which error do you get, when you step into line 628?
    Could you confirm for me, does the application function as expected for a few seconds - advertising, connecting in nrf_toolbox and UART printout - before it suddenly disconnects, and no longer prints anything on UART. Is this what is happening?

    Since you are using a while(1) loop in you main, you will never run your idle_state_handle.
    Could you relax this loop, and instead call app_uart_put in one of the callbacks, and let me know if this solves your problem?

    Best regards,
    Karl

Related