With the code for sd2tpdd from GitHub, the compiler was issuing the warnings
below. I have gone through and corrected them and the compiler is now happy and
the randomness in the first 2 characters is less random. They are still garbage
characters but now they are nearly consistently the same garbage for a given
file.
For example, for 3 runs of the load/save of the same file, I got the following
first 2 bytes (hex)
5C 89
97 8A
5C 89
On a different file I got 1B 8A
The compiler warnings were:
184:33: warning: invalid conversion from 'char*' to 'byte* {aka unsigned
char*}' [-fpermissive]
92:6: note: initializing argument 1 of 'void clearBuffer(byte*, int)'
253:30: warning: ISO C++ forbids converting a string constant to 'char*'
[-Wwrite-strings]
379:28: warning: ISO C++ forbids converting a string constant to 'char*'
[-Wwrite-strings]
473:24: warning: ISO C++ forbids converting a string constant to 'char*'
[-Wwrite-strings]
498:24: warning: ISO C++ forbids converting a string constant to 'char*'
[-Wwrite-strings]
522:34: warning: ISO C++ forbids converting a string constant to 'char*'
[-Wwrite-strings]
The NULL character is still being appended to the end of the fileā¦no luck so
far chasing that one down.
To help with those who can confirm that they have their board working fine, I
am using Arduino 1.8.10 for build and upload.
The GitHub page for the source I am using is
https://github.com/TangentDelta/SD2TPDD in case I am using the wrong one.
I have now tried my 2 slightly suspect AliExpress Arduino Mega clones and
various combinations of el cheapo SD card readers and shop bought ones. The
genuine Arduino Mega I ordered from arduino.cc arrived today so have swapped
out the clones for the genuine article and still no luck.