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.

SD card with SDSPI library without TI-RTOS

Other Parts Discussed in Thread: ENERGIA, CC2650

Hello, I am having trouble using the SDSPI library example from the TI Resource Explorer

Some basic information:

IDE: CCSv6

Hardware Platform: MSP432P401R LaunchPad

SD Card Module: one similar to this

I want use Bluetopia with SDSPI, so I can't use the TI-RTOS. 

I can compile the code, but I can't define : extern const SDSPI_FxnTable SDSPIMSP432_fxnTable;

any idea?

  • Hi Tommaso,

    Can you confirm for me that you are using the latest version of TIRTOS?

    Gilbert
  • Yes, I'm using the last version of TI-RTOS

    Tommaso

  • Where are you trying to define the extern? Have you made sure to include <ti/drivers/SPSPI.h> and that your project is pointing to TI driver's in TIRTOS's products directory?

    Gilbert
  • /*
     *  ======== fatsd.c ========
     */
    #include "msp.h"
    #include "driverlib.h"
    
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include "fatsd.h"
    #include "SDSPI.h"
    #include "SDSPI.c"
    #include <ti/drivers/ports/DebugP.h>
    #include <ti/drivers/ports/HwiP.h>
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerMSP432.h>
    #include <ti/drivers/sdspi/SDSPIMSP432.h>
    #include <stdbool.h>
    #include <rom.h>
    #include <rom_map.h>

    there is no error about #include 

    the SDSPIMSP432_fxnTable is defined in SDSPIMSP432.c but CCS can't find it with external command

  • Okay. I'm going to assume you are talking about the extern that already exists in SDSPIMSP432.h at line 94?

    A couple things first though:

    1. Do not include .c files. It causes more trouble than it's worth.
    2. Is there a reason you need to use a custom SDSPI instead of the one we have in TI drivers?

  • Yes at line 94.

    1) Ok, but I will get a "unresolved simbol SDSPI_..." if I don't include the .c
    2) I have added the TI folder in "include option" of the project

    In the while thank you for your help.
  • Is it possible for you to share your project on here? Or at the very least, some of your build settings such as your include paths. I've tried a few things to replicate your error on my end, but I'm still not seeing it.
  • #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <stdbool.h>
    
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/SDSPI.h>
    #include <ti/drivers/sdspi/SDSPIMSP432.h>
    
    #include "fatsd.h"
    #include "msp.h"
    #include "driverlib.h"
    
    #include "MSP_EXP432P401R.h"
    
    
    
    
    
    /*
     *  ======== taskFxn ========
     *  Task to perform a file copy
     *
     *  Task tries to open an existing file inputfile[]. If the file doesn't
     *  exist, create one and write some known content into it.
     *  The contents of the inputfile[] are then copied to an output file
     *  outputfile[]. Once completed, the contents of the output file are
     *  printed onto the system console (stdout).
     *
     *  Task for this function is created statically. See the project's .cfg file.
     */
    
    
    void INIT_SDCARD(void){
    
        /* Call board init functions */
    	SDSPI_init();
    
    }
    
    int taskFxn(void){
    
        SDSPI_Handle sdspiHandle;
        SDSPI_Params sdspiParams;
    
        /* Variables for the CIO functions */
        FILE *src;
    
        /* Variables to keep track of the file copy progress */
        char nomefile [20];
        int index;
        int jdex;
    
        /* Mount and register the SD Card */
        SDSPI_Params_init(&sdspiParams);
        sdspiHandle = SDSPI_open(Board_SDSPI0, DRIVE_NUM, &sdspiParams);
        if (sdspiHandle == NULL) {
            //ERROR
        	return -1;
        }
        sprintf(nomefile,"fat:0:%5d.txt",numerofile);
        numerofile++;
        src = fopen(nomefile, "w+");
        if (!src) {
        	return -2;
        }
        for( index = 0; index < 60 ; index++){
           for( jdex = 0; jdex < 80 ; jdex++){
        	   fprintf(src,"%X;",lepton_image[index][jdex]);
           }
           printf( "\n" );
        }
        fflush(src);
    
        /* Reset the internal file pointer */
        rewind(src);
    
        /* Close both inputfile[] and outputfile[] */
        fclose(src);
    
        /* Stopping the SDCard */
        SDSPI_close(sdspiHandle);
    //    System_printf("Drive %u unmounted\n", DRIVE_NUM);
    
        return 0;
    
    }

  • Well, I'm having problems getting it to build, but not because of the issues you stated.

    I'd try re-import the fatsd example (you will most likely have to rename your previous version) and slowly introduce the changes you need and see if you still have issues.

    At the end of the day, TI drivers has been developed and tested in an RTOS environment. What are the issues with having Bluetopia and TIRTOS in the same application?
  • Did you find any solution on the topic?

    Thank you,
  • Yes, I used an external open source library

  • Hello,

    Thank you for your response.Did you use Code Composer Studio or Energia?

    I use code composer studio ccsv7 and I have built all the libraries but the SPI doesn't respond.

    Any help or guideline, please?

  • Hello,

    I work on CCS and I never had some problem with the SPI. Check the library and try to follow some examples.
  • Dear Tommaso,

    I would like to thank you for your message. I use CCS and currently, I am working on the CC2650.
    I have seen the libraries and the existed examples. I can read/write raw data through SPI. The problem is when I try to interface a SD Card, as I mention to this link: e2e.ti.com/.../2151952
    and I cannot understand why my SPI doesn't respond. To be more precise, sometimes the SPI gives MISO/MOSI signals, sometimes gives nonesignal and other times, says that the clock settings don't match with the initial (idle) state, provided that I give specific declaration for the clock POL and PHAse!
    If you have any tip to share with me, please don't hesitate.

    Thank you,