You have to check if inserting SD card would cause the K64 to wake up.
There is a thread library, perhaps can try to run two threads, one is to serve MTG, another is to run other tasks.
I think I will add another examples, to write data to the SD periodically. If a file is opened, the on-board...