Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I'm using PIC16F1824, Xtal 8Mhz and bluetooth module with baud rate 9600. When I sent data using hyperterminal to the BT module, it works fine. But when I send the same data using Android (Amarino), the data received was corrupted.

What went wrong?


Additional Info: Corrupted data. @Kevin: Original Data: 1234567890 But when I sent using Android, it reads as 1234!!0 Some how 56789 was missing.**

Another example: ABCDEF, but it only reads as ABCD!! Basically it only know how to read the first 4 characters.

share|improve this question
2  
We need much more detail then this. There are tons of things that could have gone wrong. –  Kellenjb Jun 28 '11 at 18:49
    
Sure the settings of the Amarino match those of your Hyperterminal? Looks like that kind of problem. –  stevenvh Jun 28 '11 at 18:50
2  
Can you describe what you mean by "Corrupted"? Did you actually scope it? –  Kevin Vermeer Jun 28 '11 at 19:59
    
what they are trying to say is that a simple scope shot of the data on the line will tell you where the problem is originating. –  Kortuk Jun 29 '11 at 7:39
    
the same corrupted characters both times with different data means this is almost guaranteed to be intentional from either android or the module. –  Kortuk Jun 29 '11 at 13:35

2 Answers 2

up vote 3 down vote accepted

You didn't give much information, but this smells like a serial port configuration problem. Are you really sure the baud rate, number of data bits, parity, and number of stop bits is the same in both cases. Probably not. Since it's working with Hyperterm, see what it's set to, then make sure the Android is set to the same thing.

Also look at how flow control is handled. If the unit is expecting to use RTS/CTS and the Android doesn't have those lines hooked up or doesn't have that turned on it could make it not work.

share|improve this answer
    
where he has two different platforms for terminals, this does seem likely. –  JustJeff Jun 28 '11 at 23:51
    
Thanks @Olin. I will look into RTS/CTS stuff. There is no settings for Baud rate, Parity or RTS/CTS in Android. I will do more research on this. Normally all settings are done in the bluetooth module. Which I've set the BT Module 9600 8 N 1 and it works for Hyperterminal. One more thing, I have another MCU, PIC18F452. It works perfectly ok. Using the same BT module, I can send data using Hyperter and Android. The difference is PIC18F452 uses USART while PIC16F1824 uses ENHANCED USART. –  mlam Jun 29 '11 at 2:47
    
@Olin, the fact that some of the data makes it through unharmed but some does not tells me it is more dastardly then baud rate. If it was baud rate his data would be corrupted on the whole. With a bug like this someone is corrupting the data, almost gaurantee it is in the Android phone, even though I love android. –  Kortuk Jun 29 '11 at 7:40
    
Thanks @Kortuk. At the beginning, I didn't give much details about the data and the code. So based on that info, @Olin asked me to check RTS/CTS. –  mlam Jun 29 '11 at 10:56
    
@mlam, now that you have given more information, it could possibly be a buffer overrun problem. That might mean the module is expecting some sort of flow control that the Android isn't doing. –  Olin Lathrop Jun 29 '11 at 12:32

I have tried this using a Sena Bluetooth app in Android for my android. I ensured that my CTS and RTS of my bluetooth module were connected to each other. My bluetooth app required that I set the baud rate to 115200. I was successful in data transfer.

You will have to power up your bluetooth module and change the baud rate settings. Refer to the link below:

how do I change baud rate for bluesmirf without connecting to pc?

share|improve this answer
    
Thanks @Sai. I don't get what you mean with " I ensured that my CTS and RTS of my bluetooth module were connected to each other." My baud rate settings look ok, 9600 8 N 1. It works with Hyperter. –  mlam Jun 29 '11 at 4:44
    
Please don't use signatures. Your gravatar, username, reputation, badge count, and so on are all in the lower right corner of your answer. –  Kevin Vermeer Jun 29 '11 at 18:53
1  
Unless you're using flow control, you can short your CTS (clear to send) and RTS (ready to send) pins to each other to indicate that the device is always ready to send and always ready to receive. –  pfyon Jun 29 '11 at 18:54
    
Also, edits should be mostly independent of the comments, and leave your answer mostly contiguous: You want it to be as easy to read and understand as possible! To answer @mlam's question, you should clarify why you connected CTS and RTS in the second sentence, not as an edit, or respond directly in a comment if you don't feel that the information belongs in your answer, or both. –  Kevin Vermeer Jun 29 '11 at 18:55
    
@Kevin: Sorry about that. I was not able to comment for mlam's post. I am able to do so now –  Sai Jul 1 '11 at 1:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.