Custom Message on BLE UART

Learn MoreFAQsTutorials

7 posts / 0 new
Last post
evilemi
Offline
Last seen:6 months 1 week ago
Joined:2020-01-31 12:12
Custom Message on BLE UART

Hi,

We are developing a specific application that contains the DA14580 based BLE module.

Our custom board has its own MCU and the DA14580 BLE module is connected to the MCU via the UART channel.

So, we used CodeLess firmware on the BLE module in order to up the BLE running.

Basically, we are able to send CodeLess AT commands and receive a response from the BLE module.

However, we would like to receive a custom message (might be also a character) on the MCU UART channel on each BLE connection/disconnection state.

How come we can generate these messages on CodeLess (built on SDK 5.0.4) and send it through UART? Is it applicable also?

Thanks in advance.

Keywords:
Device:
PM_Dialog
Online
Last seen:1 min 34 sec ago
Staff
Joined:2018-02-08 11:03
Hi evilemim

Hi evilemim

If I am not mistaken, your requirement is to send a message from the DA14580(running the CodeLess) to the external MCU upon a BLE connection or disconnection. You don’t need to implement the opposite : sending an AT command from the MCT to the CodeLess and getting triggered a callback. Please correct me if I misunderstood it. In this case, you can you use the arch_printf() function and send the appropriate massage over UART. In which UART GPIOs is the MCU connected?

Thanks, PM_Dialog

evilemi
Offline
Last seen:6 months 1 week ago
Joined:2020-01-31 12:12
Hi,

Hi,

Thanks for your quick response. You understood the case correctly.

The DA14580 has a connection to the MCU on UART pins. Also as you said no need to trigger a callback for connection or disconnection.

Only we need to notify the MCU if there is a connection or disconnection to the BLE from any external device.

I think we need to call arch_printf() function inuser_on_connectionanduser_on_disconnectmethods in user_codelss.c. Can you correct me if I'm mistaken?

Regards,

attentools
Offline
Last seen:12 months 2 days ago
Joined:2020-02-19 08:45
thank you very much

thank you very much

i like the article

FMS RC airplane

PM_Dialog
Online
Last seen:1 min 34 sec ago
Staff
Joined:2018-02-08 11:03
Hi evilemim,

Hi evilemim,

You are right. The user_on_connection() and user_on_disconnect() callbacks are triggered upon connection and disconnection respectively. To do so, you should use the arch_printf() function in those callback to notify the external MCU. The arch_console.h header file is already included. You will need to define the CFG_PRINTF macro located in da1458x_config_basic.h. In addition, keep in mind that P04 and P05 are used for the UART2 Tx and Rx respectively. You might change the UART2 GPIOs according to your design. Please test in and let me know.

Thanks, PM_Dialog

evilemi
Offline
Last seen:6 months 1 week ago
Joined:2020-01-31 12:12
Hi,

Hi,

我完全应用你建议工作as expected!

Thanks for your support.

Regards

PM_Dialog
Online
Last seen:1 min 34 sec ago
Staff
Joined:2018-02-08 11:03
Hi evilemim,

Hi evilemim,

Glad that you got it working and thanks for accepting my answers.

Regards, PM_Dialog