<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UART project building without softdvice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23330/uart-project-building-without-softdvice</link><description>Hello, i am a beginner, i have a doubt that my UART project is building without the softdevice being flashed and the output is not seen on the pins. I wanted to configure some pins as output and assigned them VDD. I used SDK12.2.0. In what cases is Softdevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Jul 2017 10:35:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23330/uart-project-building-without-softdvice" /><item><title>RE: UART project building without softdvice</title><link>https://devzone.nordicsemi.com/thread/91723?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 10:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:442360c6-c604-448f-9871-97355d8cce18</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;@yash selecting right answer and closing the question helps others!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART project building without softdvice</title><link>https://devzone.nordicsemi.com/thread/91722?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 10:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5f6facc-9ff9-4ed3-aa1c-94caf6158792</guid><dc:creator>YASH</dc:creator><description>&lt;p&gt;Thank You.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART project building without softdvice</title><link>https://devzone.nordicsemi.com/thread/91721?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 08:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec6290b6-3ded-465a-b537-7924c5b7b38b</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;If you want to use Eclipse GCC, this &lt;a href="https://embeddedsoftdev.blogspot.com/p/ehal-nrf51.html"&gt;blog&lt;/a&gt; may be a bit easier to get started.  There are simple UART examples with and without BLE.&lt;/p&gt;
&lt;p&gt;This example code bellow is all you need to write as code in order send and receive UART &amp;lt;-&amp;gt; BLE with a custom service.  This code works seamlessly with all nRF5x series.  It uses SDK12 for nRF51 series and SDK13 for nRF52 series.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;app_scheduler.h&amp;quot;

#include &amp;quot;istddef.h&amp;quot;
#include &amp;quot;ble_app.h&amp;quot;
#include &amp;quot;ble_service.h&amp;quot;
#include &amp;quot;blueio_board.h&amp;quot;
#include &amp;quot;uart.h&amp;quot;
#include &amp;quot;custom_board.h&amp;quot;
#include &amp;quot;iopincfg.h&amp;quot;

#define DEVICE_NAME                     &amp;quot;UARTDemo&amp;quot;                            /**&amp;lt; Name of device. Will be included in the advertising data. */

#define MANUFACTURER_NAME               &amp;quot;I-SYST inc.&amp;quot;                       /**&amp;lt; Manufacturer. Will be passed to Device Information Service. */
#define MODEL_NAME                      &amp;quot;IMM-NRF51x&amp;quot;                            /**&amp;lt; Model number. Will be passed to Device Information Service. */
#define MANUFACTURER_ID                 ISYST_BLUETOOTH_ID                               /**&amp;lt; Manufacturer ID, part of System ID. Will be passed to Device Information Service. */
#define ORG_UNIQUE_ID                   ISYST_BLUETOOTH_ID                               /**&amp;lt; Organizational Unique ID, part of System ID. Will be passed to Device Information Service. */

#define APP_ADV_INTERVAL                MSEC_TO_UNITS(64, UNIT_0_625_MS)             /**&amp;lt; The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS      180                                         /**&amp;lt; The advertising timeout (in units of seconds). */

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(10, UNIT_1_25_MS)             /**&amp;lt; Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(40, UNIT_1_25_MS)             /**&amp;lt; Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */

void UartTxSrvcCallback(BLESRVC *pBlueIOSvc, uint8_t *pData, int Offset, int Len);

static const ble_uuid_t  s_AdvUuids[] = {
	{BLUEIO_UUID_UART_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}
};

static const char s_RxCharDescString[] = {
		&amp;quot;UART Rx characteristic&amp;quot;,
};

static const char s_TxCharDescString[] = {
		&amp;quot;UART Tx characteristic&amp;quot;,
};

uint8_t g_ManData[8];

