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

Unable to communicate SIM800L Core Board with nRF52 through UART

hi, i have a SIM800L Core board which is using UART protocol to communicate or to send At commands. so that i am using BLE_APP_UART example to set AT commands to SIM800L.

i made connections like this: 1). Connected PCA10040s TX pin to SIM800L RX pin. and PCA10040s RX pin to SIM800L TX pin.

2). and supplied 3.8v to SIM VCC and GND.

3).connected PCA10040 boards GND to SIM800L GND.

4).now i am compiled ble_app_uart code in nRF52 dk board.

5).then i connected to nrftool box app.

then when i open Termite it is showing empty screen. but ble connected to nRF52 board. when i send AT through App, the app showing AT sent but no response.

Other Scenario:- if i connected Vdd to VCC of the SIM800L termite is showing UART connected, and if i Transmit AT command on through termite or nRFtoolbox it is replying sam String AT.

is this is correct way to communicate with SIM800L using Ble_app_uart or Uart application.

if i am using these examples if send any At strings recieving same At strings. like Loop back.

if it is not correct way how to transmit At commands using UART example.

Thank you,

here is board how i made connections. image description

and here is my code

void uart_putstring(const uint8_t * str) {

uint32_t err_code;

uint8_t len = strlen((uint8_t *)str);

for (uint8_t i = 0; i < len; i++) {

    err_code = app_uart_put(str[i]);

    APP_ERROR_CHECK(err_code);

}

}

void dial_number(const uint8_t * number) {

char cmd_string[255];

cmd_string[0] = '\0';

sprintf(cmd_string, "ATD%s;\r", number);

uart_putstring((uint8_t*)cmd_string);

}

/**

  • @brief Function for main application entry. */

int main(void)

{

LEDS_CONFIGURE(LEDS_MASK);

LEDS_OFF(LEDS_MASK);

uint32_t err_code;

const app_uart_comm_params_t comm_params =

  {

      RX_PIN_NUMBER,

      TX_PIN_NUMBER,

      RTS_PIN_NUMBER,

      CTS_PIN_NUMBER,

      APP_UART_FLOW_CONTROL_ENABLED,

      false,

      UART_BAUDRATE_BAUDRATE_Baud9600

  };

APP_UART_FIFO_INIT(&comm_params,

                     UART_RX_BUF_SIZE,

                     UART_TX_BUF_SIZE,

                     uart_error_handle,

                     APP_IRQ_PRIORITY_LOW,

                     err_code);

APP_ERROR_CHECK(err_code);
uart_putstring((uint8_t*)"AT\r");
dial_number((uint8_t*)"8919242248");

}

  • You are making the all-too-common mistake of trying to do too much all at once. As you are uncertain about how to get the basic UART wired communication working, you should concentrate just on that at first - don't complicate the issue by trying to do Bluetooth as well! You also need to be sure that you have a reliable and usable way to monitor the comms between the nRF and SIM800. The way to proceed is:

    1. Forget the nRF52. Just make sure that you can send command to the SIM800, and read its responses, using a PC terminal. Make sure that you understand the commands that you will need to send, and the responses that you will get. Pay particular attention to line ending characters (it helps if you have a terminal or monitor that can display raw hex).
    1. (see above)

    2. The trouble with the nRF52 (and nRF51) is that it has only 1 UART. So, once you have tied this to your SIM800, you have no alternative for debug output. Therefore you will need to learn to use SWO. See devzone.nordicsemi.com/.../

    3. Next, just connect the nRF52 to a PC terminal - forget the SIM800. Get your nRF52 reliably sending commands to the PC terminal, and accepting responses that you send from the terminal. Use SWO so that you have visibility of what is being sent & received.

    4. Now (and only now) connect the nRF52 to the SIM800. Verify that sending commands from the nRF52 to the SIM800, and receiving the responses works solidly.

    5. Now (and only now) you are in a position to start adding Bluetooth ...

  • hi tq, its working fine but when i send SMS i stuck with CTRL+Z. i even tried (char)26 and also 0X1A.

    here is my code: ////Message

    uart_putstring((uint8_t*)"AT\r");
    nrf_delay_ms(2000);
    uart_putstring((uint8_t*)"AT+CMGF=1\r");
           nrf_delay_ms(2000);
    uart_putstring((uint8_t*)"AT+CMGS=\"8919242248\"\r");
       nrf_delay_ms(2000);
       uart_putstring((uint8_t*)"test\r");
              nrf_delay_ms(2000);
              app_uart_put((char)0x1A);   ///used (uint8_t) 26 also but no response..
                     nrf_delay_ms(1000);
    

    if run this terminal is showing this:

    AT

    AT+CMGF=1

    AT+CMGS="8919242248"

    test

    ·rx_data: AT

    OK

    AT+CMGF=1

    OK

    AT+CMGS="8919242248"

    test

  • You are making the all-too-common mistake of ignoring the replies from the module.

    That's like trying to drive down a busy street with your eyes closed, turning the steering wheel only at set times ...

Related