This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using flash_storge example in ble_app_hrs_rscs_relay gives undesired results

I am integrating flash storage example ( nRF5_SDK_17.0.2_d674dde\examples\peripheral\flash_fstorage) in ble_app_hrs_rscs_relay (nRF5_SDK_17.0.2_d674dde\examples\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay). After combining them I am unable to write and read data properly from flash. Secondly, when I try to erase the page the program hangs. 

Parents
  • Hello,

    So I guess you have merged the two projects together, and when you write and read back, the data is "corrupted"? And what page are you trying to erase, and how does it hang? Is it a callback that you are waiting for that doesn't occur, or does the device "crash"? Can you take a screenshot to show what it looks like?

    My initial guess is that you didn't change the flash address that the flash_storage example is using. Since the ble_app_hrs_rscs_relay example is significantly larger than the flash_fstorage example, I guess the addresses that are used in that sample, which was originally writing to unused flash space, is now writing to/erasing flash where the application is running from. 

    Best regards,

    Edvin

  • Hello Edvin. Yes, you are right. I haven't change the flash address that the flash_storage example is using. 

    In below picture you can see that am just writing hello world in flash (1). When I try to read from flash I get the result (3). When I try to erase I get the error below(4).

    (1) (2) (3) and (4) refer to lines in image.

  • Hello,

    Please check how large your application is. You can do so by taking the .hex file from your build folder and drag it into nRF Connect for Desktop -> Programmer, and see what addresses that the application covers. Such as this small application that I found:

    The application that I used here is supposed to use the softdevice (just like your application will do), so the flash area from 0x00 up to the green line, which is the application will also be occupied. Therefore, if I were to use fstorage like you do in this application, I would have to make sure that I avoid the area that is already in use. In this case 0x00000000 -> 0x00032D0B. Since flash pages have a size of 0x1000, I would need to set my flash fstorage address to at least 0x00033000.

    Do the same exersize with your application, and see where you would need to have your fstorage page.

    Best regards,

    Edvin

Reply
  • Hello,

    Please check how large your application is. You can do so by taking the .hex file from your build folder and drag it into nRF Connect for Desktop -> Programmer, and see what addresses that the application covers. Such as this small application that I found:

    The application that I used here is supposed to use the softdevice (just like your application will do), so the flash area from 0x00 up to the green line, which is the application will also be occupied. Therefore, if I were to use fstorage like you do in this application, I would have to make sure that I avoid the area that is already in use. In this case 0x00000000 -> 0x00032D0B. Since flash pages have a size of 0x1000, I would need to set my flash fstorage address to at least 0x00033000.

    Do the same exersize with your application, and see where you would need to have your fstorage page.

    Best regards,

    Edvin

Children
Related