CYBT-353027

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Pritam
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

sir,

     How to merge and modify ADC programme to SPP that I can send continueous data to Android mobile

 

Thanks 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam ,

I dont see any HAL ADC apis being called. You need to pass the adc output to wiced_bt_spp_send_session_data() API for you to see the data in the android app. I have attached  a sample app for you that sends ADC data to a remote device through SPP. I have created a timer for 1 second to send this data, you can also modify this project to stream data continuously. Please let us know if you have questions.  

Regards,
Bragadeesh

View solution in original post

0 Likes
12 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam , Please refer the code examples using CYBT-353027-EVAL. We will be able to help you if you run into any specific issues.

https://github.com/Infineon/mtb-example-btsdk-hal-adc

https://github.com/Infineon/mtb-example-btsdk-rfcomm-spp

Regards,
Bragadeesh
0 Likes
Pritam
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

I want to send contineous data from to chip to the Android mobile.I have merged the Hello sensor project with Spp project as per the article 002-23400_AN223400 .Where I can see data of hello sensor on my serial terminal of computer.I t is not sending the data to my Serial terminal of my Android mobile.Though If I am sending some value from Android it is receiving something that I can see in computer serial terminal.But how can I send the contineous data to the android mobile.please help me and share some documents on this.

Thanks

 

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam , Please share your project to debug this issue further. If you see data on the serial terminal of the computer, it probably means you are sending data to the PUART terminal. We need to review your code to see if there are any issues. 

 

Regards,
Bragadeesh
0 Likes

 I have connected cybt-353027 with USB to UART coverter .and opened the connected port on computer and then pairing it with serial terminal in Android mobile.My target is to send the ADC value directly to the mobile from the chip.For this reason I am trying to send the hello sensor  data using spp  to learn the merging process.Basically I want to merge spp with ADC programme.It is the main target.But after merging the Helo sensor project with SPP .I cant send Hello sensor data to mobile terminal.The data is showing on computer terminal but not on Mobile terminal.Here I am sharing my project below.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "sparcommon.h"
#include "wiced.h"
#include "wiced_gki.h"
#include "wiced_bt_dev.h"
#include "wiced_bt_sdp.h"
#include "wiced_bt_ble.h"
#include "wiced_bt_uuid.h"
#include "wiced_hal_nvram.h"
#include "wiced_bt_app_hal_common.h"
#include "wiced_bt_trace.h"
#include "wiced_bt_cfg.h"
#include "wiced_bt_spp.h"

#include "wiced_timer.h"
#include "wiced_transport.h"
#include "wiced_hal_platform.h"
#include "wiced_memory.h"
#include "wiced_hal_puart.h"
#include "wiced_bt_stack.h"
#include "wiced_bt_app_common.h"
#include "wiced_bt_rfcomm.h"
#include "string.h"
#include "hello_sensor.h"

#define HCI_TRACE_OVER_TRANSPORT 1 // If defined HCI traces are send over transport/WICED HCI interface
#define SEND_DATA_ON_INTERRUPT 1 // If defined application button causes 1Meg of data to be sent
#define SEND_DATA_ON_TIMEOUT 1 // If defined application sends 4 bytes of data every second
//#define LOOPBACK_DATA 1 // If defined application loops back received data

#define WICED_EIR_BUF_MAX_SIZE 264
#define SPP_NVRAM_ID 0x50

/* Max TX packet to be sent over SPP */
#define MAX_TX_BUFFER 1017
#define TRANS_MAX_BUFFERS 10
#define TRANS_UART_BUFFER_SIZE 1024
#define SPP_MAX_PAYLOAD 1007

#if SEND_DATA_ON_INTERRUPT
#include "wiced_hal_gpio.h"
#include "wiced_hal_platform.h"

#define APP_TOTAL_DATA_TO_SEND 1000000
#define BUTTON_GPIO WICED_P30
int app_send_offset = 0;
uint8_t app_send_buffer[SPP_MAX_PAYLOAD];
#endif

#ifdef SEND_DATA_ON_TIMEOUT
void app_timeout(uint32_t count);
#endif

/*****************************************************************************
Structures
*****************************************************************************/

