I want to implement a long write.
The environment in use is below.
· SDK15
· Nrf 52
· Nrf 52832_xxaa
· S132_nrf52_6.0.0_softdevice.hex
My start is "nRF5_SDK_15.0.0_a53641a \ examples \ ble_peripheral \ ble_app_uart".
I am adding my service to this. I referred to the following.
· github.com/.../custom_ble_service_example
I would like to implement a long write of maximum size 512 bytes for my service.
infocenter.nordicsemi.com/index.jsp
The current situation is below.
· Added to main.c
static uint8_t queued_write_buffer [1024]; / ** <LongWriteBuf
ble_user_mem_block_t mem_block; / ** <User Memory Block. * /
· Main.c - added to ble_evt_handler ()
case BLE_EVT_USER_MEM_REQUEST:
NRF_LOG_INFO ("BLE_EVT_USER_MEM_REQUEST");
mem_block.len = sizeof (queued_write_buffer);
mem_block.p_mem = & queued_write_buffer [0];
err_code = sd_ble_user_mem_reply (m_conn_handle, & mem_block);
APP_ERROR_CHECK (err_code);
break;
case BLE_EVT_USER_MEM_RELEASE:
NRF_LOG_INFO ("BLE_EVT_USER_MEM_RELEASE");
break;
case BLE_GATTS_EVT_WRITE:
NRF_LOG_INFO ("BLE_GATTS_EVT_WRITE");
// Long write processing
break;
problem:
The result of sd_ble_user_mem_reply () is as follows.
NRF_ERROR_INVALID_STATE (NRF_ERROR_BASE_NUM + 8)
Also, is nrf_ble_qwr_on_ble_evt () in nrf_ble_qwr.c unrelated to long writing?
I think the composition is similar.
Please give me some advice. Thank you.