Facing errors related to sd card after a time

I integrated the sd card code into my main code in which the the wifi module (nrf5340 + nrf7002) receives uart data from a different device 
What I need to do is that whenever the wifi gets disconnected I need to write (save) the data into the sd card and when it will again get reconnected to wifi I need to read the data from the sd card 
I have made a separate function which I have made as thread in which I manage the write and read function as per the wifi connectivity status and data receiving from the different device.

For reference I am attaching my code below

4336.wifi_over_http.zip

Get 
[00:00:39.289,855] <err> sd: Failed to read from SDMMC -116
[00:00:39.289,855] <err> sd: Card read failed
[00:00:39.289,886] <err> fs: file write error (-5)

such kind of errors I get after some time

Parents
  • Thanks for your reply
    But I am not using flash partition in my overlay file


  • Hi Rakshita,

    Could you verify whether your sd card is formatted and working correctly? Maybe verify this by using the sd card in another device. 
    This is just because the error SDMMC -116 may suggest a sd card issue or that the sd card is not accessed properly.

    -Priyanka

  • Actually what happens is sometimes it works very smoothly and sometimes after working for sometimes it suddenly starts giving this timeout related error and failed to open the file


    [00:00:15.659,393] <inf> home_demo: Data is the same as the last written data. Skipping write.
    [00:00:15.659,423] <inf> home_demo: cloud value: 2
    [00:00:16.659,515] <inf> home_demo: data received: 1
    [00:00:16.669,860] <inf> home_demo: Read total 1919 bytes from file /SD:/testfile.txt

    [00:00:16.671,752] <inf> home_demo: Data is the same as the last written data. Skipping write.
    [00:00:16.671,783] <inf> home_demo: cloud value: 2
    [00:00:17.671,844] <inf> home_demo: data received: 1
    [00:00:17.682,067] <inf> home_demo: Read total 1919 bytes from file /SD:/testfile.txt

    [00:00:17.683,959] <inf> home_demo: Data is the same as the last written data. Skipping write.
    [00:00:17.683,990] <inf> home_demo: cloud value: 2
    [00:00:18.684,051] <inf> home_demo: data received: 1
    [00:00:18.694,213] <inf> home_demo: Read total 1919 bytes from file /SD:/testfile.txt

    [00:00:18.696,105] <inf> home_demo: Data is the same as the last written data. Skipping write.
    [00:00:18.696,136] <inf> home_demo: cloud value: 2
    [00:00:19.696,594] <inf> home_demo: data received: 1
    [00:00:21.289,855] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:21.289,855] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:21.289,886] <inf> home_demo: UART_RX_DISABLED
    [00:00:31.180,816] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:31.180,847] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:31.180,847] <inf> home_demo: UART_RX_DISABLED
    [00:00:41.073,211] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:41.073,242] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:41.073,272] <inf> home_demo: UART_RX_DISABLED
    [00:00:42.926,300] <err> sd: Failed to read from SDMMC -5
    [00:00:42.926,361] <err> sd: Card read failed
    [00:00:42.926,391] <err> fs: file read error (-5)
    Error reading from file /SD:/testfile.txt [-5]
    [00:00:50.965,911] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:50.965,942] <inf> home_demo: UART_RX_BUF_RELEASED
    [00:00:50.965,972] <inf> home_demo: UART_RX_DISABLED
    [00:00:54.978,851] <err> sd: Failed to read from SDMMC -5
    [00:00:54.978,851] <err> sd: Card read failed
    [00:00:54.978,881] <err> fs: file open error (-5)

  • Have you tried using a different sd card, just to rule out the sd card problem?

    -Priyanka

Reply Children
Related