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

When use the template_project(Which is in peripheral) which working only on debug conditions, without debug conditions which is not working

Dear sir,

When use the template project(Which is in peripheral) for UART tx & rx is not working in without debug, but if i use base project(Like uart) file it is working as perfect, kindly provide the solutions it is very urgent.

Note: I'm using SDK ver-17

Regards

Chandru.A

  • Have you looked at the differences between the debug and non-debug configurations?

    Are they different optimisation levels?

    If changing optimisation levels breaks your code, it's usually a sign that the code is flawed - eg, missing necessary 'volatile' ...

    Note that you can still use the debugger on a "non-debug" build ...

  • Hi,

    Here it is my code,

    /**************************************************************************/
    /*!
    * \file main.c
    * \brief:
    *
    * nRF52840 Using UART TX & RX in polling method communications
    *
    * \author CHANDRU.A
    * \date 10th-April-2021
    */
    /**************************************************************************/

    #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

    //uint8_t * tx_data ="Welcome\n\r";
    //uint8_t * tx_data ="ack by rx\n\r";

    uint8_t tx_data[]="Hello world";
    uint8_t size=sizeof(tx_data)/sizeof(tx_data[0]);

    uint8_t rx_data[UART_RX_BUFF_SIZE];
    char flag=0;
    void uart_err_handle(app_uart_evt_type_t *p)
    {

    }
    int main(void)
    {
    uint32_t err_code;
    bsp_board_init(BSP_INIT_LEDS); // initialize 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("UART COMMUNICATIONS TEST\r\n");

    while(true)
    {
    uint8_t cr;
    static uint8_t index = 0;


    for (uint32_t i = 0; i < strlen(tx_data); i++) // tx_data conatains the welcome message
    {
    while (app_uart_put(*(tx_data+i)) != NRF_SUCCESS); // transimit to PC this NRF success will be wait for '1' byte transmitted.

    // printf("\r\n Transmitted=%c\n\r",tx_data[i]);
    nrf_delay_ms(100);
    }
    printf("\n");
    }

    // while(app_uart_get(&cr) != NRF_SUCCESS); // wait here until it receives a char from pc

    }

    Which is working in uart project file folder, but which is not working when I use templet project folder

    what is the issue sir?

    Regards

    Chandru.A

  • so what debugging have you done to find the issue?

  • chandru jasi said:
    Which is working in uart project file folder, but which is not working when I use templet project folder

     Can you post some screenshots to help show what's not working?

    Best regards,

    Vidar

  •  Dear sir,

    good day!!

    It is fixed 

    When i comment this printf() statements it is working expected.

    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("UART COMMUNICATIONS TEST\r\n");

    Thanks for your support sir!!

    Regards

    Chandru.A

Related