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

How to send sensor data using AT commands to a device using Uart in segger embedded studio

Hi, I am new to NRF and segger embedded studio.

So I want to send temperature sensor data connected with nrf52840 DK to the Murata1_SC  device using UART.

The data will be sent using AT Commands.

So how to send AT Commands in Segger embedded studio.

Thank you for the help in advance.

Parents
  • I have tested uart example, but i don't know how to send commands

    Here is my code


    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include "app_uart.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "nrf.h"
    #include "bsp.h"
    #include "nrf_uart.h"

    #define UART_TX_BUFF_SIZE 128
    #define UART_RX_BUFF_SIZE 128

    #define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED

    void uart_err_handle(app_uart_evt_type_t * p)
    {

    }

    int main(void)
    {
    uint32_t err_code;

    bsp_board_init(BSP_INIT_LEDS);

    const app_uart_comm_params_t com_params =
    {
    RX_PIN_NUMBER,
    TX_PIN_NUMBER,
    RTS_PIN_NUMBER,
    CTS_PIN_NUMBER,
    UART_HWFC,
    false,
    NRF_UART_BAUDRATE_115200
    };

    APP_UART_FIFO_INIT(&com_params, UART_RX_BUFF_SIZE, UART_TX_BUFF_SIZE, uart_err_handle, APP_IRQ_PRIORITY_LOWEST, err_code);

    APP_ERROR_CHECK(err_code);

    printf("Hello PC from Nordic Device!!!\r\n");

    while(true)
    {
    uint8_t cr;

    while(app_uart_get(&cr) != NRF_SUCCESS);//wait here for the character from pc
    if(cr == 'o')
    {
    bsp_board_leds_on();
    printf("Leds are ON\r\n");
    }
    if(cr == 'f')
    {
    bsp_board_leds_off();
    printf("Leds are OFF\r\n");
    }
    }
    }

Reply
  • I have tested uart example, but i don't know how to send commands

    Here is my code


    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include "app_uart.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "nrf.h"
    #include "bsp.h"
    #include "nrf_uart.h"

    #define UART_TX_BUFF_SIZE 128
    #define UART_RX_BUFF_SIZE 128

    #define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED

    void uart_err_handle(app_uart_evt_type_t * p)
    {

    }

    int main(void)
    {
    uint32_t err_code;

    bsp_board_init(BSP_INIT_LEDS);

    const app_uart_comm_params_t com_params =
    {
    RX_PIN_NUMBER,
    TX_PIN_NUMBER,
    RTS_PIN_NUMBER,
    CTS_PIN_NUMBER,
    UART_HWFC,
    false,
    NRF_UART_BAUDRATE_115200
    };

    APP_UART_FIFO_INIT(&com_params, UART_RX_BUFF_SIZE, UART_TX_BUFF_SIZE, uart_err_handle, APP_IRQ_PRIORITY_LOWEST, err_code);

    APP_ERROR_CHECK(err_code);

    printf("Hello PC from Nordic Device!!!\r\n");

    while(true)
    {
    uint8_t cr;

    while(app_uart_get(&cr) != NRF_SUCCESS);//wait here for the character from pc
    if(cr == 'o')
    {
    bsp_board_leds_on();
    printf("Leds are ON\r\n");
    }
    if(cr == 'f')
    {
    bsp_board_leds_off();
    printf("Leds are OFF\r\n");
    }
    }
    }

Children
Related