#define SPP_RFCOMM_SCN 2

static void spp_connection_up_callback(uint16_t handle, uint8_t* bda);
static void spp_connection_down_callback(uint16_t handle);
static wiced_bool_t spp_rx_data_callback(uint16_t handle, uint8_t* p_data, uint32_t data_len);
static int bt_write_nvram(int nvram_id, int data_len, void *p_data);
static int bt_read_nvram(int nvram_id, void *p_data, int data_len);

wiced_bt_spp_reg_t spp_reg =
{
SPP_RFCOMM_SCN, /* RFCOMM service channel number for SPP connection */
MAX_TX_BUFFER, /* RFCOMM MTU for SPP connection */
spp_connection_up_callback, /* SPP connection established */
NULL, /* SPP connection establishment failed, not used because this app never initiates connection */
NULL, /* SPP service not found, not used because this app never initiates connection */
spp_connection_down_callback, /* SPP connection disconnected */
spp_rx_data_callback, /* Data packet received */
};

wiced_transport_buffer_pool_t* host_trans_pool;
uint16_t spp_handle;
wiced_timer_t app_tx_timer;

const uint8_t app_sdp_db[] = // Define SDP database
{
SDP_ATTR_SEQUENCE_2(142),
SDP_ATTR_SEQUENCE_1(69), // 2 bytes
SDP_ATTR_RECORD_HANDLE(0x10003), // 8 bytes
SDP_ATTR_CLASS_ID(UUID_SERVCLASS_SERIAL_PORT), // 8
SDP_ATTR_RFCOMM_PROTOCOL_DESC_LIST( SPP_RFCOMM_SCN ), // 17 bytes
SDP_ATTR_BROWSE_LIST, // 8
SDP_ATTR_PROFILE_DESC_LIST(UUID_SERVCLASS_SERIAL_PORT, 0x0102), // 13 byte
SDP_ATTR_SERVICE_NAME(10), // 15
'S', 'P', 'P', ' ', 'S', 'E', 'R', 'V', 'E', 'R',

// Device ID service
SDP_ATTR_SEQUENCE_1(69), // 2 bytes, length of the record
SDP_ATTR_RECORD_HANDLE(0x10002), // 8 byte
SDP_ATTR_CLASS_ID(UUID_SERVCLASS_PNP_INFORMATION), // 8
SDP_ATTR_PROTOCOL_DESC_LIST(1), // 18
SDP_ATTR_UINT2(ATTR_ID_SPECIFICATION_ID, 0x103), // 6
SDP_ATTR_UINT2(ATTR_ID_VENDOR_ID, 0x0f), // 6
SDP_ATTR_UINT2(ATTR_ID_PRODUCT_ID, 0x0401), // 6
SDP_ATTR_UINT2(ATTR_ID_PRODUCT_VERSION, 0x0001), // 6
SDP_ATTR_BOOLEAN(ATTR_ID_PRIMARY_RECORD, 0x01), // 5
SDP_ATTR_UINT2(ATTR_ID_VENDOR_ID_SOURCE, DI_VENDOR_ID_SOURCE_BTSIG) // 6
};

// Length of the SDP database
const uint16_t app_sdp_db_len = sizeof(app_sdp_db);

uint8_t pincode[4] = { 0x30, 0x30, 0x30, 0x30 };

extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings;
extern const wiced_bt_cfg_buf_pool_t wiced_bt_cfg_buf_pools[WICED_BT_CFG_NUM_BUF_POOLS];

#if defined WICED_BT_TRACE_ENABLE || defined HCI_TRACE_OVER_TRANSPORT
const wiced_transport_cfg_t transport_cfg =
{
WICED_TRANSPORT_UART,
{ WICED_TRANSPORT_UART_HCI_MODE, HCI_UART_DEFAULT_BAUD },
{ TRANS_UART_BUFFER_SIZE, 1},
NULL,
NULL,
NULL
};
#endif

/*******************************************************************
* Function Prototypes
******************************************************************/
static wiced_bt_dev_status_t app_management_callback (wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data);
static void app_write_eir(void);
static int app_write_nvram(int nvram_id, int data_len, void *p_data);
static int app_read_nvram(int nvram_id, void *p_data, int data_len);

