Device reset happening and i can't able to upload the code

Hello,

In my project i am using  nrf52840 with my custom board and to upload the code through NRF_CONNECT application with soft device its uploading properly but with  segger emmbedded its giving some error like this .please have look and let me know what is the problem.

after this i have add DEBUG in preprocessor definition and i got this

thank you.

  • Hi

    I think you have implemented the two UARTs correctly, and as long as you declare different pins for the two connected devices, you should be able to receive and transmit the data over BLE with the ble_nus_data_send() function. Some modifications to send the data from both UART instances might be necessary depending on where you store this data.

    Best regards,

    Simon

  • Hello Simonr,

    thanks for the reply, i have declare the two UART pins and nothing happens even BLE advertising was stop. the uart_init() is look like this 

    #define RX_PIN0 NRF_GPIO_PIN_MAP(0,9)
    #define TX_PIN0 NRF_GPIO_PIN_MAP(0,10)
    #define RX_PIN1 NRF_GPIO_PIN_MAP(1,11)
    #define TX_PIN1 NRF_GPIO_PIN_MAP(0,12)
    
    
    static void uart_init(void)
    {
        uint32_t                     err_code1;
        app_uart_comm_params_t const comm_params1 =
        {
            .rx_pin_no    = RX_PIN_NUMBER,
            .tx_pin_no    = TX_PIN_NUMBER,
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
         uint32_t                     err_code2;
       app_uart_comm_params_t const comm_params2 =
        {
            .rx_pin_no    = RX_PIN1,
            .tx_pin_no    = TX_PIN1,
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
        APP_UART_FIFO_INIT(&comm_params1,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code1);
        APP_ERROR_CHECK(err_code1);
    
         APP_UART_FIFO_INIT(&comm_params2,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code2);
        APP_ERROR_CHECK(err_code2);
    }

    so what is the problem when i am trying to print some messages also not happening. is that declaring two UART's is right.??

    thank you.

  • Hi

    Where have you connected these pins to? What are you expecting to see printed and what behavior are you seeing? You'll have to debug in order to find out where the application is stopping and what error/return code it is returning for you.

    Best regards,

    Simon

  • Where have you connected these pins to?

    Transmitting a data from the sensor to device so i have connected the TX pin of sensor to RX pin of MCU and then i am trying to print those data's in uart_handler() like i am receiving in data_array variable and trying to print it but there is no advertisement and i have added DEBUG in processor definition and then  i am trying to debug it but there is nothing in debug terminal . please so how can i troubleshoot it can i send my whole code if you have a look once it will be easy to troubleshoot.

    thank you.

  • Hi

    I'm guessing you haven't enabled the RTT backend for debug logging in the sdk_config.h file of your project (it might try to use UART by default). Make sure that the following configs are set to these values in your sdk_config.h file:

    NRF_LOG_BACKEND_RTT_ENABLED 1
    NRF_LOG_BACKEND_UART_ENABLED 0
    NRF_LOG_ENABLED 1
    NRF_LOG_DEFERRED 0  //(try both 0 and 1)
    NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0 //(try both 0 and 1)

    If you'd like I can take a look at your project, but it is a good learning process as well.

    Best regards,

    Simon

Related