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

Unable to receive UART response when combined the NUS example with custom service central example

Hi,

I am using a central example to scan the peripheral and connects to it. I get data through notifications in bulk. That works fine. Then in order to add support to FONA808 module, I need to have UART communication which I have established using NUS peripheral example (because that uses UART). Both of the examples work fine when I use them separately.

Now when I have combined NUS code (without use of peripheral) inside the central example, I first got into problem of NO_MEMORY(err_code=0x04) issue because I was adding 2 services (Custom & NUS). I just can live without custom service on central so I just commented that out and now I don't have that issue. I am just having NUS(1) service in my code (although I also don't need it).

However, the problem in this combined code is that:

NUS service is added successfully, UART is initiated successfully, pins assignment is same as in working NUS example, data bits are transmitted serially through the following code:

for(int i=0;i<strlen(AT_cmd);i++)		
{
    while(app_uart_put(AT_cmd[i]) != NRF_SUCCESS);
}

Since this code does not halt inside the while loop, so (I am assuming that)  the data bits are being transferred successfully (please correct me if I am wrong, do I need to see that on oscilloscope?).

But after this, I am expecting response from FONA808 which I never receive and I am stuck in loop waiting for the response forever.

Just to mention again that FONA808 works fine with NUS-standalone code (when not mixed with central code), so I am sure FONA808 module is working fine and the Tx/Rx pins are the same in the combined code.

Can anyone think of possible reasons for this problem? I will be obliged if someone can give me a hint to debug why the serial communication not working well in my situation.

Thanks

Parents
  • UPDATE:
    I got the issue resolved. The exact reason, I am still unsure.

    The issue was that I was using app_uart.c in the project which was not working fine.

    While I was using app_uart_fifo.c in the project which was working fine.

    Since both of these files, I guess, uses same nomenclature of the APIs, so I could not point it out.

    Once I started using app_uart_fifo.c and app_fifo.c in the combined project, the issue was resolved. NRF now can hear back on UART and the program is working as expected.

    Still, I have one question in mind, why???

Reply
  • UPDATE:
    I got the issue resolved. The exact reason, I am still unsure.

    The issue was that I was using app_uart.c in the project which was not working fine.

    While I was using app_uart_fifo.c in the project which was working fine.

    Since both of these files, I guess, uses same nomenclature of the APIs, so I could not point it out.

    Once I started using app_uart_fifo.c and app_fifo.c in the combined project, the issue was resolved. NRF now can hear back on UART and the program is working as expected.

    Still, I have one question in mind, why???

Children
No Data
Related