I am interfacing temperature sensor [i2c - pin 2, 3 ]code with dsps source code, so it has to send data to DSPS app , what changes that i has to make , pls mention the functions , thank you
I suppose that you can use the app_uart_push() in order to push data from your i2c to the ble buffer, this is called by the receive callback of the UART normally and it pushes data into the ble buffer. You can find all the available information about the Serial port application and the most important functions in the Serial Port Service reference application note.
i am using the DSPS source code project , i am successfully reading data from a sensor , now i want to send this data through bluetooth and not through UART, to DSPS android app , how to do it , please mention the functions and steps
i am using the DSPS source code - sps_device project , i am successfully reading data from a sensor , now i want to send this data through bluetooth , to DSPS android app , how to do it , please mention the functions and steps
This is not implemented by dialog, you will have to adapt the existing implementation of the DSPS to your needs in order to send data to the DSPS application, you can take the user_periph_push() (for the SDK5 version) function as an example and adjust the functionallity you want in order to push I2C data from the I2C sensor to the ble buffer instead of UART and then to the other side of the link. If you dont want to emulate a serial port and you just want to send sensor data over BLE you dont have to use the DSPS application but use the custom profile implementation and notify the client every time you have sensor data. In case you need an example for this you can have a look at the app_ble_peripheral where there is an example to trigger notifications in a steady rate interval.
Q1 . Please mention the functions used to send the data to DSPS app , Q2 . also specify does DSPS source code API functions to send data through BLE and smartband IOT source code API functions are same
i am using user_send_ble_data(p_data , length) function in DSPS source code to send the data to DSPS app , is there any other function available to send data over BLE to DSPS
1. As i ve mentioned in my previous post the DSPS application emulates serial communication, if you just want to send data to the other side of the link you can use more simple ways than the DSPS application, the specific function that you mention pulls data from the DSPS buffer that are populated by UART and sends them as notifications to the other side of the link. This is function that the DSPS uses in order to send data from the buffer to the other side of the link.
2. The DSPS and IoT project are totaly different projects using totally different custom profiles. In essence both are using notificatios/indications and write and read commands in order to communicate (as all the BLE projects do) but the architecture of the two reference designs is totally different. The DSPS emulates a serial port over a wireless link using 3 characteristics and the IoT sends sensor data using 10 characteristics one for each sensor or proccessed value.
愣th = 4; user_send_ble_data(p_data, length); // user_send_ble_data((const uint8_t *)SensorData, length); // MY REQ } } above code works fine , i am getting some data on DSPA mobile app , if i enable the // MY REQ comments , code enters into endless loop , i am not able to get any data
above code , does adding delays in I2C Read_sensor () affect the code ?? , even in the IOT project and i2c eeprom i haven't seen any delays... thank you...
Were is the code trapped and goes in an endless loop ? When you read the I2C (Read_Sensor()) is invoked you see that your code is trapped ? I dont get about what delays you are talking about, you have inserted delays when reading the I2C sensor ?
// Sets TIMER0,TIMER2 clock division factor to 8, so TIM0 Fclk is F = 16MHz/8 = 2Mhz set_tmr_div(CLK_PER_REG_TMR_DIV_8);
// clear PWM settings register to not generate PWM timer0_set_pwm_high_counter(NO_PWM); timer0_set_pwm_low_counter (NO_PWM);
// Set timer with 2MHz source clock divided by 10 so Fclk = 2MHz/10 = 200kHz timer0_init(TIM0_CLK_FAST, PWM_MODE_ONE, TIM0_CLK_DIV_BY_10);
// reload value for 100ms (T = 1/200kHz * RELOAD_100MS = 0,000005 * 20000 = 100ms) timer0_set_pwm_on_counter(RELOAD_100MS);
// Enable SWTIM_IRQn irq timer0_enable_irq();
//printf_string("\n\rLED will change state every second.\n\r"); //printf_string("\n\rTest will run for: "); //printf_byte(timeout_expiration); //printf_string(" seconds.\n\r");
// Wait for desired number of seconds while (timeout_expiration);
// Disable TIMER0, TIMER2 clocks set_tmr_enable(CLK_PER_REG_TMR_DISABLED); //printf_string("\n\rTIMER0 stopped!\n\r"); //printf_string("\n\rEnd of test\n\r"); } ************************************************************************************************* i have included timer0 interrupt for delay , this -- while (timeout_expiration); -- line in function void timer0_general_test(uint8_t times_seconds) makes the code infinite loop , what could be the issue , alone timer0 code working fine , inside the DSPS not working
I read the above conversation and I am also working on something very similar. But I have just begun my work. Could you please help me with the first part of the project i.e. reading data from the sensor. It would be great if you could point me to the profiles that I should be looking at and the exact functions that I need to take care of. 谢谢。
hi GauravBansal i am using tha AN-B-029_V1.0 for custom profile to read data and send via bluetooth , this rar extention has the tutorial pdf also..that would be helpful for u
Thank you for the reply. I worked on the sample128 and fathomed through the doc AN-B-029 Developing a Bluetooth Smart custom profile_V1.0 as you suggested. This has led to an effective communication between the mobile app Blueloupe and my DVK board. But I am still not able to figure out how to integrate my board to any sensor and also through the DSPS app. If you could point me to some more docs or guides regarding this, I'll be really grateful.
My application is to get the temperature sensor data visible in dsps app in real time. So what do you suggest should be the most appropriate docs to look at?
Hi prasanth.velliyangiri,
I suppose that you can use the app_uart_push() in order to push data from your i2c to the ble buffer, this is called by the receive callback of the UART normally and it pushes data into the ble buffer. You can find all the available information about the Serial port application and the most important functions in the Serial Port Service reference application note.
Thanks MT_dialog
i am using the DSPS source code project , i am successfully reading data from a sensor , now i want to send this data through bluetooth and not through UART, to DSPS android app , how to do it , please mention the functions and steps
i am using the DSPS source code - sps_device project , i am successfully reading data from a sensor , now i want to send this data through bluetooth , to DSPS android app , how to do it , please mention the functions and steps
Hi prasanth.velliyangiri,
This is not implemented by dialog, you will have to adapt the existing implementation of the DSPS to your needs in order to send data to the DSPS application, you can take the user_periph_push() (for the SDK5 version) function as an example and adjust the functionallity you want in order to push I2C data from the I2C sensor to the ble buffer instead of UART and then to the other side of the link. If you dont want to emulate a serial port and you just want to send sensor data over BLE you dont have to use the DSPS application but use the custom profile implementation and notify the client every time you have sensor data. In case you need an example for this you can have a look at the app_ble_peripheral where there is an example to trigger notifications in a steady rate interval.
Thanks MT_dialog
Q1 . Please mention the functions used to send the data to DSPS app ,
Q2 . also specify does DSPS source code API functions to send data through BLE and smartband IOT source code API functions are same
i am using user_send_ble_data(p_data , length) function in DSPS source code to send the data to DSPS app , is there any other function available to send data over BLE to DSPS
Hi prasanth.velliyangiri,
1. As i ve mentioned in my previous post the DSPS application emulates serial communication, if you just want to send data to the other side of the link you can use more simple ways than the DSPS application, the specific function that you mention pulls data from the DSPS buffer that are populated by UART and sends them as notifications to the other side of the link. This is function that the DSPS uses in order to send data from the buffer to the other side of the link.
2. The DSPS and IoT project are totaly different projects using totally different custom profiles. In essence both are using notificatios/indications and write and read commands in order to communicate (as all the BLE projects do) but the architecture of the two reference designs is totally different. The DSPS emulates a serial port over a wireless link using 3 characteristics and the IoT sends sensor data using 10 characteristics one for each sensor or proccessed value.
Thanks MT_dialog
// extern void Read_sensor(void) // MY REQ
// extern unsigned char SensorData[20]; // MY REQ
void user_ble_pull (bool init, bool success)
{
bool send_flow_on = false;
静态bool tx_busy_flag = false;
静态uint8_t rounds_waiting=0;
静态uint16_t length;
// Read_sensor() // MY REQ - Reading from sensor through I2C
if (init)
{
if(!tx_busy_flag)
{
if((length = user_buffer_item_count(&periph_to_ble_buffer)) > 0)
if (length > TX_WAIT_LEVEL || (rounds_waiting++) >= TX_WAIT_ROUNDS)
{
uint8_t *p_data = NULL;
rounds_waiting = 0;
tx_busy_flag = true;
愣th = (length > TX_SIZE ? TX_SIZE : length);
长度=(长度< TX_START_FRAME_DATA_SIZE吗?愣th : (((length - TX_START_FRAME_DATA_SIZE) / TX_CONTINUE_FRAME_DATA_SIZE) * TX_CONTINUE_FRAME_DATA_SIZE + TX_START_FRAME_DATA_SIZE));
愣th = user_buffer_read_address(&periph_to_ble_buffer, &p_data, TX_SIZE);
p_data[0] = 'P' ;
p_data[1] = 'P';
p_data[2] = 'P';
p_data[3] = 'A' ;
愣th = 4;
user_send_ble_data(p_data, length);
// user_send_ble_data((const uint8_t *)SensorData, length); // MY REQ
}
}
}
else
{
tx_busy_flag = false;
if (success)
user_buffer_release_items(&periph_to_ble_buffer, length);
if((length = user_buffer_item_count(&periph_to_ble_buffer)) > TX_WAIT_LEVEL)
{
uint8_t *p_data = NULL;
rounds_waiting = 0;
tx_busy_flag = true;
愣th = (length > TX_SIZE ? TX_SIZE : length);
愣th = (((length - TX_START_FRAME_DATA_SIZE) / TX_CONTINUE_FRAME_DATA_SIZE) * TX_CONTINUE_FRAME_DATA_SIZE + TX_START_FRAME_DATA_SIZE);
愣th = user_buffer_read_address(&periph_to_ble_buffer, &p_data, TX_SIZE);
p_data[0] = 'V' ;
p_data[1] = 'V';
p_data[2] = 'V';
p_data[3] = 'B' ;
愣th = 4;
user_send_ble_data(p_data, length);
// user_send_ble_data((const uint8_t *)SensorData, length); // MY REQ
}
}
above code works fine , i am getting some data on DSPA mobile app , if i enable the // MY REQ comments , code enters into endless loop , i am not able to get any data
above code , does adding delays in I2C Read_sensor () affect the code ?? , even in the IOT project and i2c eeprom i haven't seen any delays...
thank you...
Hi prasanth.velliyangiri,
Were is the code trapped and goes in an endless loop ? When you read the I2C (Read_Sensor()) is invoked you see that your code is trapped ? I dont get about what delays you are talking about, you have inserted delays when reading the I2C sensor ?
Thanks MT_dialog
void Read_sensor(void)
{
//Read_sensor_1();
//Read_sensor_2();
uart_init(UART_BAUDRATE_115K2,3);
uart_flow_off();
uint8_t something[] = { 0x0A,'R','e','e','3','y',0x0D,'>' } ;
uart_write(something,12,NULL);
uart_finish_transfers();
timer0_general_test(10); // TIMER INTERRUPT FOR DELAY
}
*********************************************************************************************************************************
void timer0_general_user_callback_function(void)
{
静态uint8_t n = 0;
// when pass 10 * 100ms
if ( 5 == n )
{
n = 0;
uart_init(UART_BAUDRATE_115K2,3);
uart_flow_off();
uint8_t something[] = { 0x0A,'R','e','a','d','y',0x0D,0x0A,'>' } ;
uart_write((uint8 *)timeout_expiration,10,NULL);
uart_finish_transfers();
timeout_expiration--;
//printf_string("\nVP!");
}
n++;
}
************************************************************************************************************************************
void timer0_general_test(uint8_t times_seconds)
{
//printf_string("\n\r\n\r");
//printf_string("***********************\n\r");
//printf_string("* TIMER0 GENERAL TEST *\n\r");
//printf_string("***********************\n\r");
// Stop timer for enter settings
timer0_stop();
timeout_expiration = times_seconds;
// register callback function for SWTIM_IRQn irq
timer0_register_callback(timer0_general_user_callback_function);
// Enable TIMER0 clock
set_tmr_enable(CLK_PER_REG_TMR_ENABLED);
// Sets TIMER0,TIMER2 clock division factor to 8, so TIM0 Fclk is F = 16MHz/8 = 2Mhz
set_tmr_div(CLK_PER_REG_TMR_DIV_8);
// clear PWM settings register to not generate PWM
timer0_set_pwm_high_counter(NO_PWM);
timer0_set_pwm_low_counter (NO_PWM);
// Set timer with 2MHz source clock divided by 10 so Fclk = 2MHz/10 = 200kHz
timer0_init(TIM0_CLK_FAST, PWM_MODE_ONE, TIM0_CLK_DIV_BY_10);
// reload value for 100ms (T = 1/200kHz * RELOAD_100MS = 0,000005 * 20000 = 100ms)
timer0_set_pwm_on_counter(RELOAD_100MS);
// Enable SWTIM_IRQn irq
timer0_enable_irq();
//printf_string("\n\rLED will change state every second.\n\r");
//printf_string("\n\rTest will run for: ");
//printf_byte(timeout_expiration);
//printf_string(" seconds.\n\r");
// Start Timer0
timer0_start();
//printf_string("\n\rTIMER0 started!");
// Wait for desired number of seconds
while (timeout_expiration);
// Disable TIMER0, TIMER2 clocks
set_tmr_enable(CLK_PER_REG_TMR_DISABLED);
//printf_string("\n\rTIMER0 stopped!\n\r");
//printf_string("\n\rEnd of test\n\r");
}
*************************************************************************************************
i have included timer0 interrupt for delay , this -- while (timeout_expiration); -- line in function void timer0_general_test(uint8_t times_seconds) makes the code infinite loop , what could be the issue , alone timer0 code working fine , inside the DSPS not working
you can mark this ticket closed , i got the answer , thankyou for your help...
Hi prasanth.velliyangiri,
I read the above conversation and I am also working on something very similar. But I have just begun my work. Could you please help me with the first part of the project i.e. reading data from the sensor. It would be great if you could point me to the profiles that I should be looking at and the exact functions that I need to take care of.
谢谢。
hi GauravBansal
i am using tha AN-B-029_V1.0 for custom profile to read data and send via bluetooth , this rar extention has the tutorial pdf also..that would be helpful for u
http://support.dialog-semiconductor.com/resource/b-029-tutorial-files-su...
Hi prasanth.velliyangiri,
Thank you for the reply. I worked on the sample128 and fathomed through the doc AN-B-029 Developing a Bluetooth Smart custom profile_V1.0 as you suggested. This has led to an effective communication between the mobile app Blueloupe and my DVK board. But I am still not able to figure out how to integrate my board to any sensor and also through the DSPS app. If you could point me to some more docs or guides regarding this, I'll be really grateful.
Hi GauravBansal
I didn't understand your question - how to integrate my board to any sensor and also through the DSPS app??,
if you are working in BLE CLIENT - BLE SERVER , refer this link
http://support.dialog-semiconductor.com/iot-server-dsps-hostdata-transmi...
Hi prasanth.velliyangiri,
My application is to get the temperature sensor data visible in dsps app in real time. So what do you suggest should be the most appropriate docs to look at?
Hi GauravBansal
UM-B-038 DA14580 Serial Port Service reference application_v2.0 - helps with DSPS