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

NRF52810 ble_app_uart demo how to close uart,

i use the demo ble_app_uart ,and i want to close the uart when ble is "Disconnected"。

but it when it do app_uart_close(),the nrf52810 is RST。 i use the same code in nrf51822,but it work,and no RST。

how can i close the uart when BLE is  "Disconnected"!!!!!!!!!!

such as:

do{
        WDR();

        if(0 == uart_close_done)
        {
                if(NRF_SUCCESS == app_uart_close())uart_close_done = 1;
        }

        power_manage(); 

        if(GetExtIrqMap()) break;
        if(gTaskEvent.DWord[0]) break;
}while(1);

CloseGpioExInt(); 
WakeupPlatform(); 

if(uart_close_done)
{
        uart_init();
}

Parents
  • Hello,

    i use the same code in nrf51822

    What do you mean by this? I would not expect code for the nRF51822 to work on the nRF52810 without modification.
    I am unable to comment on what might be causing this reset without having seen the code.

    I am unable to gain an understanding of your code from the exempt you have attached, but from your description it sounds like you would like to close the UART when you receive an BLE_GAP_EVT_DISCONNECTED event. I therefore suggest that you do this as part of your ble_evt_handler. Note that you will then have to initialize the UART again upon new connections.

    For future reference, please use the "insert -> code" option, when attaching code to your ticket.

    Best regards,
    Karl

  • YES,when the sys nothing to do,i want to nrf_pwr_mgmt_run(),and close the uart,and close HFCLK EX;if the sys wakeup by button or BLE_GAP_EVT_CONNECTED,open it。i use the demo ble_app_uart,try bypass BLE ble_stack,only use uart_init(); then do app_uart_close() and nrf_pwr_mgmt_run(),

    it run OK,but 200uA。then i try to close  HFCLK EX ,it 10uA。but when use button wakeup sys,it reset due to CPU lock-up detected。

    int main(void)
    {
        uint32_t err_code,rst_code;
        //bool erase_bonds;
        
        rst_code = NRF_POWER->RESETREAS;
        //NRF_POWER->RESETREAS = rst_code;
        uart_init(); //#define NRF_DRV_UART_DEFAULT_CONFIG_USE_EASY_DMA  .use_easy_dma = false,
        
        // Initialize.
        log_init();
        timers_init();
    
        power_management_init();
        
        //bypass BLE stack
        /*ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
        
        advertising_start(); */
        
        
        while(1)
        { 
            //when sys nothing to do,goto sleep
            app_uart_close();
            //SleepClk();//close HFCLK_EX,if use it 10uA,but sys wakeup will RST
                        //                if no use,it 200uA.
            idle_state_handle();
            //WakeupClk();//open HFCLK_EX
            uart_init();
        }
    }
        
        
        
        
        
        
        

  • Hi,

    If this is your intention, you should do this in your event handlers, have you attempted this?
    Could you elaborate on what you mean by "it reset due to CPU lock-up detected"?
    By the way, have you seen the 136 System Errata for the nRF52810?

    Also, I am unable to see where this goes wrong from the code you provided, since I cant see the contents of the functions you mention. Are you using the functions as provided in the example, without modifications?
    Thank you for using code inserts.

    Best regards,
    Karl

  • thanks you very much,it's OK NOW,I redownload the s112_nrf52_7.0.1_softdevice.hex。

  • Great, I am glad to hear it!

    That sounds curious.
    Are you saying that the reset issue resolve when you downloaded a new version of the SoftDevice? Which SoftDevice and version did you use before this?

    Best regards,
    Karl

  • S112 with SDK16.0.0_98a08e2,but i not sure when use JFlash to  downloaded the SD, the keyboard accidentally modifies the cache。and I cant recurrent 。。。but i need to change to nRF52832, for the 52810's ROM for usercode is too small ,176 - 100(SD) - 32(BOOT) = 44K.By the way ,if the 52832 has a cutsdown,like 51802 ,52805.

  • Hello,

    I am sorry, but I do not understand you last comment - apart from the bit about chaning to nRF52832 from the nRF52810.
    Could you clarify your last comment?

    Could you also detail what changes you made to your code to resolve your reset following uart_close?

    Best regards,
    Karl

Reply Children
No Data
Related