This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC2642R: High Current Consumption Following f_open Call (FATFS).

Part Number: CC2642R
Other Parts Discussed in Thread: CC2640, CC2652R

Tool/software: TI-RTOS

Hello,

We have been looking into issues regarding current consumption on the SPI micro-SD card interface on custom boards that were upgraded to the CC2642R1 (Rev E. Silicon – SDK 3.10.0.53) from the CC2640. With the new CC2642R1 hardware and associated TI software upgrades, we consistently see system current of approximately 18.5 mA whereas on the older CC2640 boards the current was approximately 1.5 mA. These currents were measured on multiple CC2642R1 and multiple CC2640 boards all with the same micro-SD card.

Under a hypothesis that the high current consumption was related to the f_writes, which occur every 900 ms, a simple program for the CC2642R1 board was developed to see if any changes in current consumption could be noted when the f_writes were replaced with no-ops. The program consisted of a call to the SDFatFs driver for initialization, then an f_open followed by a no-op every 900 ms. We verified none of MISO, MOSI, and SCLK lines were active after the f_open. Using an inline ammeter I measured a system runtime current consumption of 18.5 mA. I concluded that that high current was not due to the f_write operations.

The next hypothesis was that there is an issue with the FATfs initialization process, since it was verified through the use of a scope that no micro-SD card activity was occurring following FATfs initialization.

Keeping the same program on the CC2642R1 board, I then stepped through the code with the in-line ammeter attached during the debugging session to see where in the code the current increased from approximately 0.3 mA to 18.5 mA. During the debugging session I found that the increase in current occurred following a call to f_open and remained at 18.5 mA even when the file was closed. Digging deeper into the f_open call, I found that the increase in current occurred at the end of the first iteration of the following code snippet from SDSPI.c:

do {
	/* ACMD41 with HCS bit */
	if ((sendCmd(object->spiHandle, CMD55, 0) <= 1) &&
		(sendCmd(object->spiHandle, CMD41, 1UL << 30) == 0)) {
		status = SD_STATUS_SUCCESS;
		break;
        
		}
        currentTime = ClockP_getSystemTicks();
} while ((currentTime - startTime) < timeout);

Having measured total system current up to this point, I needed to isolate exactly where the current consumption was coming from. To do this, the ammeter was connected between the VCC supply and the VCC pin of the micro-SD card’s interface. After initializing the FATfs and applying power to the micro-SD’s VCC pin, the current was measured at 0.3 mA. Following the call to f_open, a current of 18.23 mA was measured.

 

At this point I was convinced that the high current was related to an interaction between the f_open function and the micro-SD card. Since the micro-SD card interface was identical on my CC2640 and CC2642R1 boards, I thought it unlikely that the high current was due to my custom hardware, but ran the test below to test this assumption.

To determine if the high current consumption by the micro-SD card was independent of my hardware, I tested on a TI CC2642R1 LaunchPad (Rev C silicon) with an Adafruit micro-SD card breakout board attached.  As with the custom CC2642R1 boards, the micro-SD card current through the VCC pin jumped from 0.2 mA to a constant 18.82 mA following the call to f_open. This block diagram of how the current measurement was obtained along with the code used is shown below:

/*
 *  ======== main.c ========
 */

#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <file.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPICC26XXDMA.h>
#include <ti/drivers/I2C.h>
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#include "ti/drivers/SDFatFS.h"
#include "third_party/fatfs/ff.h"
#include <third_party/fatfs/diskio.h>
#include "C:\ti\simplelink_cc2640r2_sdk_2_30_00_28\source\third_party\fatfs\ff.c"
#include "Board.h"

/*
 *
 *  Pin setup for CC2642R1 (rev C silicon) LaunchPad to Adafruit Micro SD card module
 *
 *  --- Launch Pad pin ---    --- Micro SD pin ---
 *          3.3 v                     3.0 v          // VCC
 *          GND                       GND            // GND
 *          DIO10                     CLK            // SCLK
 *          DIO8                      DO             // MISO
 *          DIO9                      DI             // MOSI
 *          DIO21                     CS             // SD CS
 *
 */