BLESRVC_CHAR g_UartChars[] = {
	{
		// Read characteristic
		BLUEIO_UUID_UART_RX_CHAR,
		20,
		BLESVC_CHAR_PROP_READ | BLESVC_CHAR_PROP_NOTIFY,
		s_RxCharDescString,         // char UTF-8 description string
		NULL,                       // Callback for write char, set to NULL for read char
		true,                       // Notify flag for read characteristic
		NULL,						// Callback on set notification
		NULL,						// pointer to char default values
		0,							// Default value length in bytes
	},
	{
		// Write characteristic
		BLUEIO_UUID_UART_TX_CHAR,	// char UUID
		20,                         // char max data length
		BLESVC_CHAR_PROP_WRITEWORESP,	// char properties define by BLUEIOSVC_CHAR_PROP_...
		s_TxCharDescString,			// char UTF-8 description string
		UartTxSrvcCallback,         // Callback for write char, set to NULL for read char
		false,                      // Notify flag for read characteristic
		NULL,						// Callback on set notification
		NULL,						// pointer to char default values
		0							// Default value length in bytes
	},
};

uint8_t g_LWrBuffer[512];

const BLESRVC_CFG s_UartSrvcCfg = {
	BLESRVC_SECTYPE_NONE,	// Secure or Open service/char
	BLUEIO_UUID_BASE,           // Base UUID
	BLUEIO_UUID_UART_SERVICE,   // Service UUID
	2,                          // Total number of characteristics for the service
	g_UartChars,                // Pointer a an array of characteristic
	g_LWrBuffer,                // pointer to user long write buffer
	sizeof(g_LWrBuffer)         // long write buffer size
};

BLESRVC g_UartBleSrvc;

const BLEAPP_DEVDESC s_UartBleDevDesc {
	MODEL_NAME,           // Model name
	MANUFACTURER_NAME,          // Manufacturer name
	&amp;quot;&amp;quot;,                     // Serial number string
	&amp;quot;0.0&amp;quot;,                  // Firmware version string
	&amp;quot;0.0&amp;quot;,                  // Hardware version string
};

const BLEAPP_CFG s_BleAppCfg = {
	{ // Clock config nrf_clock_lf_cfg_t
#ifdef IMM_NRF51822
		NRF_CLOCK_LF_SRC_RC,	// Source RC
		1, 1, 0
#else
		NRF_CLOCK_LF_SRC_XTAL,	// Source 32KHz XTAL
		0, 0, NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM
#endif

	},
	0, 						// Number of central link
	1, 						// Number of peripheral link
	BLEAPP_MODE_APPSCHED,   // Use scheduler
	DEVICE_NAME,                 // Device name
	ISYST_BLUETOOTH_ID,     // PnP Bluetooth/USB vendor id
	1,                      // PnP Product ID
	0,						// Pnp prod version
	true,					// Enable device information service (DIS)
	&amp;amp;s_UartBleDevDesc,
	g_ManData,              // Manufacture specific data to advertise
	sizeof(g_ManData),      // Length of manufacture specific data
	BLEAPP_SECTYPE_NONE,    // Secure connection type
	BLEAPP_SECEXCHG_NONE,   // Security key exchange
	NULL,      				// Service uuids to advertise
	0, 						// Total number of uuids
	APP_ADV_INTERVAL,       // Advertising interval in msec
	APP_ADV_TIMEOUT_IN_SECONDS,	// Advertising timeout in sec
	0,                          // Slow advertising interval, if &amp;gt; 0, fallback to
								// slow interval on adv timeout and advertise until connected
	MIN_CONN_INTERVAL,
	MAX_CONN_INTERVAL,
	BLUEIO_CONNECT_LED_PORT,    // Led port nuber
	BLUEIO_CONNECT_LED_PIN,     // Led pin number
	NULL						// RTOS Softdevice handler
};

int nRFUartEvthandler(UARTDEV *pDev, UART_EVT EvtId, uint8_t *pBuffer, int BufferLen);

// UART configuration data

