×

Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.

Member #466543

Member Since: September 2, 2013

Country: United States

  • I encountered a similar issue trying to use the sparkfun example with an SD card. In my case, I was using the DeadOn RTC and sparkfun example with the sparkfun microSD shield stacked on top of an arduino uno r3. I was initially only able to get either the SD or RTC working at any time despite an hour of troubleshooting.

    Eventually I came to this comment and changed the ReadTimeDate and SetTimeDate functions (added the two lines below at the beginning/end of the functions) to take care of the SPI mode switching, and everything works great!.

      SPI.setDataMode(SPI_MODE3);  // switch mode to clock
    
      code
    
      SPI.setDataMode(SPI_MODE0);  // switch mode to SD
    

    I also changed this line, as the SD chip select is pin 8

    const int  cs=10; // RTC chip select
    

    Finally, I changed the date format to yyyy-mm-dd hh:mm:ss including 0 placeholders for single digit values, which is much more useful to me:

        temp.concat("20");
        temp.concat(TimeDate[6]);
        temp.concat("-") ;
        if (TimeDate[5]<10) {
          temp.concat("0"); }
        temp.concat(TimeDate[5]);
        temp.concat("-") ;
        if (TimeDate[4]<10) {
          temp.concat("0"); }
    temp.concat(TimeDate[4]);
    temp.concat("  ") ;
        if (TimeDate[2]<10) {
          temp.concat("0"); }
    temp.concat(TimeDate[2]);
    temp.concat(":") ;
        if (TimeDate[1]<10) {
          temp.concat("0"); }
    temp.concat(TimeDate[1]);
    temp.concat(":") ;
        if (TimeDate[0]<10) {
          temp.concat("0"); }
    temp.concat(TimeDate[0]);
    return(temp);
    

No public wish lists :(