SD card files out on a RFM69 questions

Hi all,

Been noodling this for a while surprised that it is as challenging as it turned out to be. Looking for advice on the best way to do this.

Feather MO with RFM69HCW (SPI) on board, Adafruit FeatherWing with SD (SPI) and RTC (I2C).
Relevant includes are:
<SPI.h>
<SD.h>
<RH_RF69.h>
<RHReliableDatagram.h>

Basically a race car datalogger that collects time stamped data at 10hz to the SD card. (All fine)
Every time it sees the end of an event (aprox. 30 minutes) it starts a new file in a .csv format. Usually under 1 meg. (tickled beyond words that it’s all fine too).
I can serial in on USB and parse my commands to get the different functions to happen like restarting, file directory of the SD, power down, download a specific file contents and such. What I’m really struggling with is shipping a file from the SD out the radio.

There is the initial problem of getting the SPI to play nice between the radio and the SD. Been exploring the radios and can poll them and send basic strings back and forth, but really falling down on how to open a file on the SD, grab part of it, send it to the mothership (Excel on a PC connected through a Feather 32u4 with radio), and then go back into the same file where I left off to get more.

While it would be nice to find someone that has done this, so I can study their code, I’m really looking for a philosophy or scheme that fits this process best.

I haven’t tackled the SPI issue yet, and it may not be an issue, but I have seen a number of approaches to try and circumvent it. Worst case, since it is a Cortex M0, I might be able to change the board so I can get to another SERCOM and use it as another SPI port. Hope I don’t have to.

My biggest hurtle is getting my head around what is the best way to pull part of the SD file, close it so I can use the transmitter, and reopen it where I left off, and get more until I’m done downloading a fairly large file.

Currently the data is “date”, “Time”, Pressure(float), Pressure (float),Voltage (float), voltage (float). Since the floats are only being used to 2 decimal points, is there something to convert them to in able to reduce the data? Probably, but I’m not sure. Since the pressures can be negative or positive and 2+2 digits, maybe a signed variable and move the decimal point in the receiver?

If anyone is willing to point me in the right direction while I’m beating my head against the keyboard, I’d appreciate it.

Thanks
bo

My biggest hurtle is getting my head around what is the best way to pull part of the SD file, close it so I can use the transmitter, and reopen it where I left off, and get more until I'm done downloading a fairly large file.

You can keep track of where you last read from the file, using position(), and then go to that position using seek().

Thank you PaulS,

I will look into both of those commands and get a better handle on them.
I'll also look again to see if the USB code is using them and I missed how it was working.

I was really surprised that this isn't more common using SD cards and radios with other than a few bytes. I have been looking for days to find out something about this situation.

Thanks for the pointers
bo