Sometimes the communication between the motion board and the computer gets corrupted and does not make it across. For instance if you read the encoder position and choose 0xFF (return to host), the position is placed in the return data buffer. The board then notifies the computer that it has data to be read. Sometimes this notification does not make it. In these cases, you will get the "Return Data Buffer is not Empty" error. What you need to do is just handle that error with in your code. When the error occurs, call the flex_flush_rdb to flush the buffer.