#if SEND_DATA_ON_INTERRUPT
static void app_tx_ack_timeout(uint32_t param);
static void app_interrupt_handler(void *data, uint8_t port_pin);
#endif
#ifdef HCI_TRACE_OVER_TRANSPORT
static void app_trace_callback(wiced_bt_hci_trace_type_t type, uint16_t length, uint8_t* p_data);
#endif

//extern wiced_bt_rfcomm_result_t wiced_bt_rfcomm_init(uint32_t buffer_size, uint32_t buffer_cnt);
extern void wiced_bt_trace_array( const char *string, const uint8_t* array, const uint16_t len );

/*******************************************************************
* Function Definitions
******************************************************************/

/*
* Entry point to the application. Set device configuration and start BT
* stack initialization. The actual application initialization will happen
* when stack reports that BT device is ready
*/
APPLICATION_START()
{
wiced_result_t result;

#if defined WICED_BT_TRACE_ENABLE || defined HCI_TRACE_OVER_TRANSPORT
wiced_transport_init(&transport_cfg);

// create special pool for sending data to the MCU
host_trans_pool = wiced_transport_create_buffer_pool(TRANS_UART_BUFFER_SIZE, TRANS_MAX_BUFFERS);

// Set the debug uart as WICED_ROUTE_DEBUG_NONE to get rid of prints
// wiced_set_debug_uart(WICED_ROUTE_DEBUG_NONE);

// Set to PUART to see traces on peripheral uart(puart)
wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );
wiced_hal_puart_select_uart_pads( WICED_PUART_RXD, WICED_PUART_TXD, 0, 0);

// Set to HCI to see traces on HCI uart - default if no call to wiced_set_debug_uart()
// wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_HCI_UART );

// Use WICED_ROUTE_DEBUG_TO_WICED_UART to send formatted debug strings over the WICED
// HCI debug interface to be parsed by ClientControl/BtSpy.
// Note: WICED HCI must be configured to use this - see wiced_trasnport_init(), must
// be called with wiced_transport_cfg_t.wiced_tranport_data_handler_t callback present
// wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_WICED_UART);
#endif

WICED_BT_TRACE("APP Start\n");

/* Initialize Stack and Register Management Callback */
// Register call back and configuration with stack
wiced_bt_stack_init(app_management_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools);
}

/*
* AMS application initialization is executed after BT stack initialization is completed.
*/
void application_init(void)
{
wiced_bt_gatt_status_t gatt_status;
wiced_result_t result;

/* Initialize wiced app */
wiced_bt_app_init();

#if SEND_DATA_ON_INTERRUPT
/* Configure the button available on the platform */
wiced_hal_gpio_configure_pin( WICED_GPIO_BUTTON, WICED_GPIO_BUTTON_SETTINGS( GPIO_EN_INT_RISING_EDGE ), WICED_GPIO_BUTTON_DEFAULT_STATE );
wiced_hal_gpio_register_pin_for_interrupt(WICED_GPIO_BUTTON, app_interrupt_handler, NULL);

// init timer that we will use for the rx data flow control.
wiced_init_timer(&app_tx_timer, app_tx_ack_timeout, 0, WICED_MILLI_SECONDS_TIMER);
#endif

app_write_eir();

// Initialize RFCOMM. We will not be using application buffer pool and will rely on the
// stack pools configured in the wiced_bt_cfg.c
wiced_bt_rfcomm_init(MAX_TX_BUFFER, 1);

// Initialize SPP library
wiced_bt_spp_startup(&spp_reg);

#ifdef HCI_TRACE_OVER_TRANSPORT
// There is a virtual HCI interface between upper layers of the stack and
// the controller portion of the chip with lower layers of the BT stack.
// Register with the stack to receive all HCI commands, events and data.
wiced_bt_dev_register_hci_trace(app_trace_callback);
#endif
/* create SDP records */
wiced_bt_sdp_db_init((uint8_t *)app_sdp_db, sizeof(app_sdp_db));

// This application will always configure device connectable and discoverable
wiced_bt_dev_set_discoverability(BTM_GENERAL_DISCOVERABLE, 0x0012, 0x0800);
wiced_bt_dev_set_connectability(BTM_CONNECTABLE, 0x0012, 0x0800);

#if SEND_DATA_ON_TIMEOUT
/* Starting the app timers, seconds timer and the ms timer */
wiced_bt_app_start_timer(1, 0, app_timeout, NULL);
#endif
}

