How to Enter bootloader from Application?

Hello.

I want enter bootloader from application by typing 0x31.

The below is my code.

static void nus_data_handler(ble_nus_evt_t * p_evt)
{

    if (p_evt->type == BLE_NUS_EVT_RX_DATA)
    {
        uint32_t err_code;

        NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
        NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);
			
				uint8_t rx_buf[4] = { 0, };

        for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
        {
					rx_buf[i] = p_evt->params.rx_data.p_data[i];
					
					do
            {
                err_code = app_uart_put(p_evt->params.rx_data.p_data[i]);
                if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY))
                {
                    NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code);
                    APP_ERROR_CHECK(err_code);
                }
            } while (err_code == NRF_ERROR_BUSY);
        }
				
				if(rx_buf[4] == 0x31)
				{
					NRF_POWER->GPREGRET = 0xB1;
				}
				
				
        if (p_evt->params.rx_data.p_data[p_evt->params.rx_data.length - 1] == '\r')
        {
            while (app_uart_put('\n') == NRF_ERROR_BUSY);
        }
    }

}

in Line 28~31, I want to enter bootloader.

However It is not working now, What can I do?

Thankyou