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
Solved! Go to Solution.
@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.
@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?
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
@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.
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
@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.
@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.
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
@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