Hey guys. I have a problem with interfacing my bluetooth module (aubtm-20) with Atmega 640. The BT module works perfectly and responds to the commands sent when connected directly to a PC. I have also debugged the code and it works perfectly. But when I connect the BT module (Rx and Tx pins are connected to MAX232 and then to DB9 connector) to the microcontroller using DB9 connector + MAX232, I get incomplete response.
For example, instead of getting getting the response as "<CR><LF>OK<CR><LF>", I get a response like "<CR><LF>O<LF><CR><LF>". The response I get seems to be a part of the actual response but I get a different response everytime.
Rx of BT module is connected to Tx of microcontroller and Tx of BT module is connected to Rx of microcontroller.
I also have shorted grounds of both the boards and have ensured that the baud rates are proper.
I have double-checked the UART settings and they seem fine. I did connect the ATMega to the PC and it works fine and as expected. There seems to be some problem when I connect the two boards together. I'm using a 14.7456 MHz crystal for the ATMega.
Hey guys. So the problem was solved. All the UART settings were proper. It was the way I had written the ISR that was the problem. Tweaked it a bit and worked like a charm! Thanks for the help.