/*
* Management callback receives various notifications from the stack
*/
wiced_result_t app_management_callback(wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data)
{
wiced_bt_ble_advert_mode_t* p_mode;
wiced_result_t result = WICED_BT_SUCCESS;
wiced_bt_dev_status_t dev_status;
wiced_bt_dev_pairing_info_t* p_pairing_info;
wiced_bt_dev_encryption_status_t* p_encryption_status;
int bytes_written, bytes_read;
wiced_bt_power_mgmt_notification_t* p_power_mgmt_notification;

WICED_BT_TRACE("bt_management_callback 0x%02x\n", event);

switch(event)
{
/* Bluetooth stack enabled */
case BTM_ENABLED_EVT:
application_init();
hello_sensor_application_init();
WICED_BT_TRACE("Free mem:%d", wiced_memory_get_free_bytes());
break;

case BTM_DISABLED_EVT:
break;

case BTM_PIN_REQUEST_EVT:
WICED_BT_TRACE("remote address= %B\n", p_event_data->pin_request.bd_addr);
wiced_bt_dev_pin_code_reply(*p_event_data->pin_request.bd_addr,result/*WICED_BT_SUCCESS*/,4, &pincode[0]);
break;

case BTM_USER_CONFIRMATION_REQUEST_EVT:
/* This application always confirms peer's attempt to pair */
wiced_bt_dev_confirm_req_reply (WICED_BT_SUCCESS, p_event_data->user_confirmation_request.bd_addr);
break;

case BTM_PAIRING_IO_CAPABILITIES_BR_EDR_REQUEST_EVT:
/* This application supports only Just Works pairing */
WICED_BT_TRACE("BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda %B\n", p_event_data->pairing_io_capabilities_br_edr_request.bd_addr);
p_event_data->pairing_io_capabilities_br_edr_request.local_io_cap = BTM_IO_CAPABILITIES_NONE;
p_event_data->pairing_io_capabilities_br_edr_request.auth_req = BTM_AUTH_SINGLE_PROFILE_GENERAL_BONDING_NO;
break;

case BTM_PAIRING_COMPLETE_EVT:
p_pairing_info = &p_event_data->pairing_complete.pairing_complete_info;
WICED_BT_TRACE("Pairing Complete: %d\n", p_pairing_info->br_edr.status);
result = WICED_BT_USE_DEFAULT_SECURITY;
break;

case BTM_ENCRYPTION_STATUS_EVT:
p_encryption_status = &p_event_data->encryption_status;
WICED_BT_TRACE("Encryption Status Event: bd (%B) res %d\n", p_encryption_status->bd_addr, p_encryption_status->result);
hello_sensor_encryption_changed( p_encryption_status->result, p_encryption_status->bd_addr);

break;

case BTM_PAIRED_DEVICE_LINK_KEYS_UPDATE_EVT:
/* This application supports a single paired host, we can save keys under the same NVRAM ID overwriting previous pairing if any */
bt_write_nvram(SPP_NVRAM_ID, sizeof(wiced_bt_device_link_keys_t), &p_event_data->paired_device_link_keys_update);
break;

case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT:
/* read existing key from the NVRAM */
if (bt_read_nvram(SPP_NVRAM_ID, &p_event_data->paired_device_link_keys_request, sizeof(wiced_bt_device_link_keys_t)) != 0)
{
result = WICED_BT_SUCCESS;
}
else
{
result = WICED_BT_ERROR;
WICED_BT_TRACE("Key retrieval failure\n");
}
break;

case BTM_POWER_MANAGEMENT_STATUS_EVT:
p_power_mgmt_notification = &p_event_data->power_mgmt_notification;
WICED_BT_TRACE("Power mgmt status event: bd (%B) status:%d hci_status:%d\n", p_power_mgmt_notification->bd_addr, \
p_power_mgmt_notification->status, p_power_mgmt_notification->hci_status);
break;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case BTM_SECURITY_REQUEST_EVT:
wiced_bt_ble_security_grant( p_event_data->security_request.bd_addr, WICED_BT_SUCCESS);
break;

case BTM_BLE_ADVERT_STATE_CHANGED_EVT:
p_mode = &p_event_data->ble_advert_state_changed;
WICED_BT_TRACE("Advertisement State Change: %d\n",*p_mode);
if( *p_mode == BTM_BLE_ADVERT_OFF)
{
hello_sensor_advertisement_stopped();
}
break;

case BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT:
p_event_data->pairing_io_capabilities_ble_request.local_io_cap = BTM_IO_CAPABILITIES_NONE;
p_event_data->pairing_io_capabilities_ble_request.oob_data = BTM_OOB_NONE;
p_event_data->pairing_io_capabilities_ble_request.auth_req = BTM_LE_AUTH_REQ_SC_BOND;
p_event_data->pairing_io_capabilities_ble_request.max_key_size = 0x10;
p_event_data->pairing_io_capabilities_ble_request.init_keys = BTM_LE_KEY_PENC|BTM_LE_KEY_PCSRK|BTM_LE_KEY_LENC;
p_event_data->pairing_io_capabilities_ble_request.resp_keys = BTM_LE_KEY_PENC|BTM_LE_KEY_PID|BTM_LE_KEY_LENC;
break;


default:
result = WICED_BT_USE_DEFAULT_SECURITY;
break;
}
return result;
}


