Bluetooth & CMD Messenger problem

Dear all,

I am experiencing a problem with CMD Messenger, I think.

I am using a DaisyWorks Arduino derivative, with a Roving RN-41 BT module. Basically I have built a datalogger that runs 24/7, at a remote location. I want to collect data once a day via BT. I got all communcation commands working and tested, but …

Every day, when I make first contact with the device it returns “3,Unknown command;”. Only after a single or a couple of retries, the program seems to able to interpret the command. Do you reckon this behaviour has anything to do with the hardware (e.g. the BT module) or is it due to the Arduino CMDMessenger library? Is there a way to fix this?

Thanks for your help!

Jeroen

"Do you think this is a coding issue" without seeing my code? Yes, it probably is.

After consulting an expert outside this forum, I got hinted the following:

Apparently the receive buffer gets filled improperly on the first communication call. There could be missing or corrupted bytes. CMDMessenger just parses what is in the buffer after it receives the command delimiter (e.g. a semicolon).

Suggested work around: Start communication by sending a delimiter from the host will likely return 'Unknown command;', but then the buffer should be flushed and the next command should process correctly.

This seems to provide a solution. But still it is odd that the receive buffer contains improper data only when the communication has been down for a few hours.