Hi,
I’ve the following Hardware Setup:
ESP32
Adafruit Ultimate GPS (Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates [Version 3] : ID 746 : $39.95 : Adafruit Industries, Unique & fun DIY electronics and kits) connected to Serial2 (PIN 16, PIN 17)
SD-Modul connected to I2C (MOSI 23; MISO 19; SCK 18, CS 5)
Serial0 connected to Laptop
There is also a ICM20948 Gyro in Code wich is currently disconnected for debugging purpose.
And a Neopixel which is also disconnected for debugging
Easy description of function:
I read GPS signals from serial2, format it and write it to SD-Card and print it to Serial0
The problem:
I got Bit Errors while reading GPS Data from Serial2. Some Examples:
$GPRMC,014411.500,A,5100.1318,N,00653.5551,E,0.29,224.50,030221,,,A*69
$GPRMC,014411.600,A,5100.1318,N,00653.5551,E,0.29,224.36,030221,,,A*6A
$GPRMC,014411.7^P0,A,5100.1318,N,00653.5551,E,0.29,224.23,030221,,,A*6F
^^^^ - Error. Should be "....014411.700,A,....."
When I disable the writing to SD and just output to Serial0 I have no errors.
The amount of errors seem to depends on how often I use SD.flush(). When using SD.flush() after every written Line, I got up to 70-80% of corrupt Data.
When reduce SD.flush() to every 5sec. (Which are 50 Lines) The errors go down to appr. 10%.
The corrupt Data is not sync. to the flush command. This mean, I can not say that exactly at the time when using SD.flush() I got corrupt Data.
I’m not sure if this is a code problem or a hardware problem. Does anybody have an idea how to debug it closer or how to fix it?
BR
–Manuel
main.cpp (12.5 KB)