/*
* Prepare extended inquiry response data. Current version publishes device name and 16bit
* SPP service.
*/
void app_write_eir(void)
{
uint8_t *pBuf;
uint8_t *p;
uint8_t length;
uint16_t eir_length;

pBuf = (uint8_t *)wiced_bt_get_buffer(WICED_EIR_BUF_MAX_SIZE);
WICED_BT_TRACE("hci_control_write_eir %x\n", pBuf);

if (!pBuf)
{
WICED_BT_TRACE("app_write_eir %x\n", pBuf);
return;
}

p = pBuf;

length = strlen((char *)wiced_bt_cfg_settings.device_name);

*p++ = length + 1;
*p++ = BT_EIR_COMPLETE_LOCAL_NAME_TYPE; // EIR type full name
memcpy(p, wiced_bt_cfg_settings.device_name, length);
p += length;

*p++ = 2 + 1; // Length of 16 bit services
*p++ = BT_EIR_COMPLETE_16BITS_UUID_TYPE; // 0x03 EIR type full list of 16 bit service UUIDs
*p++ = UUID_SERVCLASS_SERIAL_PORT & 0xff;
*p++ = (UUID_SERVCLASS_SERIAL_PORT >> 😎 & 0xff;

*p++ = 0; // end of EIR Data is 0

eir_length = (uint16_t) (p - pBuf);

// print EIR data
wiced_bt_trace_array("EIR :", pBuf, MIN(p-pBuf, 100));
wiced_bt_dev_write_eir(pBuf, eir_length);

return;
}

/*
* The function invoked on timeout of app seconds timer.
*/
#if SEND_DATA_ON_TIMEOUT
void app_timeout(uint32_t count)
{
static uint32_t timer_count = 0;
timer_count++;
WICED_BT_TRACE("app_timeout: %d\n", timer_count);
if (spp_handle != 0)
{
wiced_bt_spp_send_session_data(spp_handle, (uint8_t *)&timer_count, sizeof(uint32_t));
}
}
#endif

/*
* SPP connection up callback
*/
void spp_connection_up_callback(uint16_t handle, uint8_t* bda)
{
WICED_BT_TRACE("%s handle:%d address:%B\n", __FUNCTION__, handle, bda);
spp_handle = handle;
}

/*
* SPP connection down callback
*/
void spp_connection_down_callback(uint16_t handle)
{
WICED_BT_TRACE("%s handle:%d\n", __FUNCTION__, handle);
spp_handle = 0;
}

/*
* Process data received over EA session. Return TRUE if we were able to allocate buffer to
* deliver to the host.
*/
wiced_bool_t spp_rx_data_callback(uint16_t handle, uint8_t* p_data, uint32_t data_len)
{
int i;
// wiced_bt_buffer_statistics_t buffer_stats[4];

// wiced_bt_get_buffer_usage (buffer_stats, sizeof(buffer_stats));

// WICED_BT_TRACE("0:%d/%d 1:%d/%d 2:%d/%d 3:%d/%d\n", buffer_stats[0].current_allocated_count, buffer_stats[0].max_allocated_count,
// buffer_stats[1].current_allocated_count, buffer_stats[1].max_allocated_count,
// buffer_stats[2].current_allocated_count, buffer_stats[2].max_allocated_count,
// buffer_stats[3].current_allocated_count, buffer_stats[3].max_allocated_count);

// wiced_result_t wiced_bt_get_buffer_usage (&buffer_stats, sizeof(buffer_stats));

WICED_BT_TRACE("%s handle:%d len:%d %02x-%02x\n", __FUNCTION__, handle, data_len, p_data[0], p_data[data_len - 1]);

#if LOOPBACK_DATA
wiced_bt_spp_send_session_data(handle, p_data, data_len);
#endif
return WICED_TRUE;
}

/*
* Write NVRAM function is called to store information in the NVRAM.
*/
static int bt_write_nvram(int nvram_id, int data_len, void *p_data)
{
wiced_result_t result;
int bytes_written = wiced_hal_write_nvram(nvram_id, data_len, (uint8_t*)p_data, &result);

WICED_BT_TRACE("NVRAM ID:%d written :%d bytes result:%d\n", nvram_id, bytes_written, result);
return (bytes_written);
}

/*
* Read data from the NVRAM and return in the passed buffer
*/
static int bt_read_nvram(int nvram_id, void *p_data, int data_len)
{
uint16_t read_bytes = 0;
wiced_result_t result;

if (data_len >= sizeof(wiced_bt_device_link_keys_t))
{
read_bytes = wiced_hal_read_nvram(nvram_id, sizeof(wiced_bt_device_link_keys_t), p_data, &result);
WICED_BT_TRACE("NVRAM ID:%d read out of %d bytes:%d result:%d\n", nvram_id, sizeof(wiced_bt_device_link_keys_t), read_bytes, result);
}
return (read_bytes);
}

#if SEND_DATA_ON_INTERRUPT
/*
* Test function which sends as much data as possible.
*/
void app_send_data(void)
{
int i;

while ((spp_handle != 0) && wiced_bt_spp_can_send_more_data() && (app_send_offset != APP_TOTAL_DATA_TO_SEND))
{
int bytes_to_send = app_send_offset + SPP_MAX_PAYLOAD < APP_TOTAL_DATA_TO_SEND ? SPP_MAX_PAYLOAD : APP_TOTAL_DATA_TO_SEND - app_send_offset;
for (i = 0; i < bytes_to_send; i++)
{
app_send_buffer[i] = app_send_offset + i;
}
wiced_bt_spp_send_session_data(spp_handle, app_send_buffer, bytes_to_send);
app_send_offset += bytes_to_send;
}
// Check if we were able to send everything
if (app_send_offset < APP_TOTAL_DATA_TO_SEND)
{
wiced_start_timer(&app_tx_timer, 100);
}
else
{
app_send_offset = 0;
}
}

/*
* Test function which start sending data.
*/
void app_interrupt_handler(void *data, uint8_t port_pin)
{
int i;

WICED_BT_TRACE("gpio_interrupt_handler pin:%d send_offset:%d\n", port_pin, app_send_offset);

/* Get the status of interrupt on P# */
if (wiced_hal_gpio_get_pin_interrupt_status(BUTTON_GPIO))
{
/* Clear the GPIO interrupt */
wiced_hal_gpio_clear_pin_interrupt_status(BUTTON_GPIO);
}
// If we are already sending data, do nothing
if (app_send_offset != 0)
return;

app_send_data();
}

/*
* The timeout function is periodically called while we are sending big amount of data
*/
void app_tx_ack_timeout(uint32_t param)
{
app_send_data();
}
#endif


#ifdef HCI_TRACE_OVER_TRANSPORT
/*
* Pass protocol traces up over the transport
*/
void app_trace_callback(wiced_bt_hci_trace_type_t type, uint16_t length, uint8_t* p_data)
{
wiced_transport_send_hci_trace(host_trans_pool, type, length, p_data);
}
#endif

0 Likes
lock attach
Attachments are accessible only for community members.
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam ,

I dont see any HAL ADC apis being called. You need to pass the adc output to wiced_bt_spp_send_session_data() API for you to see the data in the android app. I have attached  a sample app for you that sends ADC data to a remote device through SPP. I have created a timer for 1 second to send this data, you can also modify this project to stream data continuously. Please let us know if you have questions.  

Regards,
Bragadeesh
0 Likes

Hi@BragadeeshV 

If you kindly reply fast .That will be helpful.

Thanks.

0 Likes
Pritam
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

I am using Wiced-Studio-6.2  and I am using Recovery procedure to progamme the chip cybt-353027. The programme that you sent is not for Wiced-Studio as It is showing errors.it is giving "No rule to make target Error'.If you kindly say What is the procedure on Wiced Studio-6.2 to merge ADC with the SPP programme that will be helpful for me.

Thanks

 

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam ,

I have used Modustoolbox 2.3.1 to create this example project (recommended for new designs). I recommend you to use this example project to create your project in WICED studio (since the APIs are almost the same)

Regards,
Bragadeesh
0 Likes

I have created new project in wiced studio.And tried the Code but every time it is giving the following errors.

///////////////////////////////////////////////////////////////

12:22:42 **** Build of configuration Release for project 20706-A2_Bluetooth ****
/Drive_IN_D_2/programs/psoc_programs/wiced/sdk/WICED-Studio-6.2/20706-A2_Bluetooth/make snip.bt.spp_custom1-CYBT_353027_EVAL download UART=/dev/ttyUSB3 VERBOSE=1
ADK parameters:
GCC_TOOL_DIR="../../../43xxx_Wi-Fi/tools/ARM_GNU/Linux64/bin/"
BUILD_STRING="snip.bt.spp_custom1-CYBT_353027_EVAL"
TC="wiced"
DIR="../../apps/snip/bt/spp_custom1"
BLD="A_20703A2"
TOOLSBIN="../../../wiced_tools/common/Linux64/"
BASE_IN="rom"
SPAR_IN="ram"
BIN_OUT_DIR="../../build/spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release"
OUTPUT_NAME="spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release"
CGS_LIST="../../platforms/CYBT_353027_EVAL/BCM20706A2.cgs"
CONFIG_DEFINITION=""
PLATFORM_CGS_PATH="../../platforms/CYBT_353027_EVAL/BCM20706A2.cgs"
APP_FULL="snip/bt/spp_custom1"
APP_PATCH_DIR="brcm/wiced_uart"
PLATFORM_NV="SFLASH"
DEBUG=""
DIRECT_LOAD=""
"../wiced_tools/common/Linux64/make" -C Wiced-BT/spar -j4 cgs
../../../wiced_tools/common/Linux64/perl -e '$s=A_20703A2;$s=~m/^([AF])_(\d{5})([A-Z])(\d)/;print $2;'
../../../wiced_tools/common/Linux64/perl -e '$s=A_20703A2;$s=~m/^([AF])_(\d{5})([A-Z])(\d)/;print $3.$4;'
../../../wiced_tools/common/Linux64/perl -e '$s=A_20703A2;$s=~m/^([AF])_(\d{5})([A-Z])(\d)/;print $1;'
Component(s) needed spp_lib.a
src lib: spp_lib
src dbg lib:
temp bin lib:
TEMP_BIN_LIB_PRESENT
Compiling hal_adc.c
make[1]: Entering directory `/Drive_IN_D_2/programs/psoc_programs/wiced/sdk/WICED-Studio-6.2/20706-A2_Bluetooth/Wiced-BT/spar'
../../../wiced_tools/common/Linux64/mkdir -p ../../build/spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release
../../../43xxx_Wi-Fi/tools/ARM_GNU/Linux64/bin/arm-none-eabi-gcc -DWICED_SDK_MAJOR_VER=6 -DWICED_SDK_MINOR_VER=2 -DWICED_SDK_REV_NUMBER=1 -DWICED_SDK_BUILD_NUMBER=2 -DPOWER_CLASS=1 -DPLATFORM=1 -DCYW20703A2=1 -DCYW20706A2=1 -DCHIP=20706 -DWICED_BT_TRACE_ENABLE -DBCM20703 -DBB_20703A1 -DCHIP_FLAVOR=20706 -DHIDD_SUPPORT -DBUILDCFG @../BLD_ROM/A_20703A2/A_20703A2.cflag -funsigned-char -fshort-wchar -c -DCOMPILER_ARM -mlittle-endian -mcpu=cortex-m3 -mthumb -Os -g -Wa,-adhln -ffreestanding -DSPAR_CRT_SETUP=spp_custom1_spar_crt_setup -DSPAR_APP_SETUP=application_setup -D__TARGET_CPU_CORTEX_M3 -D__ARMCC_VERSION=220438 -ffunction-sections -I../../apps/snip/bt/spp_custom1 -I../../platforms/CYBT_353027_EVAL/ -I. -I../inc -I../cfa -I../bsp -I../bsp/inc -I../hal/boot -I../ulp -I../misc -I../boot -I../bm -I../hci -I../hal/afh -I../hidd_drivers -I../hidd_drivers/20703 -I../mpaf/inc -I../mpaf/app -I../adva/bec_crc -I../adva/msbc/lib -I../hal/pwrcntl -I../rtos/threadx -I../rtos/threadx/cm3 -I../mpaf/btstack/stack/include -I../mpaf/btstack/stack/hid -I../mpaf/btstack/stack/porting -I../mpaf/btstack/stack/l2cap -I../mpaf/btstack/stack/btm -I../tier2/patch/common -I../tier2/patch/inc -I. -Icommon -I../../apps/snip/bt/spp_custom1 -I../tier2/brcm/wiced_uart/bld/A_20703A2/.. -I../tier2/patch/inc -I../mpaf/btstack/stack/avrc -I../mpaf/btstack/stack/avct -I../mpaf/btstack/stack/a2dp -I../mpaf/btstack/stack/avdt -I../../include/ -I../../../common/include/ -I../../include/Platforms/CYBT_353027_EVAL/ -I../../include/Drivers/ -I../../include/Drivers/20703 -I../../libraries/spp_lib -o ../../build/spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release/hal_adc.o ../../apps/snip/bt/spp_custom1/hal_adc.c > ../../build/spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release/hal_adc.list
../../apps/snip/bt/spp_custom1/hal_adc.c:16:10: fatal error: wiced_platform.h: No such file or directory
make[1]: Leaving directory `/Drive_IN_D_2/programs/psoc_programs/wiced/sdk/WICED-Studio-6.2/20706-A2_Bluetooth/Wiced-BT/spar'
#include "wiced_platform.h"
^~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [../../build/spp_custom1-CYBT_353027_EVAL-rom-ram-Wiced-release/hal_adc.o] Error 1
make: *** [snip.bt.spp_custom1-CYBT_353027_EVAL] Error 2

0 Likes

@BragadeeshV ,

If I am building the project in modus toolbox there is no build  error. But after that How can I upload the hex By recovery procedure in Modus toolbox.I did not get any proper documentation of recovery procedure in Modus toolbox.How can I upload the build code to my cheap that is connected by USB to UART bridge?.If there is any documentation on it then please share .

Thanks

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @Pritam , Thanks for moving to Modustoolbox (MTB). The recovery procedure is the same irrespective of whether you use WICED Studio or MTB.  You can upload the code using Program launch from Quick launch panel

BragadeeshV_0-1632843399163.png

Regards,
Bragadeesh
0 Likes
Pritam
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

@BragadeeshV 

Thanks,The programme is working. In Modus Toolbox.and Now I can Directly programme it from the IDE.

 

0 Likes