Kits have arrived and hands become dirty The next day after kits have arrived, I plugged wifi boosterpack and use the Tera Term for communication. It worked without any coding. Great 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 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.

 

 

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 SimpleLink™ Wi-Fi® 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

 

ezgif-1-eae1499308.gif

 

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 It is done automatically.