3 UM7s and 2 FSRs sending data to a microSD at high rates

Status
Not open for further replies.

Nagillimi

New member
Hey guys,

I've been designing a biomechanical system to track a participants leg motion while walking. The sensors will include 3 IMU's and 2 FSR's, and will synchronously store data to a microSD card using the T4.1. (I realize the photo below has the T3.6, I've since upgraded)
Mockup.jpg

The IMU's are CH Robotics UM7's and each will be sending gyro {x,y,z}, accel {x,y,z}, and euler {r,p,y} data as binary packets at 255Hz. The UM7's are each allotted a Serial bus, since I couldn't get the SPI code to work. I've created a library to read from the UM7 sensor over UART using the Arduino IDE, and is available here. I'm fairly new to programming, so I'll take any pointers/help you guys have! The UM7 doesn't have an interrupt pin...

The FSR's will each send analog data at 1000Hz as a ground truth.

I've been using Bill Greiman's ExFatLogger example to attempt to store all the data. I'm finding it difficult to synchronously read data from the IMU's since I need to probe the specific Serial bus while in the logRecord() function (I don't have an issue with the FSR's since they're analog and match the ExFatLogger example exactly). Here's what I've done for logRecord() using one UM7 for roll, pitch, and yaw as a test:
Code:
void logRecord(data_t* data, uint16_t overrun) {
  if(Serial1.available()) {
    if(imu.decode(Serial1.read())) {
      data->in[0] = imu.roll;
      data->in[1] = imu.pitch;
      data->in[2] = imu.yaw;
    }
  }
}
The ExFatLogger.h contents:
Code:
#ifndef ExFatLogger_h
#define ExFatLogger_h
struct data_t {
  float in[3];
};
#endif  // ExFatLogger_h
The output I get with the above changes to ExFatLogger gives me:
Code:
    0.00   overrun    -1
for all datasets. I've confirmed the sensor works and that my wiring is correct (storing data from some analog sensors).
As far as I understand, I think the logData() function in the ExFatLogger is taking too much time between the UM7 samples. Is there a way I could store the UART data into a buffer then copy it to data->in[] once the program enters logRecord()? Let me know if you need more information and thanks in advance! :cool:
 
I've recently solved this.

So in case anyone needs this code, I've uploaded a working SPI library for the UM7 on my repo. The Teensy_DEDICATED_SPI_UM7 example includes coms for all the sensors mentioned in this thread, at 500Hz.
 
Glad you got to a working solution! Your 7-09-2020 post date seems to have fallen into a 'black hole' between various users online that would have seen and made some comment on this.
 
Thanks, I thought it would fall in a grey area.. All good!

I couldn't get the SD card to write in SDIO mode, so I used an external card and a dedicated SPI bus, which worked. If I could get the T4.1 into SPI mode for it's SD, then I'd be rockin. Do you know if it's possible?
 
Status
Not open for further replies.
Back
Top