Connect betwen DA14580 and STM32F4 via UART

11 posts / 0 new
Last post
phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
Connect betwen DA14580 and STM32F4 via UART

Hello,

STM32F4 <-----UART-----> DA14580 <-----BLE(DSPS)----> Android

I want to connect between DA14580 and STM32F4 via UART. Let DA14580 read data from STM32F4
Then, from STM32F4 can send data to the phone.
How to transmit data from DA and STM32F4 by UART?
Help me.

Device: 
PM_Dialog
Offline
Last seen: 8 hours 25 min ago
Staff
Joined: 2018-02-08 11:03
Hi phanquocuong1520022,

Hi phanquocuong1520022,

Thanks for posting your question on our Bluetooth LE forums. Could you please clarify if you are using any of our development boards or you are using a custom board based on DA14580 device? Firstly, you should connect correctly the UART between DA14580 and STM32F4. The DSPS reference application code is by default using the following GPIOs for the UART configuration:

  • TX:   P0_4
  • RX:   P0_5
  • RTS: P0_3
  • CTS: P0_2

You could find the UART configuration in user_periph_setup.h. So, you have to connect he STM32F4 to that GPIOs. If you would like to have other UART pins, you have to modify the user_periph_setup.h. The DSPS provides both software (XON/XOFF) and hardware (RTS/CTS) flow control schemes, respectively selected by the CFG_UART_SW_FLOW_CTRL and CFG_UART_HW_FLOW_CTRL definitions in the user_periph_setup.h configuration file. The selection of the UART baud rate is done by the setting the value of UART_SPS_BAUDRATE definition in the uart_sps.h header file to the required baud rate. The available baud rates 115200, 57600, 38400, 19200, 9600. Both central and peripheral devices can operate either in Active mode or Extended sleep, please check app_default_sleep_mode in user_config.h. If you are using extended sleep mode, you have to use wither hardware or software flow control. Otherwise the device will not wake up. Since you have correctly established UART connection between DA1458p and STM32F4, you could send data through UART and the DSPS will transmit them over the air.  Regarding the android application, you should download the DSPS android application. The Android application can be found in Google’s ‘Play Store’ and easily installed from there as any other android application. To find the application, user can search for ‘DSPS Dialog’. For more information, I would suggest you to read the UM-B-038 : User Manual for Dialog Serial Port Profile  user manual.

Thanks, PM_Dialog

phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
Thanks for the help of the

Thanks for the help of the system.
let me ask how can i check the data transmission between STM32 with ongoing DA, and the data from STM32F4 sent to the phone?

My connection:
PC <---USB---> STM32F4 <--- uart--> DA <--DSPS--> Android
Connect my uart:
TX: P0_4 <---> RX: PA3 (STM32)
RX: P0_5 <---> TX: PA2 (STM32)
RTS: P0_3 <---> CTS: PA1 (STM32)
CTS: P0_2 <---> RTS: PA0 (STM32)
And I send it with tools: hercules
but does not display data transfer between STM32 and Android.

Unlike what I have successfully connected: DA with Android
Thanks and please help me !!

CYibin
Offline
Last seen: 2 days 7 hours ago
Staff
Joined: 2017-12-14 02:48
Hi,

Hi,

I think the reference design named Codeless would meet your requirement. All you have to do are just to burn the codeless firmware into your 580  and send your data to it via UART AT command. Click below link for more information:

https://www.dialog-semiconductor.com/products/smartbondtm-codeless-commands

Br

CYibin

phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
Can you help me with the

Can you help me with the section ctrol Flow?
I can't send data between DA and STM32F4 because of CTS / RTS.

PM_Dialog
Offline
Last seen: 8 hours 25 min ago
Staff
Joined: 2018-02-08 11:03
Hi phanquocuong1520022,

Hi phanquocuong1520022,

You are using the DSPS reference design, aren’t you? Or you are using the CodeLess as CYibin had suggested you? Which is your issue regarding the flow control? Could you please probe the UART lines? If you don’t have connected the STM32F4 with the DA14580, can you send/receive data? I would suggest you to connect a serial monitor instead of STM32F4 and thy to send /receive data to a DSPS mobile application.

Thanks, PM_Dialog

phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
connect.

connect.
PC <---> DA14580 <--DSPS-> Android
I successfully transmitted data between Android and hercules (PC) with the DSPS App.
Thanks, Cuong

PM_Dialog
Offline
Last seen: 8 hours 25 min ago
Staff
Joined: 2018-02-08 11:03
Hi phanquocuong1520022,

Hi phanquocuong1520022,

That’s good! So, when you have connected the STM32F4 with the DA14580, can you please probe the UART lines? Could you please make sure that you are using the correct baud rate from both sides?

Thanks, PM_Dialog

phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
Hi Dialog.

Hi Dialog.
1. I checked Baurate of STM32 = 115200 just like the DSPS example of the Dialog provided. But do not transmit receive data.
2. I do not change the code, and keep the configuration of DSPS example (dsps sps_divice keil5)
and set the PIN pin on STM32F4.
I need Code Flow Ctrol (CTS / RTS) Software for STM32F4 instead of using Hard_Flow_Ctrol code is available.
3. PC <---usb--> STM32F4 <--- uart--> DA14580 <- dsps -> Android
Do I need to connect DA14580 to PC?
Or just connect as the above diagram?
 

Attachment: 
phanquocuong1520022
Offline
Last seen: 5 months 4 days ago
Joined: 2019-04-11 02:47
Hi Dialog,

Hi Dialog,

when connecting DA14580 and STM32F4
In the DSPS example there are 2 choices
1. sps_device
2. sps_host
Which option should I use 1 or 2?
Thanks,cuong

PM_Dialog
Offline
Last seen: 8 hours 25 min ago
Staff
Joined: 2018-02-08 11:03
Hi phanquocuong1520022,

Hi phanquocuong1520022,

You should use the sps_device project. Could you please share the UART connection between DA14580 and STM32F4? Can you please clarify if it is the following?

[STM] RX:  PA2  < ---- >   [580] TX:  P0_4

[STM] ΤX:  PA3  < ---- >   [580] RX:   P0_5

[STM] CTS: PA1 < ---- > [580] RTS: P0_3

[STM] RTS: PA0 < ---- > [580] CTS: P0_2

Did you probe the UART lines in order to check if the STM is successfully transmitting data to DA14580?

Thanks, PM_Dialog