Problems with connecting Qwiic openlog to an arduino Mega

I purchased the Qwiic openlog microSd board and I am trying to connect it to an Arduino mega. The spark fun board works perfectly when I connect it to a nano just running the microSD. I downloaded several of the example programs and it all works. When I connect the board to the Arduino mega along with a lot of other devices such as a TSL1401 diode array and a TFT_HX8357 display and run some test programs embedded in my main program i get only the config file and the built in LOG00024 etc. files each time I run the program. The Qwiic is connected to the SCL and SDA pins on the mega and I am connected to the 3.3 V and Gnd connections on the mega. Can you suggest where I might be having the problem? thanks.

I run into issues when trying to use the QWIICC Openlog on an ATmega. A file manager that I had created and works without problems on an Artemis ATP BUT failed on an ATMEGA. The major issue was that 0xff (which is used as a filler when there is No directory entry or used as a filler after the name length of a directory entry) was differently interpreted by the Arduino compiler. I have updated my file manager and posted it on https://github.com/paulvha/apollo3/tree … ilemanager. Maybe it will help you.

Paul: Thank you very much for your quick reply. It is good to know I am not crazy and that there is a problem with the ATMega and the Qiicc microSD. I am not sure how to proceed with the file that you reference. Does this file go into the library along with the SparkFun_Qwiic_OpenLog_Arduino_Library and then I do an #include for your file? Also, is there a pdf or some other documentation that lists all the commands for the SparkFun_Qwiic_OpenLog_Arduino_Library? I couldn’t find anything like this on the Sparkfun site.

Thanks for your help.

Chuck

The file manager is a sketch that is making use of the Sparkfun library. The issue I had was within that sketch, no change was made to the library.

I have just taken some of the Sparkfun examples and they all work on the ATmega. What is it exactly that is not working for you ? have you tried the original examples and seen they work ?

Paul: Thanks for continuing to help with this problem. I have copied the section of your code before the Void Setup line and adjusted to make it run with my code. I am assuming that in this section you are making some adjustment that allows the ATmega to work, but I still do not get anything on the microSD except the config file and the sequential log files that are empty. I will keep on keeping on with this. Can you suggest a good reference that describes the command for the Qwiicc openlog library commands?

Best regards,

chuck

Try one of the original examples and see whether they work ?

If not remove the other devices and try again.

If still not share your sketch?

For the commands I took the following from the header file :

    //These functions override the built-in print functions so that when the user does an
    //myLogger.println("send this"); it gets chopped up and sent over I2C instead of Serial
    virtual size_t write(uint8_t character);
    int writeString(String string);
    bool syncFile(void);

    //By default use the default I2C addres, and use Wire port
    boolean begin(uint8_t deviceAddress = QOL_DEFAULT_ADDRESS, TwoWire &wirePort = Wire);
    boolean begin(int deviceAddress);

    String getVersion(); //Returns a string that is the current firmware version
    uint8_t getStatus(); //Returns various status bits

    boolean setI2CAddress(uint8_t addr); //Set the I2C address we read and write to
    boolean append(String fileName); //Open and append to a file
    boolean create(String fileName); //Create a file but don't open it for writing
    boolean makeDirectory(String directoryName); //Create the given directory
    boolean changeDirectory(String directoryName); //Change to the given directory
    int32_t size(String fileName); //Given a file name, read the size of the file

    void read(uint8_t* userBuffer, uint16_t bufferSize, String fileName); //Read the contents of a file into the provided buffer

    boolean searchDirectory(String options); //Search the current directory for a given wildcard
    String getNextDirectoryItem(); //Return the next file or directory from the search

    uint32_t removeFile(String thingToDelete); //Remove file
    uint32_t removeDirectory(String thingToDelete); //Remove a directory including the contents of the directory
    uint32_t remove(String thingToDelete, boolean removeEverthing); //Remove file or directory including the contents of the directory

Paul: I took your suggestion and just loaded the Example 1 from the Qwiicc website, so none of the other devices are being called. I disconnected the the TFT_HX8357 display, and an interesting thing happens. I get no config file or log file written to the microSD with the display disconnected. I made sure to connect the microSD to the 3.3V supply. When I reconnect the TFT_HX8357 display I get the light on the microSD and I get the config and Log files on the microSD, but no data from the example 1 program. The TFT_HX8357 display is a serial display shield that connects to all the pins 22 through 53 on the Mega as well as the 3.3V reset pins. I don’t understand how disconnecting the TFT causes the microSD to not work at all, while having the display connected causes the microSD to get the config and empty log file. Any thoughts on this?

thanks much

chuck

Weird, interesting indeed. First, get the basics right and get the QWICC openlog working on an ATmega. Then build from there.

How is your QWICC connected to the AtMega?

I assume you still het the SCL and SDA pullup jumpers in place on the QWICC.

Try to download the latest version of my filemanager-sketch (made some changes late last week). Connect the Openlog to the Mega as indicated in the top of sketch and see what happens?

Do you happen to have another SD card that you can try ?

IF no other SD card, try to format the card on another system (e.g. PC). Maybe it has an issue.

If it does not work, please share pictures.

Paul: Your patience with this is truly remarkable. I have the Qwiicc connected to the SCL and SDA on the Mega board as well as the 3.3 V and gnd and I get no light on the Qwiicc indicating it is not getting powered. However, when I plug the TFT display into the Mega pins the Qwiicc operates but does not communicate with the Mega. I have loaded both the example 1 and your program into the Mega board at separate times and neither program writes to the Qwiicc with the TFT disconnected. With the TFT connected I get the config file and Log file, but nothing from either program. I have run the same Qwiicc board with a nano and it works fine, so it does not appear to be a problem with the Qwiicc. I have checked the 3.3v output with a voltmeter and it is reading 3.4 V. At this point I am planning to abandon this approach and jus use my computer and serial connection to get the data. This is inconvenient, but better than spending another month beating my head against the wall. The Qwiicc looks like a good product, but I am very disappointed in the fact that it doesnt work with a Mega.

Best regards,

chuck

I know the SD card is good, because I can write to it when it is connected to the nano.

chuck

weird… very weird. So it looks the 3v3 is not coming to the Openlog. In the past, I had a problem where I had to bend a little the pins to make good contact as the connector on the board (e.g. the atMega) was damaged. The QWICC openlog works fine with my ATMEGA, not sure why I does not for you.

Paul: I am going to give up on this and move on to other projects. I have spent about 2 months beating my head against this wall. Thanks for all of your suggestions.

Chuck