Timing for Data Acquisition and Neural Network

Hi there,
I’m working on an intelligent robot. The TX2 is supposed to be the control unit and record every millisecond data via SPI and calculate every five milliseconds a LSTM cell. What would be the best approach for timing? I read a bit about RedHawk. Is there any other approach or similar project that I can use as a guide? By now it only works with offline data.
Thanks for the help