File Delete in littleFS results in -22 error

So I have a device on a custom PCB with an nrf52832 and a mx25r1635f, with which I've had quite some trouble already(  File write gives -5 after file size reaches cache size  ). In most of the devices it's working correctly and was working up until a couple hours ago, but now any operation with the Flash takes over 14 SECONDS!, that's ludicrous to me, I tried to delete the files and clear the flash, giving the -22 error, I'm very lost at this point, since I can't delete the files individually, can't clear the flash area. Does anyone know what could be the case happening here? Config information can be found on the ticket I linked.

Parents
  • It happened on another board as well now, same thing, operated for a good while saving data toi the flash and now anything it tries to do to it returns -22 error. So I connected a logic analyser to it and the clock looks really weird to me:

    is this normal?
    Another thing as well is that the clock frequency is 12MHz, even though I set it to 20MHz in the .dts file


    &spi1 {
    	 compatible = "nordic,nrf-spi";
    	 status = "okay";
    	 pinctrl-0 = <&spi1_default>;
    	 pinctrl-1 = <&spi1_sleep>;
    	 pinctrl-names = "default", "sleep";
    	 clock-frequency = <20000000>;
    	 mx25r16: mx25r1635f@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0>;
    		spi-max-frequency = <33000000>;
    		jedec-id = [c2 28 15];
    		size = <DT_SIZE_M(16)>;
    	};
     };

  • ok, so something weird happended now, the problem disappeared after leaving it running for about an hour or so and I have no clue what "solved" it. And about the weird clock signal and general weirdness on the logic analyser it was due to my sampling frequency, it was set to 12MS/s so of course I'd see a frequency of 12MHz and weird behaviour, and since it only goes up to 24MS/s but gives a timeout frequently(don't really know why) using the logic analyser might be a problem. Could it be a problem with the hardware or is it something in the firmware really?

  • Hi, it happened now on the third board I tested as well, so I think it must be software related. The only problem is I don't really know what could be causing it on my firmware, could it be on the lower level driver?

    Edit: One info that might be helpful is that the occupied flash size is 89kB aproximately. Since my external flash size is 2MB, I don't think it could be filled memory.

  • Do you see any difference in the commands being sent on the logic analyzer before and after the issue occurs?

  • Hi, with the logic analyser I can't really see a difference. But there is also the problem that my logic analyse is on of those VERY cheap ones and doesn't handle the 24MS/s sampling frequency very well and constantly timesout.

  • Hi, is there any other thing I could test to determine the problem? Now it has already happened on 6 boards and I have 0 clues as to what could be the cause. It's a pretty serious problem in my case, since I can't use something with this problem for the production of 200 devices.

  • Hi, I tried diving into the zephyr source code to track down the -22 error code problem, in the end I went on this track:
    fs_unlink
    lfs_dir_commit
    lfs_orphaningcommit
    lfs_dir_relocatingcommit
    lfs_dir_splittingcompact
    lfs_dir_split
    lfs_dir_alloc
    lfs_bd_read

    lfs->cfg->read

    but now I don't quite know where to go next, as the api struct has me really lost as to which function it's calling.

    Does anyone know what function I have to track down now?

Reply
  • Hi, I tried diving into the zephyr source code to track down the -22 error code problem, in the end I went on this track:
    fs_unlink
    lfs_dir_commit
    lfs_orphaningcommit
    lfs_dir_relocatingcommit
    lfs_dir_splittingcompact
    lfs_dir_split
    lfs_dir_alloc
    lfs_bd_read

    lfs->cfg->read

    but now I don't quite know where to go next, as the api struct has me really lost as to which function it's calling.

    Does anyone know what function I have to track down now?

Children
No Data
Related