System stuck in random lines

02 Nov 2011

Hi everyone,

We built a system using ethernet, usb file system, mysql, httpclient. What it basically does is it sends sensor data to our server periodically. We built all the classes and tested them seperately. However when we try to test the system wioth our test code which includes all the functions being run one by one, program stucks at lines like creating a file in the usb, getting http response from web, reading file from usb etc. There is no exact line that it stops functioning. When we make some changes in the code, the line mbed is stuck changes.

What may be the reason for this problem? Can it be because we ran out of space because of creating too much variables and not deallocating them when exiting the functions?

Thank you in advance.

03 Nov 2011


are you using lots stuff attached to tickers ?

I found this problem when I had what I'll call "ticker overflow" (as I don't know the technical term for it.)

my programs would just hang because they didn't get a chance to finish what they were doing before the next tick ticked. (if that makes any sense ?), thing is, they would appear to hang at random times.

Once, it manifested itself by working with no printf's, and as soon as I turned printf's on via a debug varable I'd put in, it hung.

Just a thought, you mustn't do to much within a method attached to a ticker. Instead you can use the tickers to set flags, to trigger things happening in the procedural main. There's an article around somewhere.. Mr Kirkham maybe ?

03 Nov 2011
maybe you're doing something in an interrupt that isn't reentrant. For example printf isn't, it's a well-known problem.

this might be interesting: