Jump to content
43oh

CC3200 MOD bricked with static IP


Recommended Posts

Greetings,

 

I'm almost at the end of my project with my CC3200 sensor board, and I want to thank again people who helped me here, for the SFLS lib and my printf issues.

 

From the begining with energia, I had (minor) issues of bricking my board with no real understanding of WHAT was causing it. I finally took (had) the time to narrow it down to a very specific scheme, so I'd like to pick your brains about it.

 

background :

- started with a launchpad (of the first revisions), tried different service pack, never got issues. That's only when I started with my own board and the CC3200 mod that I had this problem.

- we like to work with static IP with our sensor installs (though we might also use static / reserved addr with DHCP) as we need our programs to talk to specific / individual boards using their IP address. While it's not difficult to setup static DHCP, it becomes attached to the router itself, which makes part replacement and modularity more complicated for what we need.

 

- The problem persists with energia 0013. As its loader isn't compatible with the CC3200 MOD, I've made a customized version of the energia dev package that uses ALL the 0014 source file, loader and even the GCC version but keeps the 0013 software, and it bricks too.

 

symptoms :

- load up the program which configures the system with static IP and connects to the ssid (no security).

- reboot the board, starts normally & connects. Display of the local IP and current net is ok

- a UDP packet has been setup, the program sends a packet every xx ms

 

** IF the AP is disconnected from the LAN or if the recipient IP (destIP in the code below) isn't found or if no packet can be sent (successfully I assume), then further reboot of the board locks up the program when it reaches the WIFI.begin or anything related to the wifi stack (it seems.).

Re uploading the program doesnt' change a thing. The only way to get it to work again is to use uniflash to format the FLASH.

Flashing the mcuimg via uniflash produces the same thing, so it's not linked to the cc3200prog in energia vs uniflash. Flashing the board with uniflash produces the same : board boots, connect but if the destination computers isn't seen, the board stalls on the next reboot.

 

** IF the recipient IP exist and is found on the network and if at least ONE UDP packet is sent it's fine. If the AP on which the CC3200 mod connects to is there and connected to the destination computer but NO UDP packet is sent (commented in the main / loop) then it bricks too.

 

** IF I use DHCP, it works all the time, never got issues

 

Once at least one packet has been sent to the destination IP / computer, further reboot will always work even if the destination computer isn't reachable and further updates of the code will always work.

 

Sometimes, even after I got it right, I still have to format the flash with uniflash and start over. My guess is that my increasing program size ends overwriting things in the flash.

I don't know the details, but I'm afraid the WIFI internals store profiles or non volatile data that energia / cc3200prog never deals with. When in uniflash, the mcuimg is always written first then additional system files and also the new profile / config group files that I haven't messed with. I initially thought that I had to re format / re organize the flash from time to time as my program was growing and was altering somehow the other files.

Now, I don't even re upload / update the config group after erasing the flash and re uploading my program and I still can reproduce the behavior above, if a packet is sent ok on the first boot, further boots work, otherwise, it's bricked.

 

In the code below, I've even tried removing the wificlient and wifiudp libs and calls: it would brick each time (on the second reboot after upload) as the program would not send a thing.

 

I know that most people don't use static IP... so maybe this issue is new to most people. Or I've simply forgotten something super important in the code.

I've narrowed the program to its simplest form, very close to the tutorials.

 

Ideas ?

thanks

#include <stdio.h>
#include <SPI.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>

// your network name also called SSID
char ssid[] = "myssid";
IPAddress LocalIP(192,168,1,40);
IPAddress SubnetMask(255,255,255,0);
IPAddress GatewayIP(192,168,1,1);
IPAddress DestIP(192,168,1,100);

uint16_t DestPort = 8888;

WiFiUDP MyPacket;

void setup() {
  
  //Initialize serial and wait for port to open:
  Serial.begin(115200);
  Serial.println("Booo");
  // attempt to connect to Wifi network:
  Serial.print("connecting to: ");
  // print the network name (SSID);
  Serial.println(ssid); 
  
   // If fixed IP
  WiFi.config(LocalIP, GatewayIP, GatewayIP, SubnetMask);
  //WiFi.config(LocalIP);
  
  WiFi.begin(ssid);
  while ( WiFi.status() != WL_CONNECTED) {
    // print dots while we wait to connect
    Serial.print(".");
    delay(300);
  }
  Serial.println("\nConnected to the network");    
  
   // If DHCP
  /*Serial.println("Waiting for an ip address");
  while (WiFi.localIP() == INADDR_NONE) {
    // print dots while we wait for an ip addresss
    Serial.print(".");
    delay(300);
  }
  Serial.println("\nIP Address obtained");*/
   
  // you're connected now, so print out the status  
  printCurrentNet();
  printWifiData();  
  
  MyPacket.begin(8888);
  MyPacket.beginPacket(DestIP, DestPort);
}

void loop() {
  MyPacket.write((uint8_t*)"/a\0\0,iiiiiiiii\0\0", 52);
  MyPacket.endPacket(); 
  delay(5);
}


void printWifiData() {
  // print your WiFi IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[0], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.println(mac[5], HEX);

  // print your subnet mask:
  IPAddress subnet = WiFi.subnetMask();
  Serial.print("NetMask: ");
  Serial.println(subnet);

  // print your gateway address:
  IPAddress gateway = WiFi.gatewayIP();
  Serial.print("Gateway: ");
  Serial.println(gateway);
}

void printCurrentNet() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption, HEX);
}


Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...