Help with bluetooth connection with the phone to a microcontroller using BLE TINY Click

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
PedroP
Posts: 1
Joined: 22 Jun 2023 21:49

Help with bluetooth connection with the phone to a microcontroller using BLE TINY Click

#1 Post by PedroP » 22 Jun 2023 22:15

Hello,

I'am a student developing a project where I exchange messages through my phone, via bluetooth, to my microcontroller(XMC4200 Platform2Go). I'am using the BLE TINY Click DA14531MOD and i send AT commands through the mobile app SmartConsole.

This is project is being developed in C using the DAVE IDE and their APPs.

Right now, my group and I are using the command "AT+MEM=0,message" and receiving the message with "AT+MEM=0", this all works within the app and the BLE. The problem is that the command is not working with the microcontroller. We are making this connection through UART, the baudrates are 2400, seen in the SmartConsole. We also have this:

void rstPinAct(){
DIGITAL_IO_SetOutputHigh(&RST);
delay100ms();
DIGITAL_IO_SetOutputLow(&RST);
delay1s();
}

At the start of the program this sets the RST pin to high for 100ms and then low for 1s.

Here is the piece of code where we try to receive the message:

for (i = 0; i < 9; i++)
UART_TransmitWord(&UART_BLE, msg);

if(UART_IsRXFIFOEmpty(&UART_BLE) != true){
for (i = 0; i < 5; i++)
{
rec_data = UART_GetReceivedWord(&UART_BLE);

//A enviar para o tera term
UART_TransmitWord(&UART_1,rec_data);
}

This code is supposed to send "AT+MEM=0", we are sending it char to char because our teacher said it would be easier. Then we check if there is any message in the RX "container" of the microcontroller connected to the ble. If there is one, we will try to receive the command char to char. The last UART transmit is not important.

Our main problem is that we aren't receiving anything. And we don't even know if this is being sent to the ble.

Sorry for my english errors, its not my native language, and thank you for your attention to our problem.

Best regards,
Pedro Pereira

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: Help with bluetooth connection with the phone to a microcontroller using BLE TINY Click

#2 Post by IvanJeremic » 28 Jun 2023 11:55

Hi,

Try using our example code with its source files, it won't work for your MCU and board as is, but you can use it as a reference when writing your own code.
https://github.com/MikroElektronika/mik ... ks/bletiny

SmartConsole should work fine here, just make sure to use this command "AT+MEM=0,I2C" in the application.

Regards,

Ivan.

Post Reply

Return to “User Projects”