static IOPINCFG s_UartPins[] = {
	{BLUEIO_UART_RX_PORT, BLUEIO_UART_RX_PIN, BLUEIO_UART_RX_PINOP, IOPINDIR_INPUT, IOPINRES_NONE, IOPINTYPE_NORMAL},	// RX
	{BLUEIO_UART_TX_PORT, BLUEIO_UART_TX_PIN, BLUEIO_UART_TX_PINOP, IOPINDIR_OUTPUT, IOPINRES_NONE, IOPINTYPE_NORMAL},	// TX
	{BLUEIO_UART_CTS_PORT, BLUEIO_UART_CTS_PIN, BLUEIO_UART_CTS_PINOP, IOPINDIR_INPUT, IOPINRES_NONE, IOPINTYPE_NORMAL},	// CTS
	{BLUEIO_UART_RTS_PORT, BLUEIO_UART_RTS_PIN, BLUEIO_UART_RTS_PINOP, IOPINDIR_OUTPUT, IOPINRES_NONE, IOPINTYPE_NORMAL},// RTS
};

const UARTCFG g_UartCfg = {
	0,
	s_UartPins,
	sizeof(s_UartPins) / sizeof(IOPINCFG),
	1000000,
	8,
	UART_PARITY_NONE,
	1,	// Stop bit
	UART_FLWCTRL_NONE,
	true,
	APP_IRQ_PRIORITY_LOW,
	nRFUartEvthandler,
	false,
};

// UART object instance
UART g_Uart;

int g_DelayCnt = 0;

void UartTxSrvcCallback(BLESRVC *pBlueIOSvc, uint8_t *pData, int Offset, int Len)
{
	g_Uart.Tx(pData, Len);
}

void BlePeriphEvtUserHandler(ble_evt_t * p_ble_evt)
{
    BleSrvcEvtHandler(&amp;amp;g_UartBleSrvc, p_ble_evt);
}

void BleAppInitUserServices()
{
    uint32_t       err_code;

    err_code = BleSrvcInit(&amp;amp;g_UartBleSrvc, &amp;amp;s_UartSrvcCfg);
    APP_ERROR_CHECK(err_code);
}

void HardwareInit()
{
	g_Uart.Init(g_UartCfg);
}

void BleAppInitUserData()
{

}

void UartRxChedHandler(void * p_event_data, uint16_t event_size)
{
	uint8_t buff[128];

	int l = g_Uart.Rx(buff, 128);
	if (l &amp;gt; 0)
	{
		BleSrvcCharNotify(&amp;amp;g_UartBleSrvc, 0, buff, l);
	}
}

int nRFUartEvthandler(UARTDEV *pDev, UART_EVT EvtId, uint8_t *pBuffer, int BufferLen)
{
	int cnt = 0;
	uint8_t buff[20];

	switch (EvtId)
	{
		case UART_EVT_RXTIMEOUT:
		case UART_EVT_RXDATA:
			app_sched_event_put(NULL, 0, UartRxChedHandler);
			break;
		case UART_EVT_TXREADY:
			break;
		case UART_EVT_LINESTATE:
			break;
	}

	return cnt;
}


int main()
{
    HardwareInit();

    BleAppInit((const BLEAPP_CFG *)&amp;amp;s_BleAppCfg, true);

    BleAppRun();

	return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART project building without softdvice</title><link>https://devzone.nordicsemi.com/thread/91720?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2017 07:07:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c10e3eff-3a6f-456e-bd37-2adbbabdbcda</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;If you use any &amp;quot;BLE&amp;quot; example from nRF5 SDK then indeed you need to flash Soft Device first. There is specific target pre-created in Keil projects or you can flash it externally through nRFgo Studio or nrfjprog utility from NRFTOOLs package. Have you seen the &lt;a href="https://devzone.nordicsemi.com/tutorials/2/"&gt;tutorial where everything is explained step by step&lt;/a&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>