Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uart data corruption issue while write data using littlefs #131

Open
Kuldeep-Chandel opened this issue Jun 8, 2023 · 3 comments
Open

Uart data corruption issue while write data using littlefs #131

Kuldeep-Chandel opened this issue Jun 8, 2023 · 3 comments

Comments

@Kuldeep-Chandel
Copy link

ESP IDF Version: 4.4.4
Littlefs Version: "1.3.1"
description: LittleFS is a small fail-safe filesystem for micro-controllers.
url: https://github.com/joltwallet/esp_littlefs
dependencies:
idf: ">=4.1"

I'm using an ESP32S3 soc chip and on UART_NUM_1 receiving NMEA data and facing some issues.

I have two scenarios,

  1. While not using Littlefs

       I'm receiving NMEA data on uart and dumping the data then I'm not facing any checksum failed issues.
    
  2. While Using LittleFS

    I'm receiving NMEA data on uart, decoding the NMEA string, and saving the parameter into littlefs then I'm facing checksum failed issue.

As per my observation, maybe littlefs affect the global ISR of UART, and uart misses the string causing the checksum to fail.

Any ideas or suggestions to reduce this issue?

@BrianPugh
Copy link
Member

Thanks for the report! Can you confirm this clarifications on your scenarios?

  1. Receiving NMEA on uart and storing it in RAM. After all data is received, I compute a checksum.

  2. Receiving NMEA on uart, and write it to a littlefs file. Upon reading the data back and computing a checksum, it is incorrect.

Can you also provide a minimal working example? I'm assuming the data doesn't have to be NMEA and could be anything. While I haven't done it recently, I've previously received binary data over UART and wrote the results using esp_littlefs without issue.

Particularly, are you sure you are flushing and closing the file prior to reading back the contents?

@Kuldeep-Chandel
Copy link
Author

Thanks for your response.

1.Receiving NMEA on uart and storing it in RAM. After all, data is received, I compute a checksum.

  Receiving Nmea on uart and storing it in RAM, I calculate the checksum after receiving one string.

2.Receiving NMEA on uart, and write it to a littlefs file. Upon reading the data back and computing a checksum, it is incorrect.

I'm using three threads in our code, In the First thread I'm receiving NMEA on uart, and in the other two threads, I'm writing dummy data on Littlefs. In the scenario I'm facing an NMEA checksum failed issue.

If I'm commenting the Writing section of littlefs. As a result it checksum failed of the received nmea string gets stopped.

I have attached my source code for your reference.
nmea0183_parser.zip

@BrianPugh
Copy link
Member

@Kuldeep-Chandel I know this issue is quite old, but this sounds tangentially related to #161 . Does the solution mentioned there help fix the issues you were seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants