LPC1768 UART works with cp2102 USB to TTL module, but doesn't work with HC05

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1768 UART works with cp2102 USB to TTL module, but doesn't work with HC05

Jump to solution
3,945 Views
Alex_2221
Contributor IV

Hello everyone, I'm trying to read temperature and store and send back the data I send. I can do that without any problem using cp2102 USB to TTL module, however when I replace cp2102 module with HC05 bluetooh module when I enter the data instead of the data (two digit number) I enter, I recieve a very long and irrelevant number like 65121. I attached my code.

Thanks in advance,

Alex

Labels (1)
0 Kudos
Reply
1 Solution
3,840 Views
Alex_2221
Contributor IV

@xiangjun_rong This time I used my debugger and realized that the data is properly saving in the variables in debug mode, and only when I want to echo them back using UART_Send when the program is running I recieve a wrong number. My goal was to only save the data and not necessarily echo it. I just wanted to see if I was able to save the data. That's strange though. Anyways, thank you very much for your help. I really appreciate it.

View solution in original post

0 Kudos
Reply
8 Replies
3,939 Views
Alex_2221
Contributor IV

@xiangjun_rong Last time I used your code in this project and it worked perfectly, but now I need to replace cp2102 USB to TTL  with HC05 bluetooth module and it doesn't work. What could be the problem? 

0 Kudos
Reply
3,916 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alex,

Can you draw a block diagram so that we can know the connection ? for example, where is the LPC1768, where is the HC05.

BR

XiangJun Rong

0 Kudos
Reply
3,908 Views
Alex_2221
Contributor IV

@xiangjun_rong Hi, I drew the block diagram. Since I use a PCB board the connections don't change when I use cp2102 only I take power from my computer's USB port when I connect cp2102 to my computer, but when I connect HC05 I take power from the PCB. So RX, TX connections are the same in both cases.

0 Kudos
Reply
3,883 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you have to connect the ground of HC08 to the ground of  LPC1768, so that they have the same ground plane.

Pls check if the two ground are connected together

BR

XiangJun Rong

Tags (1)
3,841 Views
Alex_2221
Contributor IV

@xiangjun_rong This time I used my debugger and realized that the data is properly saving in the variables in debug mode, and only when I want to echo them back using UART_Send when the program is running I recieve a wrong number. My goal was to only save the data and not necessarily echo it. I just wanted to see if I was able to save the data. That's strange though. Anyways, thank you very much for your help. I really appreciate it.

0 Kudos
Reply
3,879 Views
Alex_2221
Contributor IV

@xiangjun_rong The ground of the HC05 is connected to the ground of the LPC1768. Plus, I'm able to recieve the temperature from the HC05, but when I enter the data it echos back that large number. 

0 Kudos
Reply
3,829 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that the USART_RX pin of LPC17xx is 5V tolerant, the pin can receive 5V logic. But the LPC17xx is 3.3V logic, so the UASRT_TX pin logic voltage of LPC17xx is 3.3V.

What is your problem now? can you give a clear description?

BR

XiangJun rong

Tags (1)
3,814 Views
Alex_2221
Contributor IV

@xiangjun_rong So as I said. My problem was the fact that I could send data and save it in a variable using cp2102, and I was able to echo it back to see if I managed to save it, however when I replaced cp2102 USB to TTL module with HC05 I realized that I can't echo back the data properly, but when I used my debugger I realized that the data can be properly saved like when I was using cp2102. Only when I run the program I can't echo it back properly. That's strange that I can't echo the data back when I have HC05 instead of cp2102, although it's not necessary to echo back the data. I just wanted to save the data I enter via bluetooth in a variable and it seems like I'm able to do this according to the debugger. So I guess my problem is solved already. Thank you

0 Kudos
Reply