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

Projects for Writing into Flash Memory does not work on nRF52840 dongle

I am using nRF52840 dongle and nRF SDK version nRF5_SDK_17.0.0_9d13099.

When I am trying to debug the application it gives an error.

using your example project on nRF52840 dongle

nRF5_SDK_17.0.0_9d13099\examples\peripheral\flash_fds\pca10056\s140\ses\flash_fds_s140_pca10056.emProject

main.c 

Line 352 rc = fds_record_update(&desc, &m_dummy_record);
after that it goes to
app_error_weak.c file , Line no. 100

nRF5_SDK_17.0.0_9d13099\examples\peripheral\flash_fstorage\pca10056\s140\ses\flash_fstorage_s140_pca10056.emProject

main.c

line no. 284 rc = nrf_fstorage_write(&fstorage, 0x3e100, &m_data, sizeof(m_data), NULL);
after that it goes to
app_error_weak.c file , Line no. 100

nRF5_SDK_17.0.0_9d13099\examples\peripheral\flashwrite\pca10056\blank\ses\flashwrite_pca10056.emProject

When trying to write hex file into the dongle, it does not allow to add softdevice hex file, stating that the hex file is overlapping.

if I try to write hex file flashwrite_pca10056.hex, it gives an error, log of the programmer is   2020-08-11T07_59_13.264Z-log.txt

do let me know, what I am missing.

  • Hi, 

    Flash Data Storage Example needs to establish a UART connection, but the nRF52840 dongle there is no UART connected to the PC, other than the virtual COM port that is used for programming via Serial DFU (USB).

    You should consider the nRF52840 DK instead if you want to develop firmware for the nRF52840. The nRF52840 dongle is primarily intended to be used together with nRF Connect for desktop and is not well suitable as a development board. This is primarily because it lacks an onboard debugger. 

    -Amanda H.

  • Hi Amanda,

    Do you mean that if I do not establish a UART connection, I can't write in Flash Memory?

    regards

    Shailesh

  • Hi Shailesh, 

    Sorry to cause the misunderstand. 

    The Flash Data Storage Example needs to establish a UART connection to test the command, but the nRF52840-Dongle there is no UART connected to the PC. If you will use write command in the UART to write flash, I would suggest you use the nRF52840DK. If you just write the flash with the function, it should be fine. 

    app_error_weak.c file , Line no. 100

    You should add the define DEBUG in your Preprocessor(Project -> Edit Options -> Preprocessor -> Preprocessor Definitions), then add a breakpoint on app_error_fault_handler() to see which error you get. You will see which error you get and which function is returning this error.

     

    When trying to write hex file into the dongle, it does not allow to add softdevice hex file, stating that the hex file is overlapping.

    You should give the flash start address FLASH_START=0x27000 to the flashwrite_pca10056.hex. You can refer to the setting in the flash_fstorage_s140_pca10056.emProject by right-click the project -> options -> Linker -> Section Placement Macro.  

    if I try to write hex file flashwrite_pca10056.hex, it gives an error, log of the programmer is   2020-08-11T07_59_13.264Z-log.txt

     Are you able to write other hex files like softdevice_s132.hex? If you still get the error, run "nrfjprog --recover" with nRF-Command-Line-Tools

    -Amanda H.

  • Hi Amanda,

    As per your suggestion, I added a breakpoint in app_error_fault_handler(), it gives an error NRF_FAULT_ID_SD_ASSERT, when I used the project nRF5_SDK_17.0.0_9d13099\examples\peripheral\flash_fstorage

    and 

    nRF5_SDK_17.0.0_9d13099\examples\peripheral\flash_fds\pca10056\s140\ses.

    I couldn't found which function is returning that error code, as after each execution of the command, return code is zero.

    regards

    Shailesh

  • Hi Shailesh, 

    Did you modify the example? If so, I would suspect you are running into the same issue as in this post. The proposed workaround, for now, is to split long writes into multiple shorter writes.

    Besides that, it is hard to say what causes this without some logs or which functions that are triggering this assert. Is it possible to provide any logs?

    It seems like you got "id" also along with "PC". Since you narrowed the hardfault id to be NRF_FAULT_ID_SD_ASSERT. The line number and file name of the assert is located inside the info structure in app_error.h file

    typedef struct
    {
    uint16_t line_num; /**< The line number where the error occurred. */
    uint8_t const * p_file_name; /**< The file in which the error occurred. */
    } assert_info_t;

    Check if you have some valid structure here, if not then something is wrong. Are you seeing these values in a log or in a debug window? If it is the debug window, then I would suggest you to compile the code with no optimizations (and hope that the timing has not changed to be able to reproduce this error.) If you use the segger, you can compile with debug mode. 

    More info regarding the assert, something within the SoftDevice was not finished within the required timing constraints. You may get this error if interrupts have been disabled, if you use the timeslot API and do not release the timeslot in time, if you run application code at an interrupt level higher than or equal to the highest level of the SoftDevice, or if you pause program execution in a debug session (i.e. single stepping, breakpoints, etc.).

    Might be helpful to have a look at this.

    -Amanda H.

Related