Qwiic OpenLog - Data Loss & SAMD21 Incompatibility

Hi there,

I’m currently experiencing an issue with data not being correctly written to my Qwiic OpenLog with a SparkFun Qwiic Micro SAMD21. The problem is that I can observe that data is being lost when writing to the microSD card. The code responsible for writing to the OpenLog is a few simple lines:

  myLog.print(rtc.stringTimeStamp());
  myLog.print(",");
  myLog.print(pitch);
  myLog.print(",");
  myLog.print(roll);
  myLog.print(",");
  myLog.println(heading);
  myLog.syncFile();

The resulting output should include a simple header (“datetime, pitch, roll, heading”) followed by the comma separated values. Instead, the following data is recorded on the SD card at an I2C speed of 400kHz:

d
2,-593,667,-844
2,-637,705,-2.87
2,-7.15,806,-3.35
2,-8.93,797,-3.84
2,-891,1.18,-3.19
2,-869,542,-3.94
2,-1.96,576,-3.07
2,-851,521,-3.77
2,1.86,-4.29,-4.57
2,-036,-1.55,-4.04

When I decrease the I2C speeds to to 100kHz, it appears slightly more data is able to be written to the SD card:

da
2020-01-17T16:0,-22.19,50.67,-3.16
2020-0,-21.28,50.47,-4.35
20,-2.75,51.12,-4.02
20,-1.87,45.76,-7.58
2020-01-17T1,-8.85,3.09,-25.33
2020-01,-40.21,-24.71,-62.01
2020-01-17T16:04:17:11,-30.16,-10.45,-53.06
20,-4.18,-28.86,-65.46
20,-3.27,-0.96,-59.29
2020-01-17T16:04:19:28,3.82,68.11,-7.02

The Qwiic OpenLog troubleshooting steps advise to add small delays between the writes, but doing so appears not to have any effect. I have also tried a variety of microSD cards, including Class 10 cards.

Using the Example9_readVersion, I can confirm that my firmware version is 3.1 when using the Qwiic Micro SAMD21. When I use an Artemis Nano or Edge 2, the version shows as 255.255, which I assume is a bug. I should note that when using an Artemis-based board, the data is correctly written to the SD card and no loss of data is observed.

A quick scan of the SparkFun forums and GitHub repositories for the Qwiic OpenLog reveals that a number of users have encountered very similar problems over the past year. While some of these issues may be attributable to version 2.0 of the firmware, the majority of outstanding issues pertain to firmware version 3.0+.

SparkFun Forums

  • [Quiiic OpenLog Not reading file
  • [/list]
  • [Qwiic Open Log erratic writing
  • [/list]
  • [Qwiic OpenLog recording data intermittently
  • [/list]
  • [Qwiic Only Saving Two Characters

  • [/list]
    GitHub
  • [Incomplete println output in SD card file
  • [/list]
  • [Characters dropped on Teensy 4.0
  • [/list]

    Are you able to confirm that there are known issues with the OpenLog firmware? If so, is this something that’s currently being addressed?

    I’m happy to help in any way I can!

    Cheers,

    Adam](Characters dropped on Teensy 4.0 · Issue #6 · sparkfun/Qwiic_OpenLog · GitHub)](Incomplete println output in SD card file · Issue #3 · sparkfun/SparkFun_Qwiic_OpenLog_Arduino_Library · GitHub)](https://forum.sparkfun.com/viewtopic.php?f=105&t=50227)](https://forum.sparkfun.com/viewtopic.php?f=105&t=50900&p=207913&hilit=openlog#p207788)](https://forum.sparkfun.com/viewtopic.php?f=105&t=51056&p=208400&hilit=openlog#p208291)](https://forum.sparkfun.com/viewtopic.php?f=105&t=51667&p=210751&hilit=openlog#p210489)

    Hi guys,

    I’m curious to know if this issue is on your radar at SparkFun and if anyone has had a chance to look into the bug(s) with the Qwiic OpenLog. I’m looking forward to being able to use it with my SAMD21-based boards.

    Cheers,

    Adam

    Hello adam.g,

    Do you know the firmware version that is on your Open Log?

    You can update it by following the [hookup guide if you have an older firmware than the current version (3.0+).](Qwiic OpenLog Hookup Guide - SparkFun Learn)

    adam.g:
    Using the Example9_readVersion, I can confirm that my firmware version is 3.1 when using the Qwiic Micro SAMD21. When I use an Artemis Nano or Edge 2, the version shows as 255.255, which I assume is a bug. I should note that when using an Artemis-based board, the data is correctly written to the SD card and no loss of data is observed.

    Hi Brandon,

    Thanks for your reply. As noted above, my firmware version is 3.1.

    Cheers,

    Adam

    My apologies, I must have missed that!

    I’ve asked around and it is a known issue. We’re currently looking into it. Our initial assumption, at this moment, is that the slave device is holding down the clock line while it writes. That makes a small, but very impactful, mismatch between our SAMD21 boards and the Open Log.

    I do find it peculiar that the Artemis boards are performing with perfection. I’ve made a note of that to our engineers as well.

    We’ll try to update as we find out more. Thank you!

    Hi Brandon,

    Thanks for the update. Having researched the issue, I had suspected that this may have been a clock stretching issue. It appears a good chunk of the boards in the Qwiic ecosystem (SAMD21/SAMD51/ESP32) are affected by this, so hopefully this long-standing bug can be resolved soon!

    Cheers,

    Adam

    Any updates on this issue?

    Our internal teams have been notified of the issue. We currently don’t have a fix other than altering the sampling rates, but that hasn’t been cleared as a stable fix. We will look more into it as soon as possible.

    Brandon, or anybody else at Sparkfun… this issue is over a year old now. Has there been any resolution to this issue at all? I have a deadline coming up on a project where I am using a Qwiic Micro and a Qwiic OpenLog and this issue makes it impossible to log any useful data at all. Not even the most basic example code works. Any help would be greatly appreciated.

    Reviving a super old thread here in case anyone is following and still trying to use the OpenLog with a SAMD21.

    I believe I have this problem solved, and a PR is open on the Qwiic OpenLog Library repo: https://github.com/sparkfun/SparkFun_Qw … ry/pull/16