I'm trying to write a program and I can't seem to get the USBSerial to work along with the cc3000. In the code below, if I uncomment the line where "wifi" is declared and initialized as a cc3000 class my terminal program cannot open the serial port. With the code as shown below the USBSerial works and I can see output in my terminal program. The really odd thing to me is that I copied the creation of the cc3000 from the kitchen sink example and that code works properly and I can see output in my terminal! Any help with that is going on is greatly appreciated!
- Code: Select all
/**
*
* UPnP Wireless Gague.<br/>
* This program is upnp:BasicDeveice:1 template.
*
*/
#include "mbed.h"
#include "cc3000.h"
#include "wifi.h"
#include "UDPSocket.h"
#include "USBSerial.h"
using namespace mbed_cc3000;
//cc3000 wifi(p28, p27, p30, SPI(p21, p14, p37));
USBSerial pc;
#define SERIAL_BAUD_RATE 115200
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
const uint8_t smartconfigkey[] = {0x73,0x6d,0x61,0x72,0x74,0x63,0x6f,0x6e,0x66,0x69,0x67,0x41,0x45,0x53,0x31,0x36};
#else
const uint8_t smartconfigkey = 0;
#endif
const char* UDP_BROADCAST = "239.255.255.250";
const int SSDP_PORT = 1900;
// ------------------------------------------------------------------------------------------------------------
/*!
@brief Init
*/
// ------------------------------------------------------------------------------------------------------------
void init()
{
NVIC_SetPriority(SSP1_IRQn, 0x0);
NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
// SysTick set to lower priority than Wi-Fi SPI bus interrupt
NVIC_SetPriority(SysTick_IRQn, 0x2);
// Enable RAM1
LPC_SYSCON->SYSAHBCLKCTRL |= (0x1 << 26);
}
int main()
{
init();
wait(1);
pc.getc();
pc.printf("Starting UPnP test\r\n");
//wifi.start(0);
wait_ms(750);
//Prepare configuration.
//Endpoint ssdpAnnounce;
//int err = ssdpAnnounce.set_address(UDP_BROADCAST, SSDP_PORT);
//if(err >= 0)
{
}
//else
{
// pc.printf("Error '%i' setting SSDP broadcast address\r\n", err);
}
while(1)
{
wait(5);
pc.printf("Hey!\r\n");
}
}