9 years, 11 months ago.

Internal Size Limit? (K64F + mbed + mbed-rtos + EthernetInterface)

Greetings,

I'm trying to put together a simple demo application showing both Ethernet and Threads on the K64F.

Import programNetThreadDemo

Threads + Network Demo

The test application attempts to:

  1. Start 2 threads
  2. Bring up the network
  3. Run a TCP server, and echo data coming in on any connections

If I start both LED blink threads then the program crashes within the first few milliseconds (long before the network comes up or the server starts running). If I start only one of them then the program runs correctly. This implies I'm hitting some kind of limit within the application (stack, code, ram, etc.) however the build report shows I'm well within the Flash and RAM limits of the K64F (7% and 21% for each).

Interestingly if I start only one of the LED blink threads, but move the "TCPSocketConnection conn" instance inside the main loop then it also crashes in exactly the same way - merely because the TCPSocketConnection destructor would get called if the program were ever to reach there.

Does anyone know what limits I could be hitting, and where to configure them differently?

- Malcolm

Hello Malcolm,

Can you confirm that your application works without the LED threads running?

I too am working on an application using the K64F and the EthernetInterface library. I am currently running into an issue whereby the connect() function is always reporting an error (-1). If I disable both of your led threads I see the same problem with your application.

Cameron

posted by Cameron Haegle 05 May 2014

Hi Cameron,

I'm not actually checking the result of the connect() call - I can check this evening when I get back from work; but when I comment out both LED threads the application runs and I can telnet into it and get the dual-echoes back. I've also confirmed correct behavior using Wireshark to monitor the traffic.

Have you checked with Wireshark to see if your board sends an ARP packet advertising its presence?

- Malcolm

posted by Malcolm Nixon 05 May 2014

Malcolm,

The fact that you are getting the double echo you are expecting tells me that EthernetInterface would appear to be working just fine on your K64F.

I will have to fire up Wireshark this evening and check for the ARP advertisement packet.

Hard to imagine that I have two broken K64F's, but stranger things have happened. Will have to have an associate run my application on his boards later.

Thanks, Cameron

posted by Cameron Haegle 05 May 2014

Between a co-worker and myself, we have a total of 5 FRDM-K64F boards...all of which were received in Dallas during FTF.

All 5 of our devices have the same behavior. The connect() function returns -1, regardless of whether using DHCP or static addressing.

I am beginning to wonder if those having success have a newer revision of the device. The 2 boards I have are based on the revision C schematic, which is known to have a I2C connection problem.

Malcolm - I appreciate you taking the time to respond to my posts. Sorry for not being able to help address your issue, however. I will let you know if I do come across any information.

- Cameron

posted by Cameron Haegle 06 May 2014

Hi Cameron,

Unfortunately I didn't get a chance to do the test last night - I need to trade in my toddler due to noise issues!

The FRDM-K64F I have came from Arrow Electronics, and looks like its schematic revision D1. If you're interested I could run your code on my board to confirm success/failure.

- Malcolm

posted by Malcolm Nixon 06 May 2014

Hi Cameron,

It turns out I'm also getting a connect() return of -1 despite the network appearing to function (sends the ARP packet). In addition I found out my crash/lockup is occurring in the EthernetInterface::init() call.

Unfortunately even with all LED blink threads turned off, adding the Serial object to the application has consumed all "Room" (the unknown resource that's limiting any of my FRDM-K64F network applications from doing anything useful). In other words I can't bring up the network with TCP echo, and simultaneously print any data about it. Heisenberg anyone?

- Malcolm

posted by Malcolm Nixon 07 May 2014

mbed build version 83 was recently released which fixes a memory configuration issue on the K64F platform. I had similar thread crash issue (system was hard faulting) and updating fixed the problem. Just click on "mbed" in your project tree. On the right of the window, you'll see a notification that says "A newer version is available". Then click on the "Update" button below that notification.

posted by Jim Carver 08 May 2014

Alas no joy - I even tried switching to the mbed-src to get the "bleeding edge" latest, but it's still not working there either. Still crashing in EthernetInterface::init().

posted by Malcolm Nixon 10 May 2014

1 Answer

9 years, 6 months ago.

I've run into this same problem and was able to work around it by calling

sys_thread_new("LED1 thread", led1_thread, NULL, DEFAULT_THREAD_STACKSIZE, osPriorityNormal);

I'm not quite sure what is going on here, but at least this works.

Hi Joe, Where is "sys_thread_new" defined? Is this function("sys_thread_new" ) your own definition?

posted by lv wei 06 Jan 2015