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