This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

sd_flash_write hangs after 10 words written

Hi

I'm learning to use the sd_flash_write function to write words into flash memory. I've the SD enabled, but not advertising, so I'm able to debug. Scheduler is also initialized.

What I get, it is than when executing this little code:

buf[4] = {0, 0, 0, 0};
		for(i=10; i<256;i++){
			buf[0] = i;
			res = sd_flash_write(FLASH_DIR_LAST_PAGE+(i*4), (uint32_t *)buf, 1);
			TIMER_BASE_Delay(1000);
		}

my SW hangs hangs and resets after 9 words written. The 10th word is which hangs the SW. Any idea??? Note than I'm waiting about 1 second between each write operation.

For now, I'm trying to handle the flash memory whitout using the pstorage module. Should I use it?

Thanks in advance

Elena

Parents
  • Hi

    Thanks for your reply. You're right: I'm waiting for one second in order to wait sufficient time to perform de operation. One second should be more than sufficient, so I don't understand what's happening.

    I'll review my code and check the pstorage module.

    Thanks again,

    Regards,

    Elena

Reply
  • Hi

    Thanks for your reply. You're right: I'm waiting for one second in order to wait sufficient time to perform de operation. One second should be more than sufficient, so I don't understand what's happening.

    I'll review my code and check the pstorage module.

    Thanks again,

    Regards,

    Elena

Children
  • I don't know why the delay is not working for you. However, I don't have your code so it is hard to tell. Does the call the sd_flash_write ever return anything other than NRF_SUCCESS?

  • Hi again

    I've discovered the problem. My fault: I wasn't calling the scheduler from my loop. I've edited the code as follows:

    	for(i=10; i<256;i++){
    		buf[0] = i;
    		res = sd_flash_write(FLASH_DIR_LAST_PAGE+(i*4), (uint32_t *)buf, 1);
    		TIMER_BASE_Delay(1000);
    		**app_sched_execute();**
    	}
    

    Thanks for your help

    Cheers

Related