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.

  • Yeah, I also think it might be a problem with the board, what's weird to me is it was working just fine up until a little while ago. And I really need to fix this issue with the board, since I have to get 200 boards ready for production and there were only 200 boards fabricated in China(yeah, I know it's a really bad idea, but it wasn't me who decided the quantity). I just thought something in the firmware could be the culprit.

  • Hi,

    Can you do some more debugging to see what happens in the 14 seconds? Is the application stuck waiting for some event, etc? Have you scoped the SPI lines to see how long the actual transfer/commands take, and if these are transmitted as expected?

    Best regards,
    Jørgen

  • Hi, currently I can't probe these aspects as I have other pressing problems to solve, but once I get the time I'll be sure to do that.

  • 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?

Related