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.

SDSPI does not support cc26xx

Other Parts Discussed in Thread: CC2650, CC3200, CC1310

I am interfacing my cc2650 + smartrf06eb board with sd card over spi but still i did not found any driver which support FatFs or any other file system. Please suggest me which driver file support cc26xx or any other way to do file operation.

  • Rajneesh,

    Unfortunately, we do not have SDSPI driver support for CC2650. You may have to write one yourself. The existing SDSPI drivers (especially SDSPITiva) can be used as a starting point. Have a look at <TI_RTOS_install_dir>/packages/ti/drivers/sdspi directory. I also recommend looking at the other CC2650 drivers for pin mux and other board setup information.

    Vikram
  • Thanks for reply, 

    CC3200 and Tiva have SDSPi driver SDSPI3200 and SDSPITiva. In these driver have been used driverlib which are not available in CC26xx. In short still i am unable to create text file in sd card.

    Regards,

    Rajneesh

  • Rajneesh,

    The driverlib for CC26XX is shipped with the TI-RTOS product. You can find it in <TI_RTOS_install_dir>/products/cc26xxware_2_22_00_16101.

    You can directly add the SDSPITiva.c and SDSPITiva.h to your project and modify it for CC26XX. But make sure you update the SDSPI details in your board files for CC26XX.

    Vikram
  • Hi Vikram.,

    I seen this link : 

    e2e.ti.com/.../1648783

    There are initialize VL01_initSDSPI for Configure pad settings but in case of cc26xx there are no any api for do this. Is it necessary in cc26xx?

    Regards,

    Rajneesh 

  • I have modify SDSPITiva.c and SDSPITiva.h according to cc26xx and modify HWAttrs, SDSPI_config, CC26XXObjects.  When I call SDSPI_open its returns proper handle but cant create any file in sdcard. Tell me  Any configuration is needed for FATFs system?

  • Rajneesh,

    Were you able to port the driver to CC26XX?

    Vikram
  • Hi Vikram,

    Yes I am able to port SDSPITiva driver on CC26xx with some modification of driverlib but when its call lower driver library like ssi its get stuck. And I am not resolve this issues. Its get stuck when execute this function SSIDataGet(hwAttrs->baseAddr, &dat). Can you help how to solve this issues. Instead of ssi driver we can use another driver to solve this problem.

    Rajneesh
  • Hi Rajneesh,

    Your question is related to the driverlib. Can you please post your question on the device forum for a faster response?

    Thanks,
    Vikram
  • Hi Rajneesh,

    As previously said, you should use the SPI interface found in ti/drivers/SPI.h when writing the SD card driver as this driver handles power management, interrupts etc.
    You should not need to use the internal driverlib calls and these do not handle power management for you so "get stuck" as you mention is probably because you ended up with a CPU exception due to a bus fault.

    Regards,
    Svend
  • Hi Svend,

    I have interfaced sdspi driver for cc26xx. Take reference of SDSPITiva driver to make compatible for CC26xx  and make changes according to SPI and PIN driver  and add Power management.

    SSIDataPut(hwAttrs->baseAddr, 0xFF);

    /* Flush data read during data write. */
    SSIDataGet(hwAttrs->baseAddr, &dat);

    I am confuse above two function call. When SSIDataGet call its wait for data as infinite time.

    Have you any solution for ssi.c/h make running in SDSPI driver or any other way? 

    I have read SDSPI driver for SD card use SPI(SSI) bus.

    Regards,

    Rajneesh

  • Hello ,
    I am doing the same thing as Rajneesh, using his code attached in the previous code, but modified to work with CC1310. I replaced the words SDSPICC26XX and included the SPI pin conigurations for my board. Is there any other modifications needed?
    When I build my project I get the following error:

    unresolved symbol SDSPI_config, first referenced in C:/ti/tirtos_cc13xx_cc26xx_2_20_00_06/products/tidrivers_cc13xx_cc26xx_2_20_00_08/packages/ti/drivers/lib/drivers_cc13xxware.aem3<SDSPI.oem3> rfEasyLinkRx_CC1310_LAUNCHXL_TI_CC1310F128 C/C++ Problem

    Could you explain why there would be an error in an .aem3 file? what does this refer to and how could I fix this?

    Thanks for any insight.
    ~Nathaly
  • --Edit:

    In fact, there are more than one errors. One of them refers to available space. May that have something to do with it? Below are all the 6 build errors:

    -#10010 errors encountered during linking; "rfEasyLinkRx_CC1310_LAUNCHXL_TI_CC1310F128.out" not built

    -<a #10099-D</a> program will not fit into available memory. run placement with alignment fails for section ".bss" size 0x223f1 . Available memory ranges:

    -<a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain

    -gmake: *** [rfEasyLinkRx_CC1310_LAUNCHXL_TI_CC1310F128.out] Error 1

    -gmake: Target 'all' not remade because of errors.

    -unresolved symbol SDSPI_config, first referenced in C:/ti/tirtos_cc13xx_cc26xx_2_20_00_06/products/tidrivers_cc13xx_cc26xx_2_20_00_08/packages/ti/drivers/lib/drivers_cc13xxware.aem3<SDSPI.oem3>
  • Hi Nathaly,

    Vikram is on vacation now, so I will fill in for him.  You need to add the SDSPI_config structure to your <board>.c file.  For example, here is the SPI_config:

    /* Include drivers */
    #include <ti/drivers/spi/SPICC26XXDMA.h>

    /* SPI objects */
    SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1310_LAUNCHXL_SPICOUNT];

    /* SPI configuration structure, describing which pins are to be used */
    const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1310_LAUNCHXL_SPICOUNT] = {
        {
            .baseAddr           = SSI0_BASE,
            .intNum             = INT_SSI0_COMB,
            .intPriority        = ~0,
            .swiPriority        = 0,
            .powerMngrId        = PowerCC26XX_PERIPH_SSI0,
            .defaultTxBufValue  = 0,
            .rxChannelBitMask   = 1<<UDMA_CHAN_SSI0_RX,
            .txChannelBitMask   = 1<<UDMA_CHAN_SSI0_TX,
            .mosiPin            = Board_SPI0_MOSI,
            .misoPin            = Board_SPI0_MISO,
            .clkPin             = Board_SPI0_CLK,
            .csnPin             = Board_SPI0_CSN
        },
        {
            .baseAddr           = SSI1_BASE,
            .intNum             = INT_SSI1_COMB,
            .intPriority        = ~0,
            .swiPriority        = 0,
            .powerMngrId        = PowerCC26XX_PERIPH_SSI1,
            .defaultTxBufValue  = 0,
            .rxChannelBitMask   = 1<<UDMA_CHAN_SSI1_RX,
            .txChannelBitMask   = 1<<UDMA_CHAN_SSI1_TX,
            .mosiPin            = Board_SPI1_MOSI,
            .misoPin            = Board_SPI1_MISO,
            .clkPin             = Board_SPI1_CLK,
            .csnPin             = Board_SPI1_CSN
        }
    };

    /* SPI configuration structure */
    const SPI_Config SPI_config[] = {
        {
             .fxnTablePtr = &SPICC26XXDMA_fxnTable,
             .object      = &spiCC26XXDMAObjects[0],
             .hwAttrs     = &spiCC26XXDMAHWAttrs[0]
        },
        {
             .fxnTablePtr = &SPICC26XXDMA_fxnTable,
             .object      = &spiCC26XXDMAObjects[1],
             .hwAttrs     = &spiCC26XXDMAHWAttrs[1]
        },
        {NULL, NULL, NULL}
    };

    You need to do something similar for SDSPI.

    Best regards,

    Janet

  • Thanks Janet, 

      I added the necessary code. But now I get a memory size error. I tried disabling the peripherals in <board>.c and <board>.h files as it says in the comments ( so I commented out I2C, ADC, GPTimer, etc) 

    This is the error: 

    #10099-D program will not fit into available memory. run placement with alignment fails for section ".bss" size 0x22641 . Available memory ranges: 

    1) Note that the available memory ranges are not shown

    2) is the size shown (0x22461) a number in bytes? does it refer to the size of my code, or the limit available? I built my code with all the ADC and without it and this number is still the same.

    3) How do I know which available memory is being used here? Does it refer to RAM or flash? I am using CC1310, which has 20 KB of RAM and 128 KB of FLASH.

    Thanks for your guidance

     

  • Hi Nathaly,

    Your code is not fitting into memory.  The size of your .bss section 0x 0x22641 bytes.  You can see how much memory you have available by looking at your linker command file.  For example, this is from the CC2650DK_71D linker command file:

    #define FLASH_BASE              0x0
    #define FLASH_SIZE              0x20000
    #define RAM_BASE                0x20000000
    #define RAM_SIZE                0x5000

    /* System memory map */

    MEMORY
    {
        /* Application stored in and executes from internal flash */
        FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
        /* Application uses internal RAM for data */
        SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
    }

    /* Section allocation in memory */

    SECTIONS
    {
        .text           :   > FLASH
        .const          :   > FLASH
        .constdata      :   > FLASH
        .rodata         :   > FLASH
        .cinit          :   > FLASH
        .pinit          :   > FLASH
        .init_array     :   > FLASH
        .emb_text       :   > FLASH
        .ccfg           :   > FLASH (HIGH)

    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
        .TI.ramfunc     : {} load=FLASH, run=SRAM, table(BINIT)
    #endif
    #endif
        .data           :   > SRAM
        .bss            :   > SRAM
        .sysmem         :   > SRAM
        .stack          :   > SRAM (HIGH)
        .nonretenvar    :   > SRAM
    }

    For this device, .bss is placed in SRAM which has size 0x5000 bytes.  You can look in your map file to see what is taking up so much of .bss.

    Best regards,

    Janet

  • I see. Where can I find this linker file, or the map file?
  • The linker command file should be in your CCS project. If you import any TI-RTOS driver example with the CCS Resource Explorer, you will see a .cmd file in the project, named <board>.cmd (e.g. CC2650DK_7ID.cmd). The map file will be in the Debug or Release subdirectory of the project, depending on the configuration you are building.
    Best regards,
    Janet
  • Hi Janet, 

      I got the files, and indeed I can see .bss is assigned to SRAM which is 4K in the .cmd file. In the map, i can see that .bss is not initialized because it takes around 21K.  I tried changing .bss to go into FLASH and made sure to apply the W (write) attribute to the Flash description. Builds fine, but when I go to debug I still get an error:

    One or more sections of your program falls into a memory region that is not writable.  These regions will not actually be written to the target.

    --Is there a correct way to write to FLASH instead of SRAM?

    So when I look further into the memory map, I can see what is inside of .bss that takes up so much space:

    00020000     rfExamples_pem3.oem3 (.bss:data$1)

    --So I would like to reduce this file! Is this trying to include all the example files in with my code? Is this coming from an include directory that I gave too high level an address?

    Thanks,

    ~Nathaly

  • Hi Nathaly,

    No, you can't put .bss in Flash.  I would look at the map file and see what is taking up so much of .bss.  Maybe you can reduce that somehow.

    Best regards,

    Janet

  • HI Rajneesh,
    I meet same problem like you ,I have post SDSPITiva.c and SDSPITiva.h to my project, I call SDSPI_open function, it returns a handle ,but no file cant be created in sdcard, other configuration is needed ? I use a example in C:\ti\tirtos_simplelink_2_13_00_06\packages\examples\source\fatsd. I rebulid a project use fatsd.c and fatsd.cfg , I think post SDSPICC26XX maybe have a problem in SDSPICC2650_open().Can you tell me a solution about this,thinks

    Terminal I/O display like this:
    Starting the FatSD example
    Drive 0 is mounted
    Creating a new file "fat:0:input.txt"...Error: "fat:0:input.txt" could not be created.
    Please check the Getting Started Guide if additional jumpers are necessary.
    Aborting...


    board.c configuration as follow:


    /*
    * ========================== SDSPI begin ===================================
    */
    /* Place into subsections to allow the TI linker to remove items properly */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_SECTION(SPI_config, ".const:SPI_config")
    #pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs")
    #endif

    /* Include drivers */
    #include <ti/drivers/sdspi/SDSPICC2650.h>
    #include <ti/drivers/SDSPI.h>
    /* SDSPI objects */
    SDSPICC2650_Object sdspiCC2650_Object[CC2650_SPICOUNT];

    // From board.c


    /* SDSPI configuration structure, describing which pins are to be used */
    const SDSPICC2650_HWAttrs sdspiCC2650HWAttrs[CC2650_SPICOUNT] = {
    {/* SRF06EB_CC2650_SPI0 */
    .baseAddr=SSI0_BASE,

    /*! SPI Peripheral's power manager ID */
    .powerMngrId = PERIPH_SSI0,

    /*!< SSI SCK pin */
    .pinSCK=Board_SPI0_CLK,


    /*!< SSI MISO pin */
    .pinMISO=Board_SPI0_MISO,


    /*!< SSI MOSI pin */
    .pinMOSI=Board_SPI0_MOSI,

    /*!< GPIO Pin used for the chip select */
    .pinCS=Board_SPI0_CSN
    }
    };

    /* SPI configuration structure */
    const SDSPI_Config SDSPI_config[] = {
    /* SRF06EB_CC2650_SPI0 */
    {&SDSPICC2650_fxnTable, &sdspiCC2650_Object[0], &sdspiCC2650HWAttrs[0]},
    {NULL, NULL, NULL},
    };

    SDSPICC2650_open configuration as follow:

    /*
    * ======== SDSPICC2650_open ========
    * Function to mount the FatFs filesystem and register the SDSPICC2650 disk
    * I/O functions with SYS/BIOS' FatFS module.
    *
    * This function also configures some basic GPIO settings needed for the
    * software chip select with the SDCard.
    *
    * @param handle SDSPI handle
    * @param drv Drive Number
    * @param params SDSPI parameters
    */
    SDSPI_Handle SDSPICC2650_open(SDSPI_Handle handle,
    unsigned char drv,
    SDSPI_Params *params)
    {
    DRESULT dresult;
    FRESULT fresult;
    unsigned int key;
    Types_FreqHz freq;

    SDSPICC2650_Object *object = handle->object;
    SDSPICC2650_HWAttrs const *hwAttrs = handle->hwAttrs;

    /* Determine if the device was already opened */
    key = Hwi_disable();
    if (object->driveNumber != DRIVE_NOT_MOUNTED) {
    Hwi_restore(key);
    return (NULL);
    }
    /* Mark as being used */
    object->driveNumber = drv;
    Hwi_restore(key);

    /* Store the SDSPI parameters */
    if (params == NULL) {
    /* No params passed in, so use the defaults */
    params = (SDSPI_Params *) &SDSPI_defaultParams;
    }

    /* Determine time scaling for ms timeouts */
    Timestamp_getFreq(&freq);
    mSScalingFactor = freq.lo / 1000;
    Assert_isTrue(mSScalingFactor != 0, NULL);

    /* Store desired bitRate */
    object->bitRate = params->bitRate;

    IOCPinTypeSsiMaster(hwAttrs->baseAddr,hwAttrs->pinMISO,hwAttrs->pinMOSI,hwAttrs->pinCS, hwAttrs->pinSCK);//???

    /* Pin used for Chip Select */
    IOCPinTypeGpioOutput(hwAttrs->pinCS); //????

    /* Raise the chip select pin */
    GPIOPinWrite( hwAttrs->pinCS, hwAttrs->pinCS);//??

    /* Register power dependency - i.e. power up and enable clock for SPI. */
    Power_setDependency(hwAttrs->powerMngrId);


    /*
    * Configure the SPI bus to 400 kHz as required per SD specs. This frequency
    * will be adjusted later once the SD card has been successfully initialized
    */
    BIOS_getCpuFreq(&freq);
    SSIConfigSetExpClk(hwAttrs->baseAddr, freq.lo, SSI_FRF_MOTO_MODE_0,
    SSI_MODE_MASTER, 400000, 8);

    Log_print2(Diags_USER1, "SDSPI:(%p) CPU freq: %d; SDSPI freq to 400000 kHz",
    hwAttrs->baseAddr, freq.lo);

    SSIEnable(hwAttrs->baseAddr);

    /* Register the new disk_*() functions */
    dresult = disk_register(object->driveNumber,
    SDSPICC2650_diskInitialize,
    SDSPICC2650_diskStatus,
    SDSPICC2650_diskRead,
    SDSPICC2650_diskWrite,
    SDSPICC2650_diskIOctrl);

    /* Check for drive errors */
    if (dresult != RES_OK) {
    Log_error1("SDSPI:(%p) disk functions not registered",
    hwAttrs->baseAddr);

    SDSPICC2650_close(handle);
    return (NULL);
    }

    /*
    * Register the filesystem with FatFs. This operation does not access the
    * SDCard yet.
    */
    fresult = f_mount(object->driveNumber, &(object->filesystem));
    if (fresult != FR_OK) {
    Log_error2("SDSPI:(%p) drive %d not mounted",
    hwAttrs->baseAddr, object->driveNumber);

    SDSPICC2650_close(handle);
    return (NULL);
    }

    /* Store the new SDSPI handle for this FatFs drive number */
    sdspiHandles[drv] = handle;

    Log_print1(Diags_USER1, "SDSPI:(%p) opened", hwAttrs->baseAddr);

    return (handle);
    }
  • Hi Janet,
    Can you explain me about the question that has been mentioned before,Thanks for your guidance
  • Hi,
    We generally discourage posting a new question to an old closed thread because the person who answered before may no longer be available, and also it will allow whomever is currently assigned to monitor the forum to respond to you more quickly. For these reasons, I suggest you start a new thread with your question and reference this thread.
  • Hello to everybody,

    I have the same problem. I have built my code for SDSPICC2650 and I have done all the changes that are required but a file cannot be created in the SD card.

    Could you please help me with any advice. I would like to discuss this issue with someone who has already managed to create/read/write a file in a sd card of CC26XX.
    I am looking forward to hearing frm you.
    Kin regards,