element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Sudden Impact Wearables Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sudden Impact Wearables Design Challenge
  • More
  • Cancel
Sudden Impact Wearables Design Challenge
Blog [real_time_monitor] Real Time Player Monitoring System Post#3 : Playing with CC3200 for SD Card Interfacing
  • Blog
  • Forum
  • Documents
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ravi_butani
  • Date Created: 23 Dec 2014 7:10 AM Date Created
  • Views 61 views
  • Likes 2 likes
  • Comments 2 comments
  • tektronix
  • sudden_impact
  • real_time_monitor
  • sd_card
  • cc3200_launchpad
  • analog_devices
  • petit_fatfs
  • electrolube
Related
Recommended

[real_time_monitor] Real Time Player Monitoring System Post#3 : Playing with CC3200 for SD Card Interfacing

ravi_butani
ravi_butani
23 Dec 2014

Table of Contents

<< Previous

Next >>


In my previous post [real_time_monitor] Real Time Player Monitoring System Post#2 : Playing with CC3200 for UDP communication ,I have discussed UDP communication between CC3200 and PC/Android Cell Phone..

 

As all real time data of accelerometer and other sensor will be stored in SD card for future analysis purpose.. This week I have completed some test on interfacing SD card with CC3200 Launch pad to write real time data...

 

Energia sketch for cc3200 used in this test is below...

 

/* copy the two files t_read.txt and t_write.txt from the example folder in the root of the sd card*/


/* Attribute : http://elm-chan.org for providing Petit FatFS library
/* Modified By Ravi Butani to write accelerometer data on SD Card... As A part of Sudden Impact Design Challenge*/
/* Released Under CC-SA 2014 */



#include "SPI.h"
#include "pfatfs.h"
#include <Wire.h>
#include <BMA222.h>




#define cs_pin      18              // chip select pin
#define read_buffer 128            // size (in bytes) of read buffer


  unsigned short int bw, br;//, i;
  char buffer[read_buffer];
  char tosd_buf[15];
  int rc;
  DIR dir; /* Directory object */
  FILINFO fno; /* File information object */
  BMA222 mySensor;
void setup() {
Serial.begin(9600);
        pinMode(PUSH2, INPUT_PULLUP);
          mySensor.begin();
          uint8_t chipID = mySensor.chipID();
          Serial.print("chipID: ");
          Serial.println(chipID);
                    // initialize the serial terminal
        FatFs.begin(cs_pin);            // initialize FatFS library calls
        }
void die ( /* Stop with dying message */
        int pff_err /* FatFs return value */
        )
        {
        Serial.println();Serial.print("Failed with rc=");Serial.print(pff_err,DEC);
        for (;;) ;
  }




/*-----------------------------------------------------------------------*/
/* Program Main                                                          */
/*-----------------------------------------------------------------------*/


void loop()
{
        Serial.println();
        Serial.println("Press button to start...");
        while(digitalRead(PUSH2)==1){}
        delay(100);
        while(digitalRead(PUSH2)==0){}

        Serial.println();
  Serial.println("Open a file to write (t_write.txt).");
  delay(100);
        rc = FatFs.open("T_WRITE.TXT");
  if (rc) die(rc);


  Serial.println();
        Serial.println("Write a text data. (10 x Hello world!)");
        delay(100);
        bw=0;
        for (uint16_t i=0;i<1000;i++) {
                String tosd = String(mySensor.readXData())+","+ String(mySensor.readYData()) + ","+String(mySensor.readZData())+"\r\n";
  tosd.toCharArray(tosd_buf, 15);
                rc = FatFs.write(tosd_buf, 15, &bw);
                if (rc || !bw) break;

  }
  if (rc) die(rc);

  rc = FatFs.write(0, 0, &bw);  //Finalize write
  if (rc) die(rc);




}

 

I have used Petit FatFs port for Stellaris which works just great with cc3200...

link of thread from which I have downloaded this library is http://forum.43oh.com/topic/3209-energia-library-petit-fatfs-sd-card-library/

 

Some limitation of this port is it cant create file on SD card... File needs to be initially created with required size using following command on cmd.exe run under admin privileges


fsutil file createnew t_write 1500

 

Pin mapping with with standard SD card and CC3200 is as below..

 

SD(SPI)  CC3200

VSS1          GND 

VSS2          GND 

VDD            VCC     

DO              MISO 

DI                MOSI 

CLK            SCLK

CS              CS(18)

 

Here is Pin out os SD and microSD Card for quick reference...

(image : Reading an SD card with an ATMEGA168)


CC3200 LaunchPad Pin out for energia is below..




















(image:http://energia.nu/wordpress/wp-content/uploads/2014/09/cc3200lppinmap.jpg)



chipchap connection between cc3200 and SDcard is as below..

 

After all this test, I have converted *.txt file, written by cc3200 Launchpad on SDCard  to *.csv file and here is screen shot of the results.. As now all data in *.csv, format it can be used for create informative graphs...

This all about this week ... I have found this ADXL377 and ADXL345 free samples (By ADI) from my work place...

Mean while I receive parts as part of this challenge I am planning to interface this Accelerometers with CC3200 in next days..

 

Happy Holidays..

 

Ravi

Anonymous

Top Comments

  • DAB
    DAB over 7 years ago +1

    Nice post.

     

    I was wondering if you could setup the CC3200 as a data logging device.

    Looks like you have the answer.

     

    DAB

  • janisalnis
    janisalnis over 7 years ago +1

    Thanks for writing a very nice demonstration how to use SD card with CC3200.

    I did not expect that it is so easy with Energia to make a data logger.

     

    Your blog post did not have Iot as a Tag, so I have missed…

  • janisalnis
    janisalnis over 7 years ago

    Thanks for writing a very nice demonstration how to use SD card with CC3200.

    I did not expect that it is so easy with Energia to make a data logger.

     

    Your blog post did not have Iot as a Tag, so I have missed your post when it appeared. Found just today when was checking review links that Christopher Stanton has published..

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Nice post.

     

    I was wondering if you could setup the CC3200 as a data logging device.

    Looks like you have the answer.

     

    DAB

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube