10 posts / 0 new
Last post
reza.abbasi67
Offline
Last seen: 2 months 2 weeks ago
Joined: 2019-02-23 14:37
Problem in Da14580

Dear Dialog

I have a problem with a DA 14580. I took the IC for ON and Off a LED. I read your site and I found that I need to define two commands for the work. First, determining output for the pin and second high or low being the pin.

1- GPIO_ConfigurePin( GPIO_PORT_1, GPIO_PIN_0, OUTPUT, PID_GPIO, false);

2- GPIO_SetActive(GPIO_PORT_1, GPIO_PIN_0);

I putted these two command in void set_pad_functions(void) in user_periph_setup.c. However, the output is not high and it is always low (0 V). I do not know why it cannot work.

I would be pleased if you could help me.

Regards,

Reza.

Device: 
PM_Dialog
Online
Last seen: 5 min 25 sec ago
Staff
Joined: 2018-02-08 11:03
Hi reza.abbasi67,

Hi reza.abbasi67,

  1. user_periph_setup.h

    #define GPIO_LED_PORT     GPIO_PORT_1

    #define GPIO_LED_PIN      GPIO_PIN_0

  1. user_periph_setup.h
  • GPIO_ConfigurePin(GPIO_LED_PORT, GPIO_LED_PIN, OUTPUT, PID_GPIO, false);  in the set_pad_functions() function
  • RESERVE_GPIO(LED, GPIO_LED_PORT, GPIO_LED_PIN, PID_GPIO); in the GPIO_reservations() function.
  1. Use GPIO_SetActive() API to turn on the LED and GPIO_SetInactive() to turn it off.

But let me ask you something. In which SDK project are you working on? Are you using any of sleep modes?

Thanks, PM_Dialog

reza.abbasi67
Offline
Last seen: 2 months 2 weeks ago
Joined: 2019-02-23 14:37
Dear PM_Dialog,

Dear PM_Dialog,
Thank you so much for your responses.
I tried to resolve the problem based on your comments and yet the obtained result is not appropriate (The output is 0 V). I do not understand where is the location of GPIO_SetActive. I putted GPIO_SetActive in the user_periph_setup.c in the void periph_init(void). I investigated the order of the commands which you said to me. First, the definition of the output, second reservation and third setting high or low. I use Smart Snippets tool with SDK 5.0.4 and I changed the sleep commands as follows:

in used config.
const static sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF;

in da1458X_config_basic.h:
#undef CFG_MEM_MAP_EXT_SLEEP
#undef CFG_MEM_MAP_DEEP_SLEEP

in user_periph_setup.h
#define CFG_UART_SW_FLOW_CTRL
#undef CFG_UART_HW_FLOW_CTRL

Thank you for your attention.
Reza.

PM_Dialog
Online
Last seen: 5 min 25 sec ago
Staff
Joined: 2018-02-08 11:03
Hi reza.abbasi67,

Hi reza.abbasi67,

It would be very helpful to indicate in which project are you working.  In a ble example from our SKD or in any of our reference designs, like DSPS? Also, do you have any f our development board or you have designed you custom board based on DA14580 device?  Which are your requirements regarding the LED? Just to turn it on?

Thanks, PM_Dialog

reza.abbasi67
Offline
Last seen: 2 months 2 weeks ago
Joined: 2019-02-23 14:37
Hi PM_Dialog

Hi PM_Dialog
Thank you so much for the replying the message.
I prepared the module with title YH-007_V1.0 (was added to attachment). The module had not been programmed. Although I had a problem in communication with it, I resolved it. Indeed, my main purpose is the development of a LED circuit that works with Bluetooth. For example, If I send 1 to the Bluetooth device with DSPS APP, the LED go toward ON and If I send 2 to the Bluetooth device, the LED become oFF. I have used your information and could communicate with the Bluetooth using DSPS and the mentioned module only for sending and receiving data from PC to phone cell and vice versa. Next phase is ON and oFF for LED and the final phase is the comparison of the obtained data (with IF for 1= ON and 2=OFF).

I would be pleased if you could help me for the project.
Best wishes
Reza.

PM_Dialog
Online
Last seen: 5 min 25 sec ago
Staff
Joined: 2018-02-08 11:03
Hi reza.abbasi67,

Hi reza.abbasi67,

Have you ever checked the Codeless project? If not, I would highly suggest you to have a look at this reference design. Please follow the link below :

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

With the Codeless project, you could send AT commands wirelessly to the DA14580. The CodeLess AT commands platform allows control over a local UART connected device as well as a remote device via BLE. The comprehensive set of AT-Commands enables control of the BLE connectivity, sensor read-out and battery check of the device. Control over issuing the AT commands can be on a PC or integrated in a 3rd party microcontroller. For example you can toggle a GPIO from your mobile phone without implementing any code snippet. If you have any specific reason to use the DSPS project, you will have to modify it a little bit more.  Please download the source code of the Codeless and read tutorial.

Thanks, PM_Dialog

reza.abbasi58
Offline
Last seen: 2 months 2 weeks ago
Joined: 2019-03-05 08:51
Dear PM_Dialog,

Dear PM_Dialog,

Thank you for your answer in detail. I read the pages. However, I did not you what app has used for sending the AT++10.0. I didn't find any app in the page in which you put.

I am so grateful if you give the site for download the software.

Regards,
Reza

PM_Dialog
Online
Last seen: 5 min 25 sec ago
Staff
Joined: 2018-02-08 11:03
Hi reza.abbasi58,

Hi reza.abbasi58,

Could you please clarify you question? You asked about which mobile application you should use? If yes, you could use any of the BLE generic mobile applications.

Thanks, PM_Dialog

reza.abbasi67
Offline
Last seen: 2 months 2 weeks ago
Joined: 2019-02-23 14:37
Hi PM_Dialog,

Hi PM_Dialog,

Thank you so much for helping me. Although the Codeless projects are very better, I decided to switch to DSPS .
According to your guidance, I could turn on the LED. I really appreciate for the purpose. Now, I wanted to send number 1 for turning On and number 2 for turning off the LED.

I read the uart_sps.c and I could turn on the LED with my code (I added it as follows and it wrote it in static void uart_sps_thr_empty_isr(void) in uart_sps.c). However, I found that when the Tx buffer is filled, the code work and it is not important what type of number reach to the buffer. The LED wait to send every number or character to the DA14580. When the character or number received, the LED turn on for always and I can't turn off it. Could you help me?

if (uart_txfifo_full_getf()==1)

{
GPIO_SetActive(GPIO_LED_PORT, GPIO_LED_PIN);
}

if (uart_txfifo_full_getf()==2)

{
GPIO_SetInactive(GPIO_LED_PORT, GPIO_LED_PIN);
}

Regard,
Reza

PM_Dialog
Online
Last seen: 5 min 25 sec ago
Staff
Joined: 2018-02-08 11:03
Hi reza.abbasi67,

Hi reza.abbasi67,

I assume that you would like to send the ‘1’ or ‘2’ from the central device and you would like to DSPS on the peripheral side to parse it and switch on/off the LED. So when the device gets data from the central side the message SPS_SERVER_DATA_RX_IND will occur the message is attached to the user_sps_server_data_rx_ind_handler() so you will be able to get whatever the central sends in the callback mentioned above. The default functionality will just invoke the user_ble_push() in order to push the data in the buffer. So an idea would be to check the incoming data and either do your thing or push the data into the buffer in order to be printed out on the uart side. Now in case that you would like to send back something to the central in case of a specific command what you can do is use the user_send_ble_data() function and directly send a notification to the central without going through the buffers.

Thanks, PM_Dialog