10 years, 1 month ago.

main() keeps starting over and over again

I am using WiflyInterface and rtos at the same time. After searching in the forum, I finally was able to make the Wifly Echo client and Echo server demo working with the rtos. In this version, the client is consistently sending string to the server and receive it back in the main thread. Basically, I made the following modification.

void Wifly::handler_rx(void) { read characters while (wifi.readable()) { char c = LPC_UART2->RBR; buf_wifly.queue(c); } }

Here comes the question. I separated the operations in the client into two parts. First part is wifi initialization in main thread. And the second part is the main thread sends data in the same way as before by calling a wrapped function. The strange thing is that the program stopped at the socket.send function and the main function starts over automatically.

Can anyone give me some advice? Any help would be appreciated.

It's like the MBED is resetting itself automatically. Why does this happen?

1 Answer

10 years, 1 month ago.

When you perform an invalid operation, the mbed will reset itself. For example, I had a jump routine that used an array of functions, but was jumping to an invalid array element, causing the mbed to reset. Without example code, it's hard to say what's going wrong. One question that comes to mind is: are you sure the initialization thread completes before you start sending data?