USBSerial Problems

A 40 Pin Dip packaged development board enabling you to create internet connected products

USBSerial Problems

Postby Sailing_Nut » Fri May 16, 2014 2:46 am

Hi,

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");
    }
}
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Re: USBSerial Problems

Postby Carl-SolderSplash » Fri May 16, 2014 9:42 pm

Hi,

It's most likely a heap issue causing a hard fault, these are hard to find with mbed. if you share your project with me on mbed via PM I'll take a look and see if I can see the problem.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: USBSerial Problems

Postby Sailing_Nut » Sat May 17, 2014 3:50 am

Carl,

I also found that if I hat the USBSerial defined, the communications with the WiFi chip were failing. I'll need a bit of help on the best way to share the project with you.

Thanks for taking the time to look at it!

Tim
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Re: USBSerial Problems

Postby Carl-SolderSplash » Sat May 17, 2014 6:51 pm

Use the Publish button in the Commit drop down on mbed.

When publishing you can check a box to keep the publish private, still accessible for people that know the URL but wont appear on search results.

Then send me the project URL via PM or email.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: USBSerial Problems

Postby Sailing_Nut » Mon May 19, 2014 12:55 pm

Carl-SolderSplash wrote:Use the Publish button in the Commit drop down on mbed.

When publishing you can check a box to keep the publish private, still accessible for people that know the URL but wont appear on search results.

Then send me the project URL via PM or email.


Carl,

I sent a PM but it is showing in my Outbox and not in sent items. Did I do something wrong?
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Re: USBSerial Problems

Postby Carl-SolderSplash » Mon May 19, 2014 1:57 pm

Hi,

I've got it, shall have a look tonight

Edit : It's not letting me access the project

Access Denied
Sorry, you do not have sufficient permissions to perform this operation.

you need to set the "Repository visibility" as public unlisted, currently it is private on the admin settings tab.
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: USBSerial Problems

Postby Sailing_Nut » Mon May 19, 2014 2:49 pm

Done!
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Re: USBSerial Problems

Postby Carl-SolderSplash » Mon May 19, 2014 11:06 pm

Hi,

I got home really late so please excuse typos, I've opened your project up, added a few debug lines and have it working.

I'm not sure if the debugging I've added to it or it's the fact I've imported it and built it from scratch. Sometimes "Compile All" under the Compile menu solves these weird problems.

Probably best for you to import and see if it still works for you, i'll PM you a link to my copy of your project. Here's a picture :
TimSSDP.jpg
TimSSDP.jpg (133.34 KiB) Viewed 7556 times


Make sure the Wifidip has been configured to auto connect to an AP using the kitchensink example.

I can see a new message with wireshark each time I hit enter in the USB serial window after it connects.

If you get SSDP working on the Wifidip i would love to share an example with other users. Feel free to ask questions, I'll answer them tomorrow.

Good night!
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: USBSerial Problems

Postby Sailing_Nut » Wed May 28, 2014 2:52 am

Carl,

I tried your sample and it worked. So I looked at the differences and saw that you removed the LCD library and the RTOS library.

Once I did that to my project, it worked too!

VERY strange that code that is not even being called is interfering, but it could be a static definition somewhere. (Probably in the library I wrote for the serial graphic LCD! :oops: )

Thanks again!

I'll keep you posted on my progress on getting SSCP (and UPnP) working.
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Re: USBSerial Problems

Postby Sailing_Nut » Tue Jun 03, 2014 6:21 pm

Just had a chance to check things and the mbed_rtos library is the culprit for killing the USB serial communications.

Any clues where I should look to figure out the problem? I really need the rtos support in my eventual final solution.

I can keep hacking away at things on the SSDP front in the meantime.
Sailing_Nut
 
Posts: 35
Joined: Fri Nov 29, 2013 9:43 pm

Next

Return to WiFi DipCortex

Who is online

Users browsing this forum: No registered users and 2 guests

cron