Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / UDP LinkSprite CuHead Wifi Connection on: April 23, 2013, 08:59:06 pm
Haven't had much success getting help on the LinkSprite forum, so I thought I'd try here.  I've got a LinkeSprite Copperhead Wifi connected to an Arduino Nano.  I've been successful getting the WiServer examples working, i.e., SimpleServer and SimpleClient, but the UDPApp only sets up a basic connection (which isn't verified).  I'm trying to add the uip commands to verify the connection (tried using their canned Wifi.init() and manually using the binding function) and eventually send packets, but only get a zero (no connection) when I print out the status.  Any ideas?

Here is the code (network info removed):

Code:
* UDP endpoint
 *
 * A simple UDP endpoint example using the WiShield 1.0
 */

#include <WiShield.h>
#include <string.h>

extern "C" {
  #include "uip.h"
  #include "udpapp.h"
}

#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
#define STATE_INIT              0
static struct udpapp_state s;
uip_ipaddr_t addr;
struct uip_udp_conn *c;

int connection;

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,10,100}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,10,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"NetworkNameHere"}; // max 32 bytes

unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"PassCodeHere"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
//---------------------------------------------------------------------------

void setup()
{
  Serial.begin(9600);
  Serial.println("Starting Connection");
 
/*
  udpapp_init();
//   This is what is in udpapp_init; I changed the ip address
     and port in udpapp.c to match my system
     
  uip_iaddr(&addr, 192,168,10,100);
  c = uip_udp_new(&addr, HTONS(8888));
  if(c != NULL) {
    uip_udp_bind(c, HTONS(8887));
  }
 */
 
 
  WiFi.init();

  connection = uip_connected();
  Serial.print("The host is connected: ");
  Serial.println(connection);


}

void loop()
{

/*
char str[] = "Hello World.\n";
memcpy(uip_appdata, str, strlen(str));
uip_send(uip_appdata, strlen(str));
        uip_process(4);
*/
WiFi.run();
}
2  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 06:02:30 pm
Hi Tim - Thanks.  Looks like I may have to do some research on DFU programming from Windows and then try the firmware update.  Derek
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 09, 2013, 07:46:17 pm
Anyone know how you would to the Update Shield step on Windows?  I guess runas is supposed to be the equivalent of sudo, but it still needs an executable.
Pages: [1]