SDFatFS_Object myObj;
SDFatFS_Config SDFatFS_config[] =
     {
         { &myObj },
         NULL
     };
uint_least8_t SDFatFS_count = sizeof(SDFatFS_config) / sizeof(SDFatFS_config[0]) - 1;


/* Set this to the current UNIX time in seconds */
const struct timespec ts = {
    .tv_sec = 1469647026,
    .tv_nsec = 0
};

int32_t fatfs_getFatTime(void)
{
    time_t seconds;
    uint32_t fatTime;
    struct tm *pTime;

    seconds = time(NULL);

    pTime = localtime(&seconds);

    fatTime = ((uint32_t)(pTime->tm_year - 80) << 25) |
    ((uint32_t)(pTime->tm_mon) << 21) |
    ((uint32_t)(pTime->tm_mday) << 16) |
    ((uint32_t)(pTime->tm_hour) << 11) |
    ((uint32_t)(pTime->tm_min) << 5) |
    ((uint32_t)(pTime->tm_sec) >> 1);

    return ((int32_t)fatTime);
}


FATFS fs[2];         /* Work area (filesystem object) for logical drives */
FIL fsrc, fdst;      /* File objects */
BYTE buffer[4096];   /* File copy buffer */
FRESULT fr;          /* FatFs function common result code */
UINT br, bw;         /* File read/write count */
BYTE workarea[4096];    /* Work area */

void mainThread()
{

    SDFatFS_Handle sd_handle;
    SDFatFS_init();

    sd_handle = SDFatFS_open(Board_SD0,0);
    if (sd_handle == NULL) {
        //Error opening SDFatFS driver
        while (1);
    }

    /* Open source file, handle errors */
    fr = f_open(&fsrc, "myfile", FA_OPEN_EXISTING | FA_WRITE);
    switch (fr)
    {
    case FR_NO_FILE:
        fr = f_open(&fsrc, "myfile", FA_CREATE_NEW | FA_WRITE);
        System_printf("fr after f_open: %d \n",fr);System_flush();
    default:
        break;
    }

    if(fr != 0)
        while(1);


    /* Write to file, sync, sleep, read, print, repeat ... */
    uint8_t counter = 0;
    char buffer [100];
    int cx;
    while (counter <= 100)
    {

        /* Write count as string to file ... */
        cx = snprintf (buffer, 100, "Count is: %d \r\n", counter);
        System_printf("current count: %d\n",counter);System_flush();
        fr = f_write(&fsrc, buffer, cx, &bw);
        if(fr != 0)
            while(1);

        /* Try to sync */
        fr = f_sync(&fsrc);
        if(fr != 0)
            while(1);

        /* Delay */
        CPUdelay(8000 * (1000));

        counter++;
    }

    /* Close open files */
    f_close(&fsrc);


    while(1)
        CPUdelay(8000 * (1000));

}



/*
 *  ======== main ========
 */
int main()
{
    /* Call driver init functions */
    Board_initGeneral();
    I2C_init();
    SPI_init();
    UART_init();

    // Declare task param structure and task handle
    Task_Params taskParams;
    Task_Handle sampleSensors;

    Error_Block eb;
    Error_init(&eb);
       /* Create 1 task with priority 1 */
    Task_Params_init(&taskParams);
    taskParams.stackSize = 2048;
    taskParams.priority = 1;
    sampleSensors = Task_create((Task_FuncPtr)mainThread, &taskParams, &eb);
    if (sampleSensors == NULL) {
        System_abort("Task create failed");
    }

    //call BIOS_start() enables interrupts and starts the scheduler with BIOS
    BIOS_start();

    return (0);
}



/*
 * Copyright (c) 2015-2017, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

Given that the high current consumption by a micro-SD card discovered on my CC2642R1 custom boards and is also present when using the TI CC2642R1 LaunchPad, I am concerned there is a problem with the TI-supplied software.   Could it be that there is a driver issue where during the f_open call something occurs that does not allow the micro-SD card to return to a normal power state? Was current consumption measured as part of software verification for the current RTOS/FATfs/SDK/CC2642R1 hardware?

To meet our system runtime requirements, we need to return to the 1.5 mA average current. We are hopeful that someone at TI can repeat our tests run on the CC2642R1 LaunchPad and develop a solution.

Thanks,

- Stephen Poanessa

  • Please take a look at e2e.ti.com/.../2908158

    When looking at that thread I got the impression that fopen should be used, not f_open. Do you get the same issue if you rewrite the code to use fopen etc?

    I tried to run your code as is using the SD card holder on the www.ti.com/.../BOOSTXL-SHARP128 but I get FR_NO_FILESYSTEM
  • Hey TER,

    Thanks for your response. I'm pretty confident that f_open is a required call for the FATfs. Additionally, the code I provided was written by a TI Forum member and can be found at in the following post:

    I'm also a little confused since in the link you provided you state that f_open should be used instead of fopen:

    I tried fopen and it did reduce current consumption by 10mA, but I was unable to get data to write to the SD card despite the fopen returning correctly. I am not too surprised by this result since all documentation from  Elm-chan and discussions from a number of my previous TI E2E posts indicated that f_open should be used.

    http://elm-chan.org/fsw/ff/doc/open.html

    As for getting the code to work on your device, try adding the following switch statement:

    case FR_NO_FILESYSTEM:
              fr = f_mkfs("", FM_ANY, 0, workarea, sizeof(workarea));
              fr = f_open(&fsrc, "myfile", FA_CREATE_NEW | FA_WRITE);
              System_printf("fr after f_open: %d \n",fr);System_flush();
              break;

    The code I provided works on my CC2642R1 LaunchPad device so you might also want to verify your pin configuration to your SD card booster pack. Here's a pic you can use for verification:

      If you still encounter issues you might want to refer to the TI written code in the link I provided, provided here again for your convenience:  This code was provided just as a reference, please feel free to use any working code you may have that will allow you to successfully call f_open() within the FATfs API.

     When you get writes to the SD card working could you please measure the current consumption to the SD card?

    Thanks,

    - Stephen Poanessa

  • For my part I see a current increase from 2.5 mA to 10.5 mA Measured the current going to CC2652R + SD) when the code does a SD_read in f_open, more exact on this line:

    /* Single block read */
    if (sectorCount == 1) {
    if ((sendCmd(object->spiHandle, CMD17, sector) == 0) &&

    For you CC2640 system, I would assume you use an old TI-RTOS (2.21?) Have you tried to step through the CC2640 code and checked what is done differently in the f_open call?
  • Hello TER,

    Thanks for your response and for taking the time to verify the of the high current consumption from the SD card.

    I compared SDSPI.c on the CC2640 (TI-RTOS 2.21.0.06) and on the CC2642R1 (3.10.0.53) I was unable to find any notable differences. From what I can see, they are issuing the same commands to the card and are acknowledging the responses in the same manner; however, I don’t have the experience with this code found within TI.

    Now that you have reproduced the high current issue on a TI hardware, it seems likely that other customers will experience the same problems. Could the TI software team address the high power consumption seen when the CC2642R1 accessed a microSD card, please?

    Thanks,
    - Stephen Poanessa
  • Do you have the project you used for the CC2640 testing? I want to run this with my setup to see if it gives lower current in my case before sending a ticket over to R&D. 

  • Hello TER,

    I have the project for our custom board. Please send me an email address and I will forward it too you. If needed I can even send you one of my CC2640 custom boards.

    Thanks
  • The easiest is that if you send me a friend request and then send it as private message.
  • Hey Ter,

    Message has been sent.

    Thanks,
    - Stephen Poanessa
  • Hey TER,

    I just wanted to confirm that you received the project that I sent to your private messages.

    Thanks,
    - Stephen Poanessa
  • I have received it but I haven't looked at it yet.
  • Hi TER,

    We appreciate your help on this. Stephen and I communicated earlier today on this and we are both anxious to hear more from you. If you indeed get a chance to review this and provide additional comments, we would greatly appreciate it.

    Sincerely,
    Chris
  • At the moment I'm trying to find out who I should contact with regards to this driver.
  • Th driver team reproduced the issue and looked at the spec some more and it looks like it's a bug in SDSPI. They suggest to try this code block:

        assertCS(hwAttrs);

     

        if (sendCmd(object->spiHandle, CMD18, sector) == 0) {

            do {

                if (!recvDataBlock(object->spiHandle, buf, SD_SECTOR_SIZE)) {

                    break;

                }

                buf = (void *) (((uint32_t) buf) + SD_SECTOR_SIZE);

            } while (--sectorCount);

     

            /*

             * STOP_TRANSMISSION - order is important; always want to send

             * stop signal

             */

            if (sendCmd(object->spiHandle, CMD12, 0) == 0 && sectorCount == 0) {

                status = SD_STATUS_SUCCESS;

            }

        }

        deassertCS(hwAttrs);

    Please let me know if you manage to use the code/ get the current consumption down. 

  • Hello TER,

    Thanks for your response.  I noticed that the code block provided in your last response is already present in SDSPI.c's SDSPI_read() function shown below.

    That being said I'm not sure where this new code block needs to be inserted.  Could you please post a full copy of SDSPI.c with the fix included? 

    I did attempt to run the device with the if(sectorCount ==1) statement removed, leaving only the if(sendCmd(object->spiHandle, CMD18, sector) == 0) statement and I witnessed no change in the device's current consumption.

    I would also like to understand the root cause of the high current and how the provided code block addresses it.  Could you confirm that this change has been verified to resolve the high current issue on a CC2642R1 launchpad?

        assertCS(hwAttrs);
    
        /* Single block read */
        if (sectorCount == 1) {
            if ((sendCmd(object->spiHandle, CMD17, sector) == 0) &&
                recvDataBlock(object->spiHandle, buf, SD_SECTOR_SIZE)) {
                status = SD_STATUS_SUCCESS;
            }
        }
        /* Multiple block read */
        else {
            if (sendCmd(object->spiHandle, CMD18, sector) == 0) {
                do {
                    if (!recvDataBlock(object->spiHandle, buf, SD_SECTOR_SIZE)) {
                        break;
                    }
                    buf = (void *) (((uint32_t) buf) + SD_SECTOR_SIZE);
                } while (--sectorCount);
    
                /*
                 * STOP_TRANSMISSION - order is important; always want to send
                 * stop signal
                 */
                if (sendCmd(object->spiHandle, CMD12, 0) == 0 && sectorCount == 0) {
                    status = SD_STATUS_SUCCESS;
                }
            }
        }
    
        deassertCS(hwAttrs);

  • Hi Stephen,

    Yes, I believe you put the code block in the correct place: SDSPI_read(). The idea is to always do a multi-block read (CMD18) instead of a single block read (CMD17). CMD18 involves clocking the SD card for any number of blocks, until you send CMD12 to stop the multi-block read.

    Let me talk you through the debug process I went through. I was able to replicate the high current consumption you experience after calling fopen(). I traced this down to a CMD17 that occurred as part of fopen, after which the current draw jumped to 18 mA and stayed there. I noticed that this high current condition also occur if sending a CMD18 instead, but stops after sending CMD12. It turns out you can also send CMD12 after a CMD17 to stop the high current but you get an 'illegal' command response. So the idea was to change SDSPI to always do a multi-block read so that we always sent a CMD12 that would end the high current condition. That was the plan anyways.

    Did you place the modified SDSPI.c file in a folder (/ti/drivers/sd/) in your CCS project?

    In this local SPSDI, if you could put a breakpoint before and after the sendCmd(...CMD18) I'm interested if you can see the high current start when you send CMD18 and end when you send CMD12. It is possible that this was specific to the SD card controller in my SD card, which would be unfortunate.

    Another thing which worked for me, was to send 0xFF after the CS is deasserted. This worked without changing the CMD17/CMD18 logic as stated above. Change the end of the SDSPI_read function to look like this:

        deassertCS(hwAttrs);
    
        // Send FF with high CS to go low power
        uint8_t ffByte = 0xFF;
        spiTransfer(object->spiHandle, NULL, &ffByte, 1);
    
        SemaphoreP_post(object->lockSem);
    
        return (status);


    Thanks,

    Sean

  • Hey Sean,

    Thank you so much for your response. To answer your first question: yes, the SDSPI.c had been removed from the drivers folder and has been imported directly to the project. This was done originally to allow a change in the SPI rate to occur.

    Here are the results from the breakpoint test you requested:

    Line 439: 5.16 mA

    Line 441: 15.15 mA

    Line 451: 15.18 mA

    Line 452: 5.17 mA

     

    With these breakpoints removed and the program running no decrease in overall current consumption was noted. For reference our code running on our boards with the CC2640 consumed between 1-2mA, compared to our new CC2642R1 boards, which consume between 16-20mA.

    It seems as if somehow the newer code doesn’t let the SD card go into low-power mode. Are there other places in the code that differ between the codebases that would result in the higher SDcard currents? 

    Thanks,

    - Stephen Poanessa

  • Stephen,

    Thanks for running that test. I'm guessing you got those current figures from your custom hardware and so those figures are total system draw? What is your idle current draw before f_open()?

    Did you have time to try the extra 0xFF after the end of the read that I mentioned at the end of my last post?

    I tried all the previous versions of the SDSPI driver but the same high current condition exists.

    I've found that SDSPI_write also causes a high current condition. I didn't see it before because if SDSPI_read is called after SDSPI_write, then the current goes back down to sub 1mA. I was able to stop the high current condition after write() by waiting for the SD card to become ready again after the write operation. Now my SDSPI read/write functions look like this:

    /*
     *  ======== SDSPI_read ========
     */
    int_fast16_t SDSPI_read(SD_Handle handle, void *buf, int_fast32_t sector,
        uint_fast32_t sectorCount)
    {
        int_fast16_t         status = SD_STATUS_ERROR;
        SDSPI_Object        *object = handle->object;
        SDSPI_HWAttrs const *hwAttrs = handle->hwAttrs;
    
        if (sectorCount == 0) {
            return (SD_STATUS_ERROR);
        }
    
        SemaphoreP_pend(object->lockSem, SemaphoreP_WAIT_FOREVER);
    
        /*
         * On a SDSC card, the sector address is a byte address on the SD Card
         * On a SDHC card, the sector addressing is via sector blocks
         */
        if (object->cardType != SD_SDHC) {
            /* Convert to byte address */
            sector *= SD_SECTOR_SIZE;
        }
    
        assertCS(hwAttrs);
    
        /* Single block read */
        if (sectorCount == 1) {
            if ((sendCmd(object->spiHandle, CMD17, sector) == 0) &&
                recvDataBlock(object->spiHandle, buf, SD_SECTOR_SIZE)) {
                status = SD_STATUS_SUCCESS;
            }
        }
        /* Multiple block read */
        else {
            if (sendCmd(object->spiHandle, CMD18, sector) == 0) {
                do {
                    if (!recvDataBlock(object->spiHandle, buf, SD_SECTOR_SIZE)) {
                        break;
                    }
                    buf = (void *) (((uint32_t) buf) + SD_SECTOR_SIZE);
                } while (--sectorCount);
    
                /*
                 * STOP_TRANSMISSION - order is important; always want to send
                 * stop signal
                 */
                if (sendCmd(object->spiHandle, CMD12, 0) == 0 && sectorCount == 0) {
                    status = SD_STATUS_SUCCESS;
                }
            }
        }
    
        deassertCS(hwAttrs);
    
        // Send FF with high CS to go low power
        uint8_t ffByte = 0xFF;
        spiTransfer(object->spiHandle, NULL, &ffByte, 1);
    
        SemaphoreP_post(object->lockSem);
    
        return (status);
    }
    
    /*
     *  ======== SDSPI_write ========
     */
    int_fast16_t SDSPI_write(SD_Handle handle, const void *buf,
        int_fast32_t sector, uint_fast32_t sectorCount)
    {
        int_fast16_t        status = SD_STATUS_SUCCESS;
        SDSPI_Object        *object = handle->object;
        SDSPI_HWAttrs const *hwAttrs = handle->hwAttrs;
    
        if (sectorCount == 0) {
            return (SD_STATUS_ERROR);
        }
    
        SemaphoreP_pend(object->lockSem, SemaphoreP_WAIT_FOREVER);
    
        /*
         * On a SDSC card, the sector address is a byte address on the SD Card
         * On a SDHC card, the sector addressing is via sector blocks
         */
        if (object->cardType != SD_SDHC) {
            /* Convert to byte address if needed */
            sector *= SD_SECTOR_SIZE;
        }
    
        assertCS(hwAttrs);
    
        /* Single block write */
        if (sectorCount == 1) {
            if ((sendCmd(object->spiHandle, CMD24, sector) == 0) &&
                transmitDataBlock(object->spiHandle, (void *) buf, SD_SECTOR_SIZE,
                    START_BLOCK_TOKEN)) {
                sectorCount = 0;
            }
        }
        /* Multiple block write */
        else {
            if ((object->cardType == SD_SDSC) || (object->cardType == SD_SDHC)) {
                if (sendCmd(object->spiHandle, CMD55, 0) != 0) {
                    status = SD_STATUS_ERROR;
                }
    
                /* ACMD23 */
                if ((status == SD_STATUS_SUCCESS) &&
                    (sendCmd(object->spiHandle, CMD23, sectorCount) != 0)) {
                    status = SD_STATUS_ERROR;
                }
            }
    
            /* WRITE_MULTIPLE_BLOCK command */
            if ((status == SD_STATUS_SUCCESS) &&
                (sendCmd(object->spiHandle, CMD25, sector) == 0)) {
                do {
                    if (!transmitDataBlock(object->spiHandle, (void *) buf,
                        SD_SECTOR_SIZE, START_MULTIBLOCK_TOKEN)) {
                        break;
                    }
                    buf = (void *) (((uint32_t) buf) + SD_SECTOR_SIZE);
                } while (--sectorCount);
    
                /* STOP_TRAN token */
                if (!transmitDataBlock(object->spiHandle, NULL, 0,
                    STOP_MULTIBLOCK_TOKEN)) {
                    sectorCount = 1;
                }
            }
        }
    
        /* Wait until the SD card is done programming */
        waitUntilReady(object->spiHandle);
    
        deassertCS(hwAttrs);
    
        SemaphoreP_post(object->lockSem);
    
        return ((sectorCount) ? SD_STATUS_ERROR : SD_STATUS_SUCCESS);
    }

    Notice the extra spiTransfer() at the end of SDSPI_read(), and the waitUntilReady() at the end of SDSPI_write(). Hopefully with both read/write tweaked, you will see your total system consumption go down. Let me know how that goes!

    Thanks,

    Sean

  • Hello Sean,

    I replaced the read and write functions with the ones you provided in your latest response and my initial testing appears to affirm the fix. The device is now consuming less than 2mA of current during operation. I will now begin the next round of testing and will be sure to let you know if any abnormal behavior from the updated driver is encountered.

    I can't thank you enough for your assistance with addressing this bug in such a short amount of time. 

    - Stephen Poanessa

  • Stephen,

    Glad to be of assistance! Thank you for reporting this issue. I filed a ticket to get this fix into our development branch so hopefully it will be incorporated into the next release.

    Thanks,

    Sean