element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
Safe and Sound
  • Challenges & Projects
  • Design Challenges
  • Safe and Sound
  • More
  • Cancel
Safe and Sound
Blog Safe & Sound Wearables - Trackable Safety Helmet for Miners #5: Socket Programming and WiFi Boosterpack
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: msimon
  • Date Created: 24 Mar 2017 8:35 PM Date Created
  • Views 566 views
  • Likes 5 likes
  • Comments 2 comments
  • safe & sound
  • msp432
  • ti-rtos
  • ti
Related
Recommended

Safe & Sound Wearables - Trackable Safety Helmet for Miners #5: Socket Programming and WiFi Boosterpack

msimon
msimon
24 Mar 2017

Kits have arrived and hands become dirty image The next day after kits have arrived, I plugged wifi boosterpack and use the Tera Term for communication. It worked without any coding. Great image Well, not really. I wanted to modify the code but I was stuck because I had never used any RTOS. I could use Energia (which is so like Arduino IDE) examples but I want to learn RTOS. It is challenging myself and learning new skills image I went over the online training course and get the basics of the TI-RTOS. I can't say I know the RTOS yet but I start learning maybe after design challenge, I will be knowing RTOS. There are two notes for noobs related to TI-RTOS. First, If you use Task_sleep(10); it doesn't have a constant period. The period is determined by the config user interface as shown below. Therefore Task_sleep(10); will sleep one second (10 * 100 000 us). Second, If you create a software interrupt (or any other task) and want to use them on code interface, you need to include xds/cfg/global.h library.

 

image

 

I get the glimpse of the TI-RTOS so I moved to programming the wifi boosterpack. The example code under TI-RTOS is configured as a server but I need a client (unless I change the method like reverse RFID). There is User's Guide document ( CC3100/CC3200 SimpleLinkTm Wi-FiRegistered Internet on-a-Chip ) which shows how to configure and use the CC3100 module. Using that guide I have written the following code.

 

Void TCPSetup(char *message)
{
    while(1)
    {
      if(connected == 0)
      {
          // Open WiFi and await a connection
          netIF = socketsStartUp();

          socketHandler = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

          /*
           * SL_AF_INET indicates using IPv4
           * SL_SOCK_STREAM indicates using TCP
           * IPPROTO_TCP
           */

          connected = 1;


          if (socketHandler == -1)
          {
             System_printf("Error: socket not created.\n");
             connected = 0;
          }

          SlSockAddrIn_t Addr;  // Socket settings
          Addr.sin_family = SL_AF_INET;
          Addr.sin_port = sl_Htons(TCPPORT);
          Addr.sin_addr.s_addr = sl_Htonl(IP_ADDR_Server);

          status = sl_Connect(socketHandler, ( SlSockAddr_t *) &Addr, sizeof(SlSockAddrIn_t));
      }


      status = sl_Send(socketHandler, "elemet14", 8, 0 );


     // sl_Close(socketHandler);

      Task_sleep(10);

    }
            // Close the network - don't do this if other tasks are using it
            //socketsShutDown(netIF);

}

 

 

The code (it is a task on TI-RTOS) above connects a network and sends data. It is a task called every second. Next, I need to modify socket library because wifi module is not going to connect to the same access point. Maybe giving the same SSIDs will solve the problem but if they cover the same area it may be a problem. Therefore, my next study will focus on auto connecting the WiFi module and getting the RSSI values.

 

 

On the other hand, I need a server software (Ground Operation Centre ) in order to collect all data and manage the system. I have written simple programs on C# so I prefer it ( while I am writing this, I think about Raspi and Python. Maybe, I can change it). I have written the v0.1 of the Ground Operation Centre program. It is a basic socket program now. However, future versions will include the access control and data collections. You can see a snap of the program here image

 

image

 

You can see all the links related to this project in the first blog: Safe & Sound Wearables - Trackable Safety Helmet for Miners #1: Introduction to Project

 

 

P.S. Sorry for the code snip I couldn't find the how to activate cursor and shorten the length of the code snip. Lol image It is done automatically.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 8 years ago +2
    Nice update. It looks like you found the TI software straight forward to use. DAB
  • msimon
    msimon over 8 years ago in reply to DAB +1
    I thought it will be a good starting point When I combined other things, it is going to be completely different. Mehmet
  • msimon
    msimon over 8 years ago in reply to DAB

    I thought it will be a good starting point image When I combined other things, it is going to be completely different.

     

    Mehmet

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 8 years ago

    Nice update.

     

    It looks like you found the TI software straight forward to use.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

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 © 2025 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

  • X
  • Facebook
  • linkedin
  • YouTube