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.

Question of writing data to SD_card



Hi All,
i'm trying get the LM4f232h5qd to save some data into sd card. In the SD_card example, it used ROM function to set UART port. And I use function without ROM to set my SSI interface. For example,
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);//set UART port
SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOD ) ;// set SSI interface

However, the SD card can work successfully, SSI interface can't. Is the ROM function and without ROM function can't work together? Or in this case, what I should notice?

Any help would be greatly appreciated!

-Unis

  • Both versions of the functions should work.  However, you are losing any benefit of the ROM function if you also call the non-ROM function.  It takes slightly more code and time to call the ROM version of a function than the linked library function.  The advantage of the ROM version is that you don't then have to bring in the code from the library.

    I don't understand your comment above: 

    Hui-Chia YEN said:
    However, the SD card can work successfully, SSI interface can't.
    as the SD card uses the SSI interface.  Perhaps you meant to say something else?

  • First thank you for your answer.

    I use the SSI1 interface to communicate with extern ADC(AD7887), SSI0 is saving data to SD card. I try to receive data from ADC, and save those data into SD card. Do these two SPI interface can work at the same time? Or I should use some delay to let the ADC first and save data latter. Now I can save the data which I get from ADC into SD card. However, the data I receive is wrong. Could you give me some advice when I do this case?Thank you very much.

    Any help would be greatly appreciated!

    -Unis

  • You can use multiple SSI interfaces at the same time.

    What's unclear is if you are ever able to successfully get data from the ADC, even if you don't try to save it to the SD card.  You need to get that part working properly first, then worry about saving the data.

  • Yes, I can get the correct data from ADC when I only use one SPI interface. But it became wrong if I add this ADC communication code into SD card save code. So it can enable two SPI interface at the same time? Or I need to enable ADC part and disable another first, disable ADC and enable SD card part latter?
    If I use two SPI at the same time, what I should notice? clock? or interrupt?

    Thank you very much. Any help would be greatly appreciated!

    -Unis

  • Hui-Chia YEN said:
    it became wrong if I add this ADC communication code into SD card save code

    What, exactly, "became wrong"?

    In what way(s), exactly, was it "wrong"?

    Are you saying that the ADC code stops working, or is it just the SD Card code which doesn't work?

    What debugging have you done to find the cause(s) of the problem(s)...?

  • Hui-Chia YEN said:
    i'm trying get the LM4f232h5qd to...

    So why are you posting in the LM3S forum?!

  • So why are you posting in the LM3S forum?!

    Possibly because it's not easy to make out that this are actually two fora ...

    But to the OP:

    Are you using interrupts for ADC/SSI ?

    If so, how are the priorities ? Have you thought about this ?

    Do you call time-consuming functions from within an interrupt handler ?

  • In fact, I hadn't realized that the LM4F now had its own forum until this thread.  It certainly wasn't made obvious that the forum had been added if you didn't go up levels and look around.  Perhaps some announcement in the LM3S forum is warranted to alert people that there are again multiple Stellaris forums.

    I had switched to monitoring just the Stellaris forum during the period when it was the only Stellaris forum on the site, and you could not look at messages beyond the first page if you were one level up.  That forum became the LM3S forum and I didn't notice the switch.