I want to use fstorage to write data to a file. The File with three records: 0x1111="Tablet1", 0x2222="data: abcdef", 0x3333="26". How to implement it? Can anyone guide me?
I want to use fstorage to write data to a file. The File with three records: 0x1111="Tablet1", 0x2222="data: abcdef", 0x3333="26". How to implement it? Can anyone guide me?
Can the third parameter change to 26 (uint8_t)?
I think you might want to use the 'fds' library for that. Have a look here: infocenter.nordicsemi.com/index.jsp
My source code at attach file.
print messages as follows: Writing Record ID = 1 set write_flag Writing Record ID = 2 set write_flag Writing Record ID = 3 set write_flag Start searching... Found Record ID = 1 Data = 0x6c626154 0x 317465 Found Record ID = 2 Data = 0x 8fb5 0x20002bf0 0xfffffff9 Found Record ID = 3 Data = 0x 1a
Second data (0x2222="data: abcdef") is always error. Can you guide me what it is?ble_pstorge.c
It seems some wrong at the function of fds_record_write(). It cannot write special character like ASCII 0x21 to 0x2f etc. How to fix it if I say correctly?
You are printing it as a hex number instead of a string. If your string is null terminated, simply use %s in NRF_LOG_PRINT().
Something like this:
char * p_data; p_data = flash_record.p_data; NRF_LOG_PRINTF("Data: %s\r\n", (uint32_t)p_data);