<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WICED 20719 &#8211; IoT Expert</title>
	<atom:link href="https://iotexpert.com/category/devices/wiced-20719/feed/" rel="self" type="application/rss+xml" />
	<link>https://iotexpert.com</link>
	<description>Engineering for the Internet of Things</description>
	<lastBuildDate>Sun, 21 Oct 2018 13:17:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://iotexpert.com/wp-content/uploads/2017/01/cropped-Avatar-32x32.jpg</url>
	<title>WICED 20719 &#8211; IoT Expert</title>
	<link>https://iotexpert.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>GoBLE Remote Control &#8211; WICED Bluetooth Implementation</title>
		<link>https://iotexpert.com/goble-remote-control-wiced-bluetooth-implementation/</link>
					<comments>https://iotexpert.com/goble-remote-control-wiced-bluetooth-implementation/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Fri, 19 Oct 2018 20:43:05 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5905</guid>

					<description><![CDATA[Summary I will be teaching a video training workshop for Mouser on October 24. In the class I am going to show a bunch of Bluetooth things running on PSoC6 with WICED.  Given that Bluetooth has two sides of a connection I wanted something that people could download from the iOS App Store to interact [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>I will be teaching a video training workshop for <a href="https://iotexpert.com/2018/10/19/mouser-video-training-workshop-october-24/" target="_blank" rel="noopener">Mouser on October 24</a>. In the class I am going to show a bunch of Bluetooth things running on PSoC6 with WICED.  Given that Bluetooth has two sides of a connection I wanted something that people could download from the iOS App Store to interact with my PSoC6/4343W design that looked like a remote control.  And, I found a program called <a href="https://itunes.apple.com/us/app/goble-bluetooth-4-0-controller/id950937437?mt=8" target="_blank" rel="noopener">GoBLE</a> which was developed by a company called <a href="https://www.dfrobot.com" target="_blank" rel="noopener">DF Robot</a> to control their robots.  Here is a screenshot from my iPhone where you can see that it has four buttons on the right, a joystick on the left and two buttons in the middle.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/img_6351/" rel="attachment wp-att-5907"><img fetchpriority="high" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-1024x576.png" alt="" width="1024" height="576" class="alignnone size-large wp-image-5907" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-1024x576.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-600x338.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-300x169.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-768x432.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<p>I watched their <a href="https://www.youtube.com/watch?v=ixYYXGiAGIA" target="_blank" rel="noopener">youtube video</a>, and it seems great&#8230; but how does it work?  And how do I make a WICED Bluetooth project to work with it?</p>
<h1>GoBLE Documentation</h1>
<p>So, how does the App work to send button/joystick commands?  Well, if you press the little &#8220;i&#8221; in the App, it will take you to this screen.  You can see that it sends a variable length packet of data that tells you which buttons are being pressed and where the joystick location is in x &amp; y.  OK&#8230; but that doesn&#8217;t really tell you what to do on the Bluetooth Peripheral side.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/img_6354/" rel="attachment wp-att-5910"><img decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6354-1024x576.png" alt="" width="1024" height="576" class="alignnone size-large wp-image-5910" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6354-1024x576.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6354-600x338.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6354-300x169.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6354-768x432.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/img_6355/" rel="attachment wp-att-5909"><img decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6355-1024x576.png" alt="" width="1024" height="576" class="alignnone size-large wp-image-5909" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6355-1024x576.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6355-600x338.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6355-300x169.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6355-768x432.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<p>If you look around on the internet you will find on <a href="https://github.com/DFRobot/BlunoBasicDemo" target="_blank" rel="noopener">GitHub</a> a place where they tell you what the BLE Services/Characteristics need to look like: (sort of).</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-12-22-10-pm/" rel="attachment wp-att-5911"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-12.22.10-PM.png" alt="" width="889" height="231" class="alignnone size-full wp-image-5911" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-12.22.10-PM.png 889w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-12.22.10-PM-600x156.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-12.22.10-PM-300x78.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-12.22.10-PM-768x200.png 768w" sizes="auto, (max-width: 889px) 100vw, 889px" /></a></p>
<p>What they appear to have meant is that the SerialPortId and Command Id Characteristic need to have the GATT properties Read, WriteWithoutResponse, Write and Notify properties and that you need the Client Characteristic Configuration Descriptor for both Characteristics.  In the WICED application (that I will show you in the next section) that I build to test the remote control, they do not appear to use the CCCD or Read properties.  In addition they only use the Serial Port Id characteristic.  In fact if you do not include that Characteristic, it will still work.  The bottom line is that you database should look like this (in WICED).</p>
<pre class="start-line:35 lang:c decode:true">    /* Primary Service 'RobotService' */
    PRIMARY_SERVICE_UUID128 (HDLS_ROBOTSERVICE, __UUID_ROBOTSERVICE),

        /* Characteristic 'SerialPortId' */
        CHARACTERISTIC_UUID128_WRITABLE (HDLC_ROBOTSERVICE_SERIALPORTID, HDLC_ROBOTSERVICE_SERIALPORTID_VALUE,
            __UUID_ROBOTSERVICE_SERIALPORTID, LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE_NO_RESPONSE | LEGATTDB_CHAR_PROP_WRITE | LEGATTDB_CHAR_PROP_NOTIFY,
            LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ),

            /* Descriptor 'Client Characteristic Configuration' */
            CHAR_DESCRIPTOR_UUID16_WRITABLE (HDLD_ROBOTSERVICE_SERIALPORTID_CLIENT_CONFIGURATION,
                UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION, LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_AUTH_WRITABLE),</pre>
<p>The good news is they do service discovery and didn&#8217;t depend on a hardcoded handle.</p>
<h1>WICED 20719 Implementation</h1>
<p>Start by using the Bluetooth Designer to make a new project for the 20719-B1, which I will run on a CYW920719Q40EVB_01.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-00-24-pm/" rel="attachment wp-att-5915"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.24-PM.png" alt="" width="527" height="501" class="alignnone size-large wp-image-5915" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.24-PM.png 527w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.24-PM-300x285.png 300w" sizes="auto, (max-width: 527px) 100vw, 527px" /></a></p>
<p>Click on the add Service button.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-00-53-pm/" rel="attachment wp-att-5914"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.53-PM.png" alt="" width="356" height="208" class="alignnone size-large wp-image-5914" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.53-PM.png 356w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.00.53-PM-300x175.png 300w" sizes="auto, (max-width: 356px) 100vw, 356px" /></a></p>
<p>Add a Service Name as GoBLE, and then type in the UUID for the service, 0000dfb0-0000-1000-8000-00805f9b34fb.  Notice that you need to do UUIDs as little endian.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-03-19-pm/" rel="attachment wp-att-5913"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM-1024x657.png" alt="" width="1024" height="657" class="alignnone size-large wp-image-5913" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM-1024x657.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM-600x385.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM-300x192.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM-768x493.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.03.19-PM.png 1063w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The next step is to add a characteristic.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-04-27-pm/" rel="attachment wp-att-5916"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.04.27-PM.png" alt="" width="364" height="216" class="alignnone size-full wp-image-5916" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.04.27-PM.png 364w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.04.27-PM-300x178.png 300w" sizes="auto, (max-width: 364px) 100vw, 364px" /></a></p>
<p>Name the Characteristic SerialPortId and setup the UUID  0000dfb1-0000-1000-8000-00805f9b34fb (once again little endian)</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-15-06-pm/" rel="attachment wp-att-5921"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM-1024x484.png" alt="" width="1024" height="484" class="alignnone size-large wp-image-5921" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM-1024x484.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM-600x283.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM-300x142.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM-768x363.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.15.06-PM.png 1035w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now you need to configure the Characteristic properties to match the specification.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-07-04-pm-2/" rel="attachment wp-att-5919"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.07.04-PM-1.png" alt="" width="717" height="481" class="alignnone size-full wp-image-5919" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.07.04-PM-1.png 717w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.07.04-PM-1-600x403.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-1.07.04-PM-1-300x201.png 300w" sizes="auto, (max-width: 717px) 100vw, 717px" /></a> <a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/screen-shot-2018-10-19-at-1-06-47-pm-2/" rel="attachment wp-att-5920"></a></p>
<p>After all that is done, press the generate code button to build the project.  Now you will need to edit a little bit of code.  Start by enabling the PUART.</p>
<pre class="start-line:134 EnlighterJSRAW" data-enlighter-language="c"">#if ((defined WICED_BT_TRACE_ENABLE) || (defined HCI_TRACE_OVER_TRANSPORT))
    /* Set the Debug UART as WICED_ROUTE_DEBUG_NONE to get rid of prints */
    //  wiced_set_debug_uart( WICED_ROUTE_DEBUG_NONE );

    /* Set Debug UART as WICED_ROUTE_DEBUG_TO_PUART to see debug traces on Peripheral UART (PUART) */
      wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

    /* Set the Debug UART as WICED_ROUTE_DEBUG_TO_WICED_UART to send debug strings over the WICED debug interface */
    //wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_WICED_UART );
#endif
</pre>
<p>The iPhone App recognizes you as a peripheral by seeing the Service UUID advertised.  Unfortunately whoever wrote the advertising packet parser assumed that the Service UUID was first (which it doesn&#8217;t have to be).  If you notice I added the name of the device to the advertising packet&#8230; but while I was trying to figure that out I put a #if 1 / #endif around that part of the packet.  (notice that on line 178 I modified it the number of packet elements to be 3.</p>
<pre class="start-line:175 EnlighterJSRAW" data-enlighter-language="c" ">/* Set Advertisement Data */
void gobletest_set_advertisement_data( void )
{
    wiced_bt_ble_advert_elem_t adv_elem[3] = { 0 };
    uint8_t adv_flag = BTM_BLE_GENERAL_DISCOVERABLE_FLAG | BTM_BLE_BREDR_NOT_SUPPORTED;
    uint8_t num_elem = 0; 

    /* Advertisement Element for Flags */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_FLAG;
    adv_elem[num_elem].len = sizeof(uint8_t);
    adv_elem[num_elem].p_data = &amp;adv_flag;
    num_elem++;

    uint8_t gobleuuid[] = {__UUID_GOBLE};

    /* Advertisement Element for Name */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE;
    adv_elem[num_elem].len = 16;
    adv_elem[num_elem].p_data = gobleuuid;
    num_elem++;

#if 1

    /* Advertisement Element for Name */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE;
    adv_elem[num_elem].len = strlen((const char*)BT_LOCAL_NAME);
    adv_elem[num_elem].p_data = BT_LOCAL_NAME;
    num_elem++;
#endif
    /* Set Raw Advertisement Data */
    wiced_bt_ble_set_raw_advertisement_data(num_elem, adv_elem);
}
</pre>
<p>When the App writes to the 20719 you will get a callback in the function &#8220;goble_server_callback&#8221;.  To figure it out I print out the raw data, as well as the parsed version.</p>
<pre class="start-line:503 EnlighterJSRAW" data-enlighter-language="c" ">/* GATT Server Event Callback */
wiced_bt_gatt_status_t gobletest_server_callback( uint16_t conn_id, wiced_bt_gatt_request_type_t type, wiced_bt_gatt_request_data_t *p_data )
{
    wiced_bt_gatt_status_t status = WICED_BT_GATT_ERROR;

    switch ( type )
    {
    case GATTS_REQ_TYPE_READ:
        status = gobletest_read_handler( &amp;p_data-&gt;read_req, conn_id );
        break;
    case GATTS_REQ_TYPE_WRITE:
        if(p_data-&gt;write_req.handle == HDLC_GOBLE_SERIALPORTID_VALUE)
        {
            WICED_BT_TRACE("Activate = ");
            for(int i=0;i&lt;p_data-&gt;write_req.val_len;i++)
            {
                WICED_BT_TRACE("%02X ",p_data-&gt;write_req.p_val[i]);
            }
            WICED_BT_TRACE("\n");
            uint32_t numButtons = p_data-&gt;write_req.p_val[3];
            uint32_t sliderX = p_data-&gt;write_req.p_val[5+numButtons];
            uint32_t sliderY = p_data-&gt;write_req.p_val[6+numButtons];
            uint32_t buttonMask = 0x00;
            for(int i=0;i&lt;numButtons;i++)
            {
                buttonMask |= (1&lt;&lt;p_data-&gt;write_req.p_val[5+i]);
            }

            WICED_BT_TRACE("# Buttons = %d ButtonMask=%X Slider x=%X Slider Y=%X\n",numButtons,buttonMask,sliderX,sliderY);
            status = WICED_BT_GATT_SUCCESS;
        }
        else
            status = gobletest_write_handler( &amp;p_data-&gt;write_req, conn_id );
        break;
    }

    return status;
}
</pre>
<p>In the file wiced_bt_cfg.c modify the advertising duration to &#8220;0&#8221; which means never timeout.</p>
<pre class="start-line:75 EnlighterJSRAW" data-enlighter-language="c" ">   /* BLE Advertisement Settings */
    .ble_advert_cfg = {
        .channel_map =                      BTM_BLE_ADVERT_CHNL_37 |                                    /**&lt; Advertising Channel Map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39) */
                                            BTM_BLE_ADVERT_CHNL_38 |
                                            BTM_BLE_ADVERT_CHNL_39,

        .high_duty_min_interval =           WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MIN_INTERVAL,            /**&lt; High Duty Undirected Connectable Minimum Advertising Interval */
        .high_duty_max_interval =           WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MAX_INTERVAL,            /**&lt; High Duty Undirected Connectable Maximum Advertising Interval */
        .high_duty_duration =               0,                                                         /**&lt; High Duty Undirected Connectable Advertising Duration in seconds (0 for infinite) */
</pre>
<p>Now that is all done I can program the development kit.  The phone immediately recognizes the kit.  And, when I press the buttons you can see that they are printed out.  You can see that I pressed two buttons at a time to start, then I moved the slider around.</p>
<p><a href="https://iotexpert.com/?attachment_id=5926" rel="attachment wp-att-5926"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-3.54.37-PM.png" alt="" width="723" height="574" class="alignnone size-full wp-image-5926" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-3.54.37-PM.png 723w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-3.54.37-PM-600x476.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-19-at-3.54.37-PM-300x238.png 300w" sizes="auto, (max-width: 723px) 100vw, 723px" /></a></p>
<p>OK.  All good.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/goble-remote-control-wiced-bluetooth-implementation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WICED 20719 BLE Central Custom Profile w/LED &#038; CapSense &#8211; Part 2</title>
		<link>https://iotexpert.com/wiced-20719-ble-central-custom-profile-w-led-capsense-part-2/</link>
					<comments>https://iotexpert.com/wiced-20719-ble-central-custom-profile-w-led-capsense-part-2/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 10 Oct 2018 12:25:43 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5871</guid>

					<description><![CDATA[Summary In the previous article I showed you how to create a BLE Central that could attach to a BLE peripheral that is advertising a custom service.  Then, I showed you how to write values to the LED Characteristic in the Peripheral GATT Server.  In this article Ill show you how to set the CCCD [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>In the <a href="https://iotexpert.com/2018/10/08/wiced-20719-ble-central-custom-profile-w-led-capsense-part-1/">previous article</a> I showed you how to create a BLE Central that could attach to a BLE peripheral that is advertising a custom service.  Then, I showed you how to write values to the LED Characteristic in the Peripheral GATT Server.  In this article Ill show you how to set the CCCD and what happens when the Peripheral notifies.</p>
<p>The steps to build this project will be as follows</p>
<ol>
<li>Create a new project with copy/paste</li>
<li>Write the CCCD</li>
<li>Handle the new GATT Events</li>
</ol>
<h1>Create a new project by copy/paste</h1>
<p>I wanted to have three different projects for each of the steps in this series of articles.  To create the 2nd example (the subject of this article) Ill just do a copy/paste and then fix a few things.  Start with the copy.</p>
<p><a href="https://iotexpert.com/?attachment_id=5876" rel="attachment wp-att-5876"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.12-AM.png" alt="" width="514" height="455" class="alignnone size-large wp-image-5876" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.12-AM.png 514w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.12-AM-300x266.png 300w" sizes="auto, (max-width: 514px) 100vw, 514px" /></a></p>
<p>When you paste it will ask you to give a new name to the directory.</p>
<p><a href="https://iotexpert.com/?attachment_id=5875" rel="attachment wp-att-5875"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.39-AM.png" alt="" width="474" height="166" class="alignnone size-large wp-image-5875" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.39-AM.png 474w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.04.39-AM-300x105.png 300w" sizes="auto, (max-width: 474px) 100vw, 474px" /></a></p>
<p>Give the main file a new name, in this case ex02CCCD.c</p>
<p><a href="https://iotexpert.com/?attachment_id=5877" rel="attachment wp-att-5877"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.09.24-AM.png" alt="" width="235" height="74" class="alignnone size-full wp-image-5877" /></a></p>
<p>And create a new make target.</p>
<p><a href="https://iotexpert.com/?attachment_id=5874" rel="attachment wp-att-5874"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.05.55-AM.png" alt="" width="487" height="460" class="alignnone size-large wp-image-5874" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.05.55-AM.png 487w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.05.55-AM-300x283.png 300w" sizes="auto, (max-width: 487px) 100vw, 487px" /></a></p>
<p>Fix the makefile with the new name of the source file.</p>
<p><a href="https://iotexpert.com/?attachment_id=5873" rel="attachment wp-att-5873"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM-1024x360.png" alt="" width="1024" height="360" class="alignnone size-large wp-image-5873" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM-1024x360.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM-600x211.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM-300x105.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM-768x270.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.06.06-AM.png 1041w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Build and test to make sure that everything still works&#8230;. and it seems to.</p>
<p><a href="https://iotexpert.com/?attachment_id=5878" rel="attachment wp-att-5878"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.07.59-AM.png" alt="" width="838" height="490" class="alignnone size-full wp-image-5878" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.07.59-AM.png 838w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.07.59-AM-600x351.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.07.59-AM-300x175.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.07.59-AM-768x449.png 768w" sizes="auto, (max-width: 838px) 100vw, 838px" /></a></p>
<h1>Write the CCCD</h1>
<p>The Peripheral that we are talking to in this example has a CapSense Characteristic that has a Client Characteristic Configuration Descriptors, also known as the CCCD.   When you set the CCCD to 1, the Peripheral will then send you notifications anytime the underlying Characteristic changes.  WICED has some utility functions to help you interact with the remote GATT server.  To add them to your project, first include the header file.</p>
<pre class="start-line:34 lang:c decode:true ">#include "wiced_bt_gatt_util.h"</pre>
<p>Then modify your makefile to include the library.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">$(NAME)_COMPONENTS += gatt_utils_lib.a</pre>
<p>To actually turn on/off the CCCD you simply call the library function wiced_bt_util_set_gatt_client_config_descriptor.  Ill add a case &#8216;n&#8217; to turn on notifications and a case &#8216;N&#8217; to turn them off.  Notice the 0x12 is hardcoded in two places, something which is really bad and Ill fix in the next article.  Don&#8217;t forget to add the two cases to the help message.</p>
<pre class="start-line:422 lang:c decode:true">     case 'n':
         WICED_BT_TRACE("CCCD On\n");
         if(conn_id )
             wiced_bt_util_set_gatt_client_config_descriptor(conn_id,0x12,1); // Very bad hardcode 0x12

         break;

     case 'N':
         WICED_BT_TRACE("CCCD Off\n");
         if(conn_id )
             wiced_bt_util_set_gatt_client_config_descriptor(conn_id,0x12,0); // Very bad hardcode 0x12
         break;


    case '?':
        /* Print help */
        WICED_BT_TRACE( "\n" );
        WICED_BT_TRACE( "+------- Available Commands -------+\n" );
        WICED_BT_TRACE( "|  n    CCCD On                    |\n" );
        WICED_BT_TRACE( "|  N    CCCD Off                   |\n" );</pre>
<p>Now when I test&#8230; I can press the &#8216;n&#8217; to set the CCCD.  When I touch the CapSense slider I seem to get a whole bunch of &#8220;Unknown GATT Event 1&#8243;s (we will figure that out in just a bit).  So it seems to be working.  When I press &#8216;N&#8217; I don&#8217;t get the messages.</p>
<p><a href="https://iotexpert.com/?attachment_id=5881" rel="attachment wp-att-5881"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.25.49-AM.png" alt="" width="852" height="522" class="alignnone size-full wp-image-5881" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.25.49-AM.png 852w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.25.49-AM-600x368.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.25.49-AM-300x184.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.25.49-AM-768x471.png 768w" sizes="auto, (max-width: 852px) 100vw, 852px" /></a><br />
Is there something special about the function wiced_bt_util_set_gatt_client_config_descriptor?  Nope.  If you right click on it, you can look at the source code.  This code looks exactly like the &#8220;writeLed&#8221; function that we wrote in the previous example.  The only difference is that instead of allocating a buffer using wiced_bt_get_buffer the author of this function allocated the buffer on the stack.</p>
<pre class="start-line:36 lang:c decode:true ">/*
 * Format and send GATT Write Request to set value of a G
 */
wiced_bt_gatt_status_t wiced_bt_util_set_gatt_client_config_descriptor(uint16_t conn_id, uint16_t handle, uint16_t value)
{
    wiced_bt_gatt_status_t status;
    uint8_t                buf[sizeof(wiced_bt_gatt_value_t) + 1];
    wiced_bt_gatt_value_t *p_write = ( wiced_bt_gatt_value_t* )buf;
    uint16_t               u16 = value;

    // Allocating a buffer to send the write request
    memset(buf, 0, sizeof(buf));

    p_write-&gt;handle   = handle;
    p_write-&gt;offset   = 0;
    p_write-&gt;len      = 2;
    p_write-&gt;auth_req = GATT_AUTH_REQ_NONE;
    p_write-&gt;value[0] = u16 &amp; 0xff;
    p_write-&gt;value[1] = (u16 &gt;&gt; 8) &amp; 0xff;

    // Register with the server to receive notification
    status = wiced_bt_gatt_send_write (conn_id, GATT_WRITE, p_write);
    return status;
}</pre>
<h1>Handle the new GATT Events</h1>
<p>In the screenshot of the serial terminal above you can see a bunch of &#8220;Unknown GATT Event 1&#8221;.  What is that?  To figure that out, right click on the GATT_CONNECTION_EVT and go to declaration.</p>
<p><a href="https://iotexpert.com/?attachment_id=5882" rel="attachment wp-att-5882"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.28.18-AM.png" alt="" width="765" height="217" class="alignnone size-full wp-image-5882" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.28.18-AM.png 765w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.28.18-AM-600x170.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.28.18-AM-300x85.png 300w" sizes="auto, (max-width: 765px) 100vw, 765px" /></a></p>
<p>This will take you to this enumeration, which shows all of the possible GATT events.  And, in this table you can see that 0x01 is GATT_OPERATION_CPLT_EVT.</p>
<pre class="start-line:611 EnlighterJSRAW" data-enlighter-language="c" ">/** GATT events */
typedef enum
{
    GATT_CONNECTION_STATUS_EVT,                         /**&lt; GATT connection status change. Event data: #wiced_bt_gatt_connection_status_t */
    GATT_OPERATION_CPLT_EVT,                            /**&lt; GATT operation complete. Event data: #wiced_bt_gatt_event_data_t */
    GATT_DISCOVERY_RESULT_EVT,                          /**&lt; GATT attribute discovery result. Event data: #wiced_bt_gatt_discovery_result_t */
    GATT_DISCOVERY_CPLT_EVT,                            /**&lt; GATT attribute discovery complete. Event data: #wiced_bt_gatt_event_data_t */
    GATT_ATTRIBUTE_REQUEST_EVT,                         /**&lt; GATT attribute request (from remote client). Event data: #wiced_bt_gatt_attribute_request_t */
    GATT_CONGESTION_EVT                                 /**&lt; GATT congestion (running low in tx buffers). Event data: #wiced_bt_gatt_congestion_event_t */
} wiced_bt_gatt_evt_t;
</pre>
<p>So, lets update the GATT Event handler for that case.  What Ill do is just printout the information that is sent (which is of type wiced_bt_gatt_event_data_t).</p>
<pre class="start-line:298 lang:c decode:true">    case GATT_OPERATION_CPLT_EVT:

        // When you get something back from the peripheral... print it out.. and all of its data

        WICED_BT_TRACE("Gatt Event Complete Conn=%d Op=%d status=0x%X Handle=0x%X len=%d Data=",
                p_data-&gt;operation_complete.conn_id,
                p_data-&gt;operation_complete.op,
                p_data-&gt;operation_complete.status,
                p_data-&gt;operation_complete.response_data.handle,
                p_data-&gt;operation_complete.response_data.att_value.len);

        for(int i=0;i&lt;p_data-&gt;operation_complete.response_data.att_value.len;i++)
        {
            WICED_BT_TRACE("%02X ",p_data-&gt;operation_complete.response_data.att_value.p_data[i]);
        }
        WICED_BT_TRACE("\n");

        break;</pre>
<p>After I program the CYW920719Q40EVB_01 you can see that things seem to be working.  Specifically, I found the peripheral, connected to it, set the CCCD for CapSense, then pressed the CapSense slider on the Peripheral.  Notice that after I set the CCCD, I get an event complete with op=3 and handle=0x12.  This is the write response message for the CCCD handle. (remember the hardcoded 0x12 from above).</p>
<p>The other thing to see is that each time there is CapSense update, the Peripheral sends out a notification of handle 0x11 with the current CapSense slider value.  Notice that the slider value is little endian.  You can see the last value is 0xFFFF which is a no touch in CapSense.</p>
<p><a href="https://iotexpert.com/?attachment_id=5883" rel="attachment wp-att-5883"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.31.49-AM.png" alt="" width="843" height="517" class="alignnone size-full wp-image-5883" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.31.49-AM.png 843w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.31.49-AM-600x368.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.31.49-AM-300x184.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-07-at-11.31.49-AM-768x471.png 768w" sizes="auto, (max-width: 843px) 100vw, 843px" /></a></p>
<p>The &#8220;op&#8221; is just one of the enumerated values from the list below.  You can see the 0x06 is Notification.  And 0x03 is Write.</p>
<pre class="start-line:366 EnlighterJSRAW" data-enlighter-language="c" ">/** GATT client operation type, used in client callback function
*/
enum wiced_bt_gatt_optype_e
{
    GATTC_OPTYPE_NONE             = 0,    /**&lt; None      */
    GATTC_OPTYPE_DISCOVERY        = 1,    /**&lt; Discovery */
    GATTC_OPTYPE_READ             = 2,    /**&lt; Read      */
    GATTC_OPTYPE_WRITE            = 3,    /**&lt; Write     */
    GATTC_OPTYPE_EXE_WRITE        = 4,    /**&lt; Execute Write */
    GATTC_OPTYPE_CONFIG           = 5,    /**&lt; Configure */
    GATTC_OPTYPE_NOTIFICATION     = 6,    /**&lt; Notification */
    GATTC_OPTYPE_INDICATION       = 7     /**&lt; Indication */
};</pre>
<p><span><p>You can find all of the source code for these projects at <a href="https://github.com/iotexpert/PSoC4BLE-Central">github.com/iotexpert/PSoc4BLE-Central </a></p>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Article</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2017/05/09/psoc4-ble-central-custom-profile-wled-capsense/">PSoC 4 BLE Central</a></td>
</tr>

<tr><td ><a href="https://iotexpert.com/2017/05/11/psoc4-ble-central-using-cysmart-dongle/">PSoC 4 BLE Central - Using the CySmart Dongle</a></td>
</tr>

<tr><td ><a href="https://iotexpert.com/2018/10/08/wiced-20719-ble-central-custom-profile-w-led-capsense-part-1/">WICED 20719 BLE Central Custom Profile w/LED &amp; CapSense - Part 1</a></td>
</tr>

<tr><td >WICED 20719 BLE Central Custom Profile w/LED &amp; CapSense - Part 2</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/wiced-20719-ble-central-custom-profile-w-led-capsense-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IoT Mailbox: An Introduction</title>
		<link>https://iotexpert.com/iot-mailbox-an-introduction/</link>
					<comments>https://iotexpert.com/iot-mailbox-an-introduction/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Mon, 13 Aug 2018 12:04:49 +0000</pubDate>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5743</guid>

					<description><![CDATA[Summary On the days that my newspaper carrier decides to deliver the newspaper, you can be sure that it won&#8217;t be there before 4:00am or after 10:00am.  Why do I still get a newspaper?  Because my wife likes it.  The status of the delivery is a constant source of speculation in the morning.  Have you [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>On the days that my newspaper carrier decides to deliver the newspaper, you can be sure that it won&#8217;t be there before 4:00am or after 10:00am.  Why do I still get a newspaper?  Because my wife likes it.  The status of the delivery is a constant source of speculation in the morning.  Have you been out to the newspaper box?  Will you go?  etc.  So it seems only logical to make an IoT device that figures out if I have a newspaper.  Obviously this is a bit silly to put as much time and effort as I have into that simple task.  But, doing something cool has it own worth.  And it will give me a chance to use the new WICED XR (extended range) Bluetooth radio module <a href="http://www.cypress.com/documentation/datasheets/cybt-483039-02-ez-bt-xr-wiced-module" target="_blank" rel="noopener">CYBT-483039-02</a>.</p>
<p><a href="https://iotexpert.com/2018/08/13/iot-mailbox-an-introduction/img_6171/" rel="attachment wp-att-5744"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/08/IMG_6171-225x300.jpg" alt="" width="225" height="300" class="alignnone wp-image-5744 size-medium" srcset="https://iotexpert.com/wp-content/uploads/2018/08/IMG_6171-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6171-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6171-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6171-scaled.jpg 1920w" sizes="auto, (max-width: 225px) 100vw, 225px" /></a></p>
<p>And here is a picture of the new module on the <a href="http://www.cypress.com/documentation/development-kitsboards/cybt-483039-eval-ez-bt-module-arduino-evaluation-board" target="_blank" rel="noopener">CYBT-483039-EVAL EZ-BT</a> evaluation kit.</p>
<p><a href="https://iotexpert.com/2018/08/13/iot-mailbox-an-introduction/cybt-483039-eval/" rel="attachment wp-att-5751"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/08/CYBT-483039-EVAL.jpg" alt="" width="302" height="404" class="alignnone size-full wp-image-5751" srcset="https://iotexpert.com/wp-content/uploads/2018/08/CYBT-483039-EVAL.jpg 302w, https://iotexpert.com/wp-content/uploads/2018/08/CYBT-483039-EVAL-224x300.jpg 224w" sizes="auto, (max-width: 302px) 100vw, 302px" /></a></p>
<p>For this design I want</p>
<ol>
<li>A newspaper sensor (not sure what that will be)</li>
<li>Waterproof case</li>
<li>A temperature sensor</li>
<li>A custom circuit board</li>
<li>A solar battery charger</li>
<li>The ability to program and debug the 20719 (which will be acting as a beacon)</li>
<li>An OTA Bootloader</li>
<li>A Real Time Clock</li>
<li>A wifi/ble bridge (inside the house)</li>
<li>Some cloud data capture and display</li>
<li>An iOS App</li>
</ol>
<p>So far, this project has been quite a rabbit hole as I don&#8217;t/didn&#8217;t know anything about battery power supplies.  Specifically energy harvesting solar powered lithium ion battery chargers and system power supply.  Unfortunately Cypress doesnt make an IC that performs this application &#8230; so if you send Mouser a few hundred dollars and they will send you a box of a bunch of different Solar PMIC Evaluation kits, ST, TI, Linear, Analog Devices, and Microchip. (which I will write about in detail later)</p>
<p><a href="https://iotexpert.com/2018/08/13/iot-mailbox-an-introduction/img_6174/" rel="attachment wp-att-5750"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/08/IMG_6174-e1533994969721-1024x768.jpg" alt="" width="1024" height="768" class="alignnone wp-image-5750 size-large" srcset="https://iotexpert.com/wp-content/uploads/2018/08/IMG_6174-e1533994969721-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6174-e1533994969721-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6174-e1533994969721-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/08/IMG_6174-e1533994969721-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>Architecture</h1>
<p>Here is a picture of the architecture.</p>
<p><a href="https://iotexpert.com/2018/08/13/iot-mailbox-an-introduction/mboxarch/" rel="attachment wp-att-5745"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/08/mboxarch-1024x842.png" alt="" width="1024" height="842" class="alignnone size-large wp-image-5745" srcset="https://iotexpert.com/wp-content/uploads/2018/08/mboxarch-1024x842.png 1024w, https://iotexpert.com/wp-content/uploads/2018/08/mboxarch-600x493.png 600w, https://iotexpert.com/wp-content/uploads/2018/08/mboxarch-300x247.png 300w, https://iotexpert.com/wp-content/uploads/2018/08/mboxarch-768x632.png 768w, https://iotexpert.com/wp-content/uploads/2018/08/mboxarch.png 1104w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>In the next Article I will start the process of learning about Solar Battery Charging PMICs.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Article</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2018/08/13/iot-mailbox-an-introduction/">IoT Mailbox Introduction</a></td>
<td >An introduction to the long series of articles about creating a new IoT System.</td>
</tr>

<tr><td >IoT Mailbox: Solar Battery Chargers &amp; System Power Supplies</td>
<td ></td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/iot-mailbox-an-introduction/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 9 &#8211; WICED Bluetooth: Classic Serial Port</title>
		<link>https://iotexpert.com/lesson-9-wiced-bluetooth-classic-serial-port/</link>
					<comments>https://iotexpert.com/lesson-9-wiced-bluetooth-classic-serial-port/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:39:24 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5625</guid>

					<description><![CDATA[Summary In all of the previous examples I have been using Bluetooth Low Energy.  One of the great benefits of the Cypress CYW20719 is that it is a Combo Radio.  Combo means that it can use both Bluetooth Low Energy as well as Bluetooth Classic.  I am late to the Bluetooth game but as best [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>In all of the previous examples I have been using Bluetooth Low Energy.  One of the great benefits of the Cypress CYW20719 is that it is a Combo Radio.  Combo means that it can use both Bluetooth Low Energy as well as Bluetooth Classic.  I am late to the Bluetooth game but as best I can tell Bluetooth Classic and Bluetooth Low Energy are exactly the same &#8230; except everything is different.  When Bluetooth was originally conceived, one of the principal functions was to act as &#8220;serial port wire cutter&#8221;.  Everywhere you looked there were devices that used a serial port wire, e.g. mice, printers, keyboards etc.</p>
<p>For this lesson we are going to dip back into the snip directory to get a Bluetooth Classic program to start with.  The program snip.bt.spp implements the Serial Port Profile (SPP).  The SPP is emulates a classic serial port.  It has all of the uart wires that we know and love including rx,tx,cts etc.  What this allows you to do is open up a high speed (much faster than BLE) connection.</p>
<p>To implement this lesson I will perform the following steps</p>
<ol>
<li>Make a new folder in the wiced_bt_class folder</li>
<li>Copy the files from apps/snip/bt/spp into my new folder</li>
<li>Create a make target and program it</li>
<li>Make a connection using a Bluetooth serial port on my Mac</li>
<li>Look at where the pin is set</li>
<li>Examine the spp setup code</li>
<li>Modify it to print out all the data sent to the SPP</li>
</ol>
<h1>Implement the SPP</h1>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-41-56-am/" rel="attachment wp-att-5630"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.41.56-AM.png" alt="" width="512" height="169" class="alignnone size-large wp-image-5630" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.41.56-AM.png 512w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.41.56-AM-300x99.png 300w" sizes="auto, (max-width: 512px) 100vw, 512px" /></a></p>
<p>Set the folder name to &#8220;spp&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-44-33-am/" rel="attachment wp-att-5632"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.44.33-AM.png" alt="" width="523" height="585" class="alignnone size-full wp-image-5632" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.44.33-AM.png 523w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.44.33-AM-268x300.png 268w" sizes="auto, (max-width: 523px) 100vw, 523px" /></a></p>
<p>Copy and past the files from the folder apps.snip.bt.spp</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-42-21-am/" rel="attachment wp-att-5629"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.42.21-AM.png" alt="" width="482" height="118" class="alignnone size-full wp-image-5629" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.42.21-AM.png 482w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.42.21-AM-300x73.png 300w" sizes="auto, (max-width: 482px) 100vw, 482px" /></a><br />
And paste them into your new spp folder</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-46-49-am/" rel="attachment wp-att-5633"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.46.49-AM.png" alt="" width="340" height="223" class="alignnone size-full wp-image-5633" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.46.49-AM.png 340w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.46.49-AM-300x197.png 300w" sizes="auto, (max-width: 340px) 100vw, 340px" /></a></p>
<p>Create a make target for your spp project</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-47-49-am/" rel="attachment wp-att-5635"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.47.49-AM.png" alt="" width="452" height="442" class="alignnone size-full wp-image-5635" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.47.49-AM.png 452w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.47.49-AM-300x293.png 300w" sizes="auto, (max-width: 452px) 100vw, 452px" /></a></p>
<p>Program the board with your project</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-51-35-am/" rel="attachment wp-att-5634"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM-1024x648.png" alt="" width="1024" height="648" class="alignnone size-large wp-image-5634" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM-1024x648.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM-600x379.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM-300x190.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM-768x486.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.51.35-AM.png 1306w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now tell the computer to open a classic connection by running file-&gt;open bluetooth</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-9-00-25-am/" rel="attachment wp-att-5641"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.00.25-AM.png" alt="" width="654" height="394" class="alignnone size-full wp-image-5641" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.00.25-AM.png 654w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.00.25-AM-600x361.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.00.25-AM-300x181.png 300w" sizes="auto, (max-width: 654px) 100vw, 654px" /></a></p>
<p>Select the &#8220;spp test&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-9-08-06-am/" rel="attachment wp-att-5642"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM-1024x799.png" alt="" width="1024" height="799" class="alignnone size-large wp-image-5642" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM-1024x799.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM-600x468.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM-300x234.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM-768x600.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.08.06-AM.png 1158w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now press some keys on the new terminal window&#8230; and look at the output window of the &#8220;spp test&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-58-00-am/" rel="attachment wp-att-5637"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM-1024x703.png" alt="" width="1024" height="703" class="alignnone size-large wp-image-5637" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM-1024x703.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM-600x412.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM-300x206.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM-768x528.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.58.00-AM.png 1782w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Type in the pin code which is 0000.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-8-57-46-am/" rel="attachment wp-att-5638"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM-1024x479.png" alt="" width="1024" height="479" class="alignnone size-large wp-image-5638" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM-1024x479.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM-600x281.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM-300x140.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM-768x359.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-8.57.46-AM.png 1026w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>But, how did I know the pin code?  Look at the source code.</p>
<pre class="start-line:154 lang:c decode:true ">uint8_t pincode[4] = { 0x30, 0x30, 0x30, 0x30 };
</pre>
<p>Now, when you press keys on the &#8220;Bluetooth serial terminal&#8221; you will see a not very helpful message on the CYW920719Q40EVB-01 terminal window.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-9-11-49-am/" rel="attachment wp-att-5643"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM-1024x706.png" alt="" width="1024" height="706" class="alignnone size-large wp-image-5643" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM-1024x706.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM-600x413.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM-300x207.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM-768x529.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-9.11.49-AM.png 1788w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>I think that it would be better to print out the characters that the person types.  So lets figure out how this works.  In the application init function on line 251 there is a call to wiced_bt_spp_startup</p>
<pre class="start-line:233 EnlighterJSRAW" data-enlighter-language="c" ">void application_init(void)
{
    wiced_bt_gatt_status_t gatt_status;
    wiced_result_t         result;


#if SEND_DATA_ON_INTERRUPT
    /* Configure the button available on the platform */
    wiced_platform_register_button_callback( WICED_PLATFORM_BUTTON_1, app_interrupt_handler, NULL, WICED_PLATFORM_BUTTON_RISING_EDGE);

    // init timer that we will use for the rx data flow control.
    wiced_init_timer(&amp;app_tx_timer, app_tx_ack_timeout, 0, WICED_MILLI_SECONDS_TIMER);
#endif

    app_write_eir();


    // Initialize SPP library
    wiced_bt_spp_startup(&amp;spp_reg);</pre>
<p>That function takes a pointer to a structure with a bunch of interesting things in it.  Notice that there is a function called &#8220;spp_rx_data_callback&#8221; that is called every time that data come in from the SPP.</p>
<pre class="start-line:111 EnlighterJSRAW" data-enlighter-language="c"">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 */
};</pre>
<p>Now look at the function spp_rx_data_callback.  All it does is print out a message saying how much data and the hex value of the data.</p>
<pre class="start-line:450 EnlighterJSRAW" data-enlighter-language="c" ">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 (&amp;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;
}</pre>
<p>So,  How about instead of that message we just print out the data.</p>
<pre class="start-line:465 EnlighterJSRAW" data-enlighter-language="c"">    //WICED_BT_TRACE("%s handle:%d len:%d %02x-%02x\n", __FUNCTION__, handle, data_len, p_data[0], p_data[data_len - 1]);

    for(int i=0;i&lt;data_len;i++)
        WICED_BT_TRACE("%c",p_data[i]);</pre>
<p>Now when I run the project and type I see the characters that I type coming out on the serial port.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/screen-shot-2018-06-27-at-10-27-02-am/" rel="attachment wp-att-5645"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM-1024x451.png" alt="" width="1024" height="451" class="alignnone size-large wp-image-5645" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM-1024x451.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM-600x264.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM-300x132.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM-768x338.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-27-at-10.27.02-AM.png 1562w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-9-wiced-bluetooth-classic-serial-port/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 8 &#8211; WICED Bluetooth: The Advertising Scanner</title>
		<link>https://iotexpert.com/lesson-8-wiced-bluetooth-the-advertising-scanner/</link>
					<comments>https://iotexpert.com/lesson-8-wiced-bluetooth-the-advertising-scanner/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:38:54 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5600</guid>

					<description><![CDATA[Summary In the last lesson I showed you how to build a BLE Advertising Beacon.  In that lesson I used a program called the &#8220;AdvScanner&#8221; which ran on a CYW920719Q40EVB-01 and acted like a Bluetooth Sniffer.  In this lesson I&#8217;ll show you how to build a simpler version of that program to look for the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>In the last lesson I showed you how to build a BLE Advertising Beacon.  In that lesson I used a program called the &#8220;AdvScanner&#8221; which ran on a CYW920719Q40EVB-01 and acted like a Bluetooth Sniffer.  In this lesson I&#8217;ll show you how to build a simpler version of that program to look for the L7_Advertiser we built in the last lesson.</p>
<p>The important concepts in this lesson are:</p>
<ol>
<li>BLE Scanning</li>
<li>Parsing Advertising Packets</li>
</ol>
<p>I am going to build a project that Scans for BLE Advertisers.  Then, I&#8217;ll add the ability to print out the advertising packet.  And finally, I will add filtering capability to only look for advertisers who are using the Cypress Manufacturers code.</p>
<p>The steps that we will follow are:</p>
<ol>
<li>Make a new project with WICED Bluetooth Designer called L8_Scanner</li>
<li>Turn off the GATT Database</li>
<li>Move it into your project folder</li>
<li>Fix the WICED_BT_TRACE to use the PUART</li>
<li>Create a make target and build it</li>
<li>Add a new function that prints out Advertising Packets</li>
<li>Update the l8_scanner_app_init function to remove Advertising</li>
<li>Update the wiced_bt_config to never stop scanning</li>
<li>Program the development kit and see what happens</li>
<li>Update the newAdv function to print out the raw data in the advertising packet</li>
<li>Program again and see all of the chaos</li>
<li>Put a filter for the Advertisers using the Cypress MFG Code</li>
<li>Program</li>
</ol>
<h1>Implement the Project</h1>
<p>Create a new project called L8_Scanner using the Bluetooth Designer</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-3-27-25-pm/" rel="attachment wp-att-5601"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.25-PM.png" alt="" width="522" height="501" class="alignnone size-full wp-image-5601" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.25-PM.png 522w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.25-PM-300x288.png 300w" sizes="auto, (max-width: 522px) 100vw, 522px" /></a></p>
<p>Turn off the GATT Database and then press Generate Code</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-3-27-38-pm/" rel="attachment wp-att-5602"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.38-PM.png" alt="" width="663" height="477" class="alignnone size-full wp-image-5602" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.38-PM.png 663w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.38-PM-600x432.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.27.38-PM-300x216.png 300w" sizes="auto, (max-width: 663px) 100vw, 663px" /></a></p>
<p>Move the project into the wiced_bt_class folder</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-3-41-07-pm/" rel="attachment wp-att-5605"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.41.07-PM.png" alt="" width="262" height="192" class="alignnone size-full wp-image-5605" /></a></p>
<p>Update the WICED_BT_TRACE to send output to the PUART</p>
<pre class="start-line:105 lang:c decode:true ">#if ((defined WICED_BT_TRACE_ENABLE) || (defined HCI_TRACE_OVER_TRANSPORT))
    /* Set the Debug UART as WICED_ROUTE_DEBUG_NONE to get rid of prints */
    //  wiced_set_debug_uart( WICED_ROUTE_DEBUG_NONE );

    /* Set Debug UART as WICED_ROUTE_DEBUG_TO_PUART to see debug traces on Peripheral UART (PUART) */
      wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

    /* Set the Debug UART as WICED_ROUTE_DEBUG_TO_WICED_UART to send debug strings over the WICED debug interface */
    //wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_WICED_UART );
#endif</pre>
<p>Modify the make target &amp; program that was created by the BT Designer</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-3-38-52-pm/" rel="attachment wp-att-5604"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.38.52-PM.png" alt="" width="386" height="404" class="alignnone size-full wp-image-5604" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.38.52-PM.png 386w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.38.52-PM-287x300.png 287w" sizes="auto, (max-width: 386px) 100vw, 386px" /></a></p>
<p>Make a new function that will be called when WICED finds a new advertising packet.</p>
<pre class="start-line:120 lang:c decode:true">void newAdv(wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data)
{
    WICED_BT_TRACE("Found device %B\n",p_scan_result-&gt;remote_bd_addr);

}</pre>
<p>Remove the start advertising from l8_scanner_app_init</p>
<pre class="start-line:127 lang:c decode:true">/*
 * This function is executed in the BTM_ENABLED_EVT management callback.
 */
void l8_scanner_app_init(void)
{
    /* Initialize Application */
    wiced_bt_app_init();

    /* Allow peer to pair */
    wiced_bt_set_pairable_mode(WICED_TRUE, 0);

    /* Set Advertisement Data */
    //l8_scanner_set_advertisement_data();

    /* Start Undirected LE Advertisements on device startup.
     * The corresponding parameters are contained in 'wiced_bt_cfg.c' */
    /* TODO: Make sure that this is the desired behavior. */
    //wiced_bt_start_advertisements(BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL);
    wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_HIGH_DUTY,FALSE,newAdv);
}</pre>
<p>Update wiced_bt_config.c to never stop scanning.</p>
<pre class="start-line:53 lang:c decode:true">        .high_duty_scan_duration =          0,                                                          /**&lt; High Duty Scan Duration in seconds (0 for infinite) */
</pre>
<p>Program your development kit and see what happens.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-4-05-52-pm/" rel="attachment wp-att-5606"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM-1024x553.png" alt="" width="1024" height="553" class="alignnone size-large wp-image-5606" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM-1024x553.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM-600x324.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM-300x162.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM-768x414.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.05.52-PM.png 1160w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now lets update the program to print the advertising packets.</p>
<pre class="start-line:120 lang:c decode:true">void newAdv(wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data)
{

    uint8_t mfgLen;
    uint8_t* mfgData = wiced_bt_ble_check_advertising_data( p_adv_data,0xFF,&amp;mfgLen);


    WICED_BT_TRACE("Found device %B ",p_scan_result-&gt;remote_bd_addr);

    uint8_t index=0;
    int fieldLength=p_adv_data[index];
    do {
        for(int i=0;i&lt;=fieldLength;i++)
            WICED_BT_TRACE("%02X ",p_adv_data[index+i]);

        index = index + fieldLength + 1;
        fieldLength = p_adv_data[index];

    } while(fieldLength);

    WICED_BT_TRACE("\n");
}
</pre>
<p>Now program the development kit and see what happens.  Where I am sitting this is not very helpful because there are boatloads of advertisers.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-4-30-26-pm/" rel="attachment wp-att-5607"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.30.26-PM-1024x539.png" alt="" width="1024" height="539" class="alignnone size-large wp-image-5607" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.30.26-PM-1024x539.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.30.26-PM-600x316.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.30.26-PM-300x158.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-4.30.26-PM-768x404.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now let&#8217;s make one more change.  Instead of printing all of the packets let&#8217;s only look only at the ones that have Manufacturer data, the right length and the Cypress manufacturer id.</p>
<pre class="lang:c decode:true ">    uint8_t mfgLen;
    uint8_t* mfgData = wiced_bt_ble_check_advertising_data( p_adv_data,0xFF,&amp;mfgLen);

    if(!(mfgData &amp;&amp; mfgLen == 3 &amp;&amp; mfgData[0] == 0x31 &amp;&amp; mfgData[1]  == 0x01 ))
        return;
</pre>
<p>Now I only see my L7_Advertising project</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/screen-shot-2018-06-26-at-5-21-49-pm/" rel="attachment wp-att-5618"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM-1024x639.png" alt="" width="1024" height="639" class="alignnone size-large wp-image-5618" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM-1024x639.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM-600x374.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM-300x187.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM-768x479.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.21.49-PM.png 1658w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-8-wiced-bluetooth-the-advertising-scanner/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 7 &#8211; WICED Bluetooth: Bluetooth Advertising</title>
		<link>https://iotexpert.com/lesson-7-wiced-bluetooth-bluetooth-advertising/</link>
					<comments>https://iotexpert.com/lesson-7-wiced-bluetooth-bluetooth-advertising/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:38:21 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5578</guid>

					<description><![CDATA[Summary Everywhere you go there are bunches of Bluetooth devices that are acting as beacons.  Apple has a standard called iBeacon.  Google has a standard called Eddystone.  Some companies use those standards, and some companies make proprietary beacons.  In this lesson we will build a beacon. The important concepts in this lesson are: Advertising packet [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>Everywhere you go there are bunches of Bluetooth devices that are acting as beacons.  Apple has a standard called iBeacon.  Google has a standard called Eddystone.  Some companies use those standards, and some companies make proprietary beacons.  In this lesson we will build a beacon.</p>
<p>The important concepts in this lesson are:</p>
<ol>
<li>Advertising packet formats</li>
<li>wiced_bt_cfg.c</li>
</ol>
<p>The steps I will follow are:</p>
<ol>
<li>Run BT Designer</li>
<li>Setup the device as &#8220;no gatt database&#8221;</li>
<li>Move the project into the wiced_bt_class folder</li>
<li>Edit the make target</li>
<li>Fix the WICED_BT_TRACE to go to the PUART</li>
<li>Run it</li>
<li>Edit the wiced_bt_cfg.c to never timeout</li>
<li>Setup no random address changing</li>
<li>Add the manufacturing data uint8_t array and include the Cypress company code</li>
<li>Change the start advertising call to BTM_BLE_ADVERT_NONCONN_HIGH, BLE_ADDR_PUBLIC</li>
<li>Update the length of the advertising packet</li>
<li>Update the set advertising packet to have the manufacturing data</li>
<li>Add a button interrupt function</li>
<li>Register the button interrupt</li>
</ol>
<h1>BLE Concepts</h1>
<p>The Advertising Packet is a string of 3-31 bytes that is broadcast at a configurable interval. The packet is broken up into variable length fields. Each field has the form:</p>
<ul>
<li>Length in bytes (not including the Length byte)</li>
<li>Type</li>
<li>Optional Data</li>
</ul>
<p>The minimum packet requires the &lt;&lt;Flags&gt;&gt; field which is a set of flags that defines how the device behaves (e.g. is it connectable?). Here is a list of the other field Types that you can add:</p>
<pre class="start-line:161 lang:c decode:true ">/** Advertisement data types */
enum wiced_bt_ble_advert_type_e {
    BTM_BLE_ADVERT_TYPE_FLAG                        = 0x01,                 /**&lt; Advertisement flags */
    BTM_BLE_ADVERT_TYPE_16SRV_PARTIAL               = 0x02,                 /**&lt; List of supported services - 16 bit UUIDs (partial) */
    BTM_BLE_ADVERT_TYPE_16SRV_COMPLETE              = 0x03,                 /**&lt; List of supported services - 16 bit UUIDs (complete) */
    BTM_BLE_ADVERT_TYPE_32SRV_PARTIAL               = 0x04,                 /**&lt; List of supported services - 32 bit UUIDs (partial) */
    BTM_BLE_ADVERT_TYPE_32SRV_COMPLETE              = 0x05,                 /**&lt; List of supported services - 32 bit UUIDs (complete) */
    BTM_BLE_ADVERT_TYPE_128SRV_PARTIAL              = 0x06,                 /**&lt; List of supported services - 128 bit UUIDs (partial) */
    BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE             = 0x07,                 /**&lt; List of supported services - 128 bit UUIDs (complete) */
    BTM_BLE_ADVERT_TYPE_NAME_SHORT                  = 0x08,                 /**&lt; Short name */
    BTM_BLE_ADVERT_TYPE_NAME_COMPLETE               = 0x09,                 /**&lt; Complete name */
    BTM_BLE_ADVERT_TYPE_TX_POWER                    = 0x0A,                 /**&lt; TX Power level  */
    BTM_BLE_ADVERT_TYPE_DEV_CLASS                   = 0x0D,                 /**&lt; Device Class */
    BTM_BLE_ADVERT_TYPE_SIMPLE_PAIRING_HASH_C       = 0x0E,                 /**&lt; Simple Pairing Hash C */
    BTM_BLE_ADVERT_TYPE_SIMPLE_PAIRING_RAND_C       = 0x0F,                 /**&lt; Simple Pairing Randomizer R */
    BTM_BLE_ADVERT_TYPE_SM_TK                       = 0x10,                 /**&lt; Security manager TK value */
    BTM_BLE_ADVERT_TYPE_SM_OOB_FLAG                 = 0x11,                 /**&lt; Security manager Out-of-Band data */
    BTM_BLE_ADVERT_TYPE_INTERVAL_RANGE              = 0x12,                 /**&lt; Slave connection interval range */
    BTM_BLE_ADVERT_TYPE_SOLICITATION_SRV_UUID       = 0x14,                 /**&lt; List of solicitated services - 16 bit UUIDs */
    BTM_BLE_ADVERT_TYPE_128SOLICITATION_SRV_UUID    = 0x15,                 /**&lt; List of solicitated services - 128 bit UUIDs */
    BTM_BLE_ADVERT_TYPE_SERVICE_DATA                = 0x16,                 /**&lt; Service data - 16 bit UUID */
    BTM_BLE_ADVERT_TYPE_PUBLIC_TARGET               = 0x17,                 /**&lt; Public target address */
    BTM_BLE_ADVERT_TYPE_RANDOM_TARGET               = 0x18,                 /**&lt; Random target address */
    BTM_BLE_ADVERT_TYPE_APPEARANCE                  = 0x19,                 /**&lt; Appearance */
    BTM_BLE_ADVERT_TYPE_ADVERT_INTERVAL             = 0x1a,                 /**&lt; Advertising interval */
    BTM_BLE_ADVERT_TYPE_LE_BD_ADDR                  = 0x1b,                 /**&lt; LE device bluetooth address */
    BTM_BLE_ADVERT_TYPE_LE_ROLE                     = 0x1c,                 /**&lt; LE role */
    BTM_BLE_ADVERT_TYPE_256SIMPLE_PAIRING_HASH      = 0x1d,                 /**&lt; Simple Pairing Hash C-256 */
    BTM_BLE_ADVERT_TYPE_256SIMPLE_PAIRING_RAND      = 0x1e,                 /**&lt; Simple Pairing Randomizer R-256 */
    BTM_BLE_ADVERT_TYPE_32SOLICITATION_SRV_UUID     = 0x1f,                 /**&lt; List of solicitated services - 32 bit UUIDs */
    BTM_BLE_ADVERT_TYPE_32SERVICE_DATA              = 0x20,                 /**&lt; Service data - 32 bit UUID */
    BTM_BLE_ADVERT_TYPE_128SERVICE_DATA             = 0x21,                 /**&lt; Service data - 128 bit UUID */
    BTM_BLE_ADVERT_TYPE_CONN_CONFIRM_VAL            = 0x22,                 /**&lt; LE Secure Connections Confirmation Value */
    BTM_BLE_ADVERT_TYPE_CONN_RAND_VAL               = 0x23,                 /**&lt; LE Secure Connections Random Value */
    BTM_BLE_ADVERT_TYPE_URI                         = 0x24,                 /**&lt; URI */
    BTM_BLE_ADVERT_TYPE_INDOOR_POS                  = 0x25,                 /**&lt; Indoor Positioning */
    BTM_BLE_ADVERT_TYPE_TRANS_DISCOVER_DATA         = 0x26,                 /**&lt; Transport Discovery Data */
    BTM_BLE_ADVERT_TYPE_SUPPORTED_FEATURES          = 0x27,                 /**&lt; LE Supported Features */
    BTM_BLE_ADVERT_TYPE_UPDATE_CH_MAP_IND           = 0x28,                 /**&lt; Channel Map Update Indication */
    BTM_BLE_ADVERT_TYPE_PB_ADV                      = 0x29,                 /**&lt; PB-ADV */
    BTM_BLE_ADVERT_TYPE_MESH_MSG                    = 0x2A,                 /**&lt; Mesh Message */
    BTM_BLE_ADVERT_TYPE_MESH_BEACON                 = 0x2B,                 /**&lt; Mesh Beacon */
    BTM_BLE_ADVERT_TYPE_3D_INFO_DATA                = 0x3D,                 /**&lt; 3D Information Data */
    BTM_BLE_ADVERT_TYPE_MANUFACTURER                = 0xFF                  /**&lt; Manufacturer data */
};</pre>
<p>Here is an example of the advertising packet that we are going to generate</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-3-15-02-pm/" rel="attachment wp-att-5597"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM-1024x198.png" alt="" width="1024" height="198" class="alignnone size-large wp-image-5597" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM-1024x198.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM-600x116.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM-300x58.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM-768x149.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-3.15.02-PM.png 1260w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>Implement the Project</h1>
<p>Run BT Designer and create a new project called &#8220;L7_Advertising&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-1-50-23-pm/" rel="attachment wp-att-5584"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.23-PM.png" alt="" width="523" height="501" class="alignnone size-large wp-image-5584" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.23-PM.png 523w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.23-PM-300x287.png 300w" sizes="auto, (max-width: 523px) 100vw, 523px" /></a></p>
<p>Turn off the GATT Database</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-1-50-58-pm/" rel="attachment wp-att-5583"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.58-PM.png" alt="" width="709" height="487" class="alignnone size-large wp-image-5583" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.58-PM.png 709w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.58-PM-600x412.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.50.58-PM-300x206.png 300w" sizes="auto, (max-width: 709px) 100vw, 709px" /></a> <a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-1-50-23-pm/" rel="attachment wp-att-5584"></a></p>
<p>Move the project into the wiced_bt_class folder</p>
<p><a href="https://iotexpert.com/?attachment_id=5582" rel="attachment wp-att-5582"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.51.41-PM.png" alt="" width="299" height="287" class="alignnone size-full wp-image-5582" /></a></p>
<p>Edit the make target</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-1-24-22-pm/" rel="attachment wp-att-5580"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.24.22-PM.png" alt="" width="653" height="414" class="alignnone size-full wp-image-5580" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.24.22-PM.png 653w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.24.22-PM-600x380.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.24.22-PM-300x190.png 300w" sizes="auto, (max-width: 653px) 100vw, 653px" /></a></p>
<p>Setup the the WICED_BT_TRACE to use the PUART</p>
<pre class="start-line:115 lang:c decode:true">#if ((defined WICED_BT_TRACE_ENABLE) || (defined HCI_TRACE_OVER_TRANSPORT))
    /* Set the Debug UART as WICED_ROUTE_DEBUG_NONE to get rid of prints */
    //  wiced_set_debug_uart( WICED_ROUTE_DEBUG_NONE );

    /* Set Debug UART as WICED_ROUTE_DEBUG_TO_PUART to see debug traces on Peripheral UART (PUART) */
      wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

    /* Set the Debug UART as WICED_ROUTE_DEBUG_TO_WICED_UART to send debug strings over the WICED debug interface */
    //wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_WICED_UART );
#endif</pre>
<p>Run it</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-1-55-47-pm/" rel="attachment wp-att-5585"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM-1024x557.png" alt="" width="1024" height="557" class="alignnone size-large wp-image-5585" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM-1024x557.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM-600x326.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM-300x163.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM-768x417.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-1.55.47-PM.png 1148w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now that we know it is working, Ill edit the wiced_bt_cfg.c to never timeout</p>
<pre class="start-line:98 lang:c decode:true">        .high_duty_nonconn_duration =       0,                                                         /**&lt; High Duty Non-Connectable Advertising Duration in seconds (0 for infinite) */
</pre>
<p>Setup no random address changing</p>
<pre class="start-line:145 lang:c decode:true">    .rpa_refresh_timeout =                  WICED_BT_CFG_DEFAULT_RANDOM_ADDRESS_NEVER_CHANGE,         /**&lt; Interval of random address refreshing - secs */
</pre>
<p>Now edit the L7_Advertising.c to add the manufacturing data uint8_t array</p>
<pre class="start-line:49 lang:c decode:true">uint8_t manuf_data[] = {0x31,0x01,0x00};</pre>
<p>Switch to non-connectable advertising</p>
<pre class="start-line:148 lang:c decode:true">    wiced_bt_start_advertisements(BTM_BLE_ADVERT_NONCONN_HIGH, BLE_ADDR_PUBLIC, NULL);
</pre>
<p>Update the l7_advertising_set_advertisement_data function to have three elements in the advertising packet</p>
<pre class="start-line:160 lang:c decode:true">    wiced_bt_ble_advert_elem_t adv_elem[3] = { 0 };
</pre>
<p>Add the Manufacturer information to the advertising packet</p>
<pre class="start-line:177 lang:c decode:true">    /* Advertisement Element for Manufacturer Data */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_MANUFACTURER;
    adv_elem[num_elem].len = sizeof(manuf_data);
    adv_elem[num_elem].p_data = manuf_data;
    num_elem++;</pre>
<p>Add a button interrupt function</p>
<pre class="start-line:94 lang:c decode:true">void buttonISR(void *data, uint8_t port_pin )
{

    manuf_data[2] += 1;
    l7_advertising_set_advertisement_data();
    WICED_BT_TRACE("Manufacturer Data = %d\n",manuf_data[2]);
}</pre>
<p>Register the button interrupt</p>
<pre class="start-line:150 lang:c decode:true"> wiced_hal_gpio_register_pin_for_interrupt( WICED_GPIO_PIN_BUTTON_1, buttonISR, NULL );
    wiced_hal_gpio_configure_pin( WICED_GPIO_PIN_BUTTON_1, ( GPIO_INPUT_ENABLE | GPIO_PULL_UP | GPIO_EN_INT_FALLING_EDGE ), GPIO_PIN_OUTPUT_HIGH );
</pre>
<h1>Test using the AdvScanner</h1>
<p>I have given you a project called the &#8220;AdvScanner&#8221;.  You can run it by creating a make target.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-2-15-18-pm/" rel="attachment wp-att-5589"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.15.18-PM.png" alt="" width="481" height="367" class="alignnone size-full wp-image-5589" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.15.18-PM.png 481w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.15.18-PM-300x229.png 300w" sizes="auto, (max-width: 481px) 100vw, 481px" /></a></p>
<p>When I run the L7_Advertising project and press the buttons a few times my terminal will look like this</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-2-16-15-pm/" rel="attachment wp-att-5590"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM-1024x550.png" alt="" width="1024" height="550" class="alignnone size-large wp-image-5590" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM-1024x550.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM-600x322.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM-300x161.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM-768x412.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.16.15-PM.png 1166w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>And when I look at the output of the scanner program you can see the advertising packet for the this project.  Notice that the last three bytes are 31 01 03.  The 03 is the count of button presses.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/screen-shot-2018-06-26-at-2-10-57-pm/" rel="attachment wp-att-5588"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.10.57-PM-1024x665.png" alt="" width="1024" height="665" class="alignnone size-large wp-image-5588" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.10.57-PM-1024x665.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.10.57-PM-600x390.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.10.57-PM-300x195.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-2.10.57-PM-768x499.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-7-wiced-bluetooth-bluetooth-advertising/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 6 &#8211; WICED Bluetooth: The Peripheral Comes Alive</title>
		<link>https://iotexpert.com/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/</link>
					<comments>https://iotexpert.com/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:37:58 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5551</guid>

					<description><![CDATA[Summary In the last lesson we built our first Bluetooth design using BT Designer.  In that lesson I showed you how to Build a project using BT Designer Start Advertising Get connected Central &#8211;&#62; Peripheral Read &#38; Write the data from the Central to the  Peripheral In this lesson we are going to answer the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>In the last lesson we built our first Bluetooth design using BT Designer.  In that lesson I showed you how to</p>
<ol>
<li>Build a project using BT Designer</li>
<li>Start Advertising</li>
<li>Get connected Central &#8211;&gt; Peripheral</li>
<li>Read &amp; Write the data from the Central to the  Peripheral</li>
</ol>
<p>In this lesson we are going to answer the question how does the Peripheral write data back to the Central by adding a button to our last project.  When the button is pressed it will send the state of the button (0 or 1) back to Central.</p>
<p>The important concepts in this lesson are</p>
<ol>
<li>BLE Notifications</li>
<li>BLE Client Configuration Characteristic Descriptor</li>
<li>How to manually modify the Gatt DB</li>
</ol>
<p>I will follow these steps:</p>
<ol>
<li>Copy the project L5_BluetoothLED into L6_BluetoothLEDButton</li>
<li>Rename all of the files to be L6_BluetoothLEDButton&#8230;.</li>
<li>Fix the makefile</li>
<li>Create a make target and make sure that it still works</li>
<li>Modify L6_BluetoothLEDButton_db.h to add UUID and Handles for the new Button characteristic</li>
<li>Modify L6_BluetoothLEDButton_db.c to add the Button characteristic to the GATT Database</li>
<li>Add initial value arrays for the Button characteristic, CCCD and User Description</li>
<li>Add the Button values to the GATT lookup table</li>
<li>Add connection id uint16_t connection_id</li>
<li>Modify the connection handler l5_bluetoothled_connect_callback</li>
<li>Create a button callback function</li>
<li>Register the button callback</li>
</ol>
<h1>BLE Concepts</h1>
<p>A Bluetooth Peripheral is allowed to send <strong>Notifications</strong> to a Central that a value in the GATT Database has changed.  However, it is only allowed to do this when the <strong>Client Characteristic Configuration Descriptor (CCCD)</strong> is set.  In other words a Central can register with a Peripheral that it is interested in seeing changes of Characteristics by writing a 0x01 into the CCCD.  The CCCD is just another value in the attribute database.</p>
<p>To setup a Characteristic for Notifications you need to modify the GATT Database by</p>
<ol>
<li>Adding the notification property to the Characteristic in the GATT Database</li>
<li>Adding the CCCD to the GATT database</li>
</ol>
<p>In the your program, when a value is changed, you should check to see if the CCCD is set, then send a notification if it is set.</p>
<h1>Implement the Project</h1>
<p>I am going to build this project on top of the code from L5_BluetoothLED.  So, start this project by copying the project L5_BluetoothLED into L6_BluetoothLEDButton by doing copy/paste</p>
<p>Rename all of the files to be L6_BluetoothLEDButton&#8230;. your project should look like this.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/screen-shot-2018-06-26-at-8-57-17-am/" rel="attachment wp-att-5561"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-8.57.17-AM.png" alt="" width="277" height="242" class="alignnone size-full wp-image-5561" /></a></p>
<p>Fix the makefile.mk (because the file names have changed)</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#
# This file has been automatically generated by the WICED 20719-B1 Designer.
#

APP_SRC = L6_BluetoothLEDButton.c
APP_SRC += L6_BluetoothLEDButton_db.c
APP_SRC += wiced_bt_cfg.c

C_FLAGS += -DWICED_BT_TRACE_ENABLE

# If defined, HCI traces are sent over transport/WICED HCI interface
C_FLAGS += -DHCI_TRACE_OVER_TRANSPORT
</pre>
<p>Create a make target and make sure that it still works</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/screen-shot-2018-06-26-at-8-55-55-am/" rel="attachment wp-att-5560"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-8.55.55-AM.png" alt="" width="538" height="340" class="alignnone size-large wp-image-5560" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-8.55.55-AM.png 538w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-8.55.55-AM-300x190.png 300w" sizes="auto, (max-width: 538px) 100vw, 538px" /></a></p>
<p>Modify L6_BluetoothLEDButton_db.h to create a UUID for the new Button characteristic</p>
<pre class="start-line:16 EnlighterJSRAW" data-enlighter-language="c"">#define __UUID_L5SERVICE_BUTTON               0x2A, 0xbf, 0x86, 0xa6, 0xc8, 0x6c, 0x4e, 0xa5, 0xaa, 0x56, 0xbd, 0xac, 0x72, 0x80, 0x93, 0xa9
</pre>
<p>Modify L6_BluetoothLEDButton_db.h to add Handles for the  new Button characteristic</p>
<pre class="start-line:37 EnlighterJSRAW" data-enlighter-language="c"">#define HDLC_L5SERVICE_BUTTON                      0x0030
#define HDLC_L5SERVICE_BUTTON_VALUE                0x0031
#define HDLD_L5SERVICE_BUTTON_USER_DESCRIPTION     0x0032
#define HDLD_L5SERVICE_BUTTON_CLIENT_CONFIGURATION 0x0033</pre>
<p>Modify L6_BluetoothLEDButton_db.c to add the Button characteristic to the GATT Database</p>
<pre class="start-line:48 EnlighterJSRAW" data-enlighter-language="c"">               /* Characteristic 'BUTTON' */

                CHARACTERISTIC_UUID128(HDLC_L5SERVICE_BUTTON, HDLC_L5SERVICE_BUTTON_VALUE,
                        __UUID_L5SERVICE_BUTTON, LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY,
                    LEGATTDB_PERM_READABLE ),

                    /* Descriptor 'Characteristic User Description' */
                    CHAR_DESCRIPTOR_UUID16 (HDLD_L5SERVICE_BUTTON_USER_DESCRIPTION,
                        UUID_DESCRIPTOR_CHARACTERISTIC_USER_DESCRIPTION, LEGATTDB_PERM_READABLE),


                /* Descriptor CCCD */
                CHAR_DESCRIPTOR_UUID16_WRITABLE(HDLD_L5SERVICE_BUTTON_CLIENT_CONFIGURATION,
                        UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,
                        LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ ),</pre>
<p>Add initial value arrays for the Button characteristic, CCCD and User Description into L6_ButtonLED.c</p>
<pre class="start-line:101 lang:c decode:true">uint8_t l5_bluetoothled_l5service_button[]                  = {0x01};
uint8_t l5_bluetoothled_l5service_button_user_description[] = "Button Value";
uint8_t l5_bluetoothled_l5service_button_cccd[]      = {0x00,0x00};</pre>
<p>Add the Button values to the GATT lookup table</p>
<pre class="start-line:119 EnlighterJSRAW" data-enlighter-language="c" ">    {HDLC_L5SERVICE_BUTTON_VALUE,              1,                                                      1,                                                      l5_bluetoothled_l5service_button},
    {HDLD_L5SERVICE_BUTTON_USER_DESCRIPTION,   sizeof(l5_bluetoothled_l5service_button_user_description)-1, sizeof(l5_bluetoothled_l5service_button_user_description)-1, l5_bluetoothled_l5service_button_user_description},
    {HDLD_L5SERVICE_BUTTON_CLIENT_CONFIGURATION, 2,      2,      l5_bluetoothled_l5service_button_cccd},
</pre>
<p>Add connection id uint16_t connection_id</p>
<pre class="start-line:125 EnlighterJSRAW" data-enlighter-language="c"">uint16_t connection_id=0;
</pre>
<p>Modify the connection handler l5_bluetoothled_connect_callback.  When you get a connection save it.</p>
<pre class="start-line:507 lang:c decode:true">            connection_id = p_conn_status-&gt;conn_id;
</pre>
<p>and when you get a disconnect put it back to 0</p>
<pre class="start-line:516 lang:c decode:true ">          connection_id = 0;</pre>
<p>Here is what the whole handler looks like now</p>
<pre class="start-line:516 EnlighterJSRAW" data-enlighter-language="c"">/* GATT Connection Status Callback */
wiced_bt_gatt_status_t l5_bluetoothled_connect_callback( wiced_bt_gatt_connection_status_t *p_conn_status )
{
    wiced_bt_gatt_status_t status = WICED_BT_GATT_ERROR;

    if ( NULL != p_conn_status )
    {
        if ( p_conn_status-&gt;connected )
        {
            // Device has connected
            WICED_BT_TRACE("Connected : BDA '%B', Connection ID '%d'\n", p_conn_status-&gt;bd_addr, p_conn_status-&gt;conn_id );

            /* TODO: Handle the connection */
            connection_id = p_conn_status-&gt;conn_id;

        }
        else
        {
            // Device has disconnected
            WICED_BT_TRACE("Disconnected : BDA '%B', Connection ID '%d', Reason '%d'\n", p_conn_status-&gt;bd_addr, p_conn_status-&gt;conn_id, p_conn_status-&gt;reason );

            /* TODO: Handle the disconnection */
            connection_id = 0;

            /* restart the advertisements */
            wiced_bt_start_advertisements(BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL);
        }
        status = WICED_BT_GATT_SUCCESS;
    }

    return status;
}</pre>
<p>Create a button callback function</p>
<pre class="start-line:131 EnlighterJSRAW" data-enlighter-language="c"">void buttonISR(void *data, uint8_t port_pin )
{

    l5_bluetoothled_l5service_button[0] = wiced_hal_gpio_get_pin_input_status(WICED_PLATFORM_BUTTON_1);

    if(l5_bluetoothled_l5service_button_cccd[0] &amp; GATT_CLIENT_CONFIG_NOTIFICATION)
              {
                  wiced_bt_gatt_send_notification(connection_id, HDLC_L5SERVICE_BUTTON_VALUE, sizeof(l5_bluetoothled_l5service_button), l5_bluetoothled_l5service_button );

                  WICED_BT_TRACE( "Sent Button %d\n",l5_bluetoothled_l5service_button[0]);
   }
}</pre>
<p>In the function l5_bluetoothled_app_init you need to register the button callback to trigger when the button is pressed</p>
<pre class="start-line:202 lang:c decode:true ">    wiced_hal_gpio_register_pin_for_interrupt( WICED_GPIO_PIN_BUTTON_1, buttonISR, NULL );
    wiced_hal_gpio_configure_pin( WICED_GPIO_PIN_BUTTON_1, ( GPIO_INPUT_ENABLE | GPIO_PULL_UP | GPIO_EN_INT_BOTH_EDGE ), GPIO_PIN_OUTPUT_HIGH );</pre>
<h1>Test using CySmart</h1>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6013/" rel="attachment wp-att-5567"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5567" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6013.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6014/" rel="attachment wp-att-5568"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5568" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6014.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Click on the &#8220;Unknown Service&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6015/" rel="attachment wp-att-5569"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5569" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6015.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Click on the second characteristic.  (we know that is the one because it is Read and Notify)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6016/" rel="attachment wp-att-5570"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5570" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6016.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Now you can press &#8220;Read&#8221;</p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6017/" rel="attachment wp-att-5571"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5571" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6017.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>After clicking the read button and you can see that the value is 0x01 (because you are not pressing the button).  If you were pressing it you would see 0x00</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6018/" rel="attachment wp-att-5572"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5572" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6018.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Now press Notify and you should see the value change each time you press the button</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/img_6019/" rel="attachment wp-att-5573"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5573" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6019.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 5 &#8211; WICED Bluetooth: Bluetooth Designer &#8211; Turn up the Radio!</title>
		<link>https://iotexpert.com/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/</link>
					<comments>https://iotexpert.com/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:37:35 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5506</guid>

					<description><![CDATA[Summary In this lesson we are going to build the simplest project that I could think of&#8230; turning an LED on/off with Bluetooth Low Energy. The important BLE concepts are What is a Central / Peripheral What is Advertising What is a GATT Database The important WICED Bluetooth Concepts are: How do you run WICED [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>In this lesson we are going to build the simplest project that I could think of&#8230; turning an LED on/off with Bluetooth Low Energy.</p>
<p>The important BLE concepts are</p>
<ol>
<li>What is a Central / Peripheral</li>
<li>What is Advertising</li>
<li>What is a GATT Database</li>
</ol>
<p>The important WICED Bluetooth Concepts are:</p>
<ol>
<li>How do you run WICED Bluetooth Designer</li>
<li>What is the structure of a WICED Bluetooth Project</li>
<li>What is a Callback</li>
<li>How is the GATT Database Implemented</li>
<li>How to run CySmart</li>
</ol>
<p>The steps that we will follow are:</p>
<ol>
<li>Run BT Designer</li>
<li>Create a project called L5_BluetoothLED</li>
<li>Go to the characteristics page</li>
<li>Add a vendor specific service</li>
<li>Name the Service L5Service</li>
<li>Add an optional characteristic that is vendor specific</li>
<li>Name it RED</li>
<li>Make it 1 byte with an initial value of 01</li>
<li>Set it up for host write</li>
<li>Add a user description to the characteristic</li>
<li>Generate the code</li>
<li>Move the folder to the wiced_bt_class folder</li>
<li>Fix the three include problems</li>
<li>Reset the debug UART to PUART</li>
<li>When there is a write, change the value of the WICED_LED_1 GPIO</li>
<li>Test</li>
</ol>
<h1>BLE Concepts</h1>
<p>In the world of BLE there are two sides of every connection</p>
<ul>
<li>The Central &#8211; typically a cellphone</li>
<li>The Peripheral &#8211; your WICED device</li>
</ul>
<p>Centrals listen for Peripherals that are Advertising.  Advertising is a periodic packet of up to 31 bytes of information that a Peripheral will send out to make it presence known.  When a Central hears the Advertising packets of a Peripheral that is &#8220;interesting&#8221; it can initiate a connection.</p>
<p>Once a connection is made, how do you exchange information?  The answer is that a Peripheral has a database running inside of it.  The database is called a &#8220;GATT database&#8221;.   A Central can perform &#8220;Service Discovery&#8221; to find all of the legal stuff in the database.  The GATT database is organized into one or more &#8220;Services&#8221; that have one or more &#8220;Characteristics&#8221;.  For instance a Heart Rate Monitor might have a &#8220;Heart Rate Service&#8221; with two characteristics, one for heart rate and one for battery level.</p>
<p>There are two types of Services.  Ones that are specified by the Bluetooth SIG, like heartrate.  And vendor specific custom services.</p>
<h1>Run Bluetooth Designer</h1>
<p>The Bluetooth Designer is a GUI tool that we built into Eclipse.  It allows you to configure some of the fundamental Bluetooth feature (like the GATT Database) and then automatically generate the code.  Start Bluetooth Designer by running File-&gt;New-&gt;WICED Bluetooth Designer.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-00-54-am/" rel="attachment wp-att-5509"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM-1024x614.png" alt="" width="1024" height="614" class="alignnone size-large wp-image-5509" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM-1024x614.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM-600x360.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM-300x180.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM-768x460.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.00.54-AM.png 1502w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Since this is Lesson 5 and we are going to write and LED&#8230; call the project &#8220;L5_BluetoothLED&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-01-43-am/" rel="attachment wp-att-5508"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM-1024x987.png" alt="" width="1024" height="987" class="alignnone size-large wp-image-5508" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM-1024x987.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM-600x578.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM-300x289.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM-768x740.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.01.43-AM.png 1042w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Once you start BT Designer, you screen should look like this.  The project is going to be a BLE only project.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-57-39-am/" rel="attachment wp-att-5520"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM-1024x749.png" alt="" width="1024" height="749" class="alignnone size-large wp-image-5520" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM-1024x749.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM-600x439.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM-300x219.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM-768x561.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.57.39-AM.png 1628w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The Characteristics button lets you setup the GATT database.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-58-02-am/" rel="attachment wp-att-5519"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM-1024x739.png" alt="" width="1024" height="739" class="alignnone size-large wp-image-5519" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM-1024x739.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM-600x433.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM-300x216.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM-768x554.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.02-AM.png 1630w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Add a service by selecting vendor specific service and then hitting the &#8220;+&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-58-14-am/" rel="attachment wp-att-5518"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.14-AM.png" alt="" width="736" height="298" class="alignnone size-large wp-image-5518" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.14-AM.png 736w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.14-AM-600x243.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.58.14-AM-300x121.png 300w" sizes="auto, (max-width: 736px) 100vw, 736px" /></a></p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-58-45-am/" rel="attachment wp-att-5517"></a>I&#8217;ll call the service &#8220;L5Service&#8221;</p>
<p><a href="https://iotexpert.com/?attachment_id=5521" rel="attachment wp-att-5521"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM-1024x870.png" alt="" width="1024" height="870" class="alignnone size-large wp-image-5521" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM-1024x870.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM-600x510.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM-300x255.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM-768x652.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.09.00-PM.png 1648w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Next add a characteristic by selecting &#8220;vendor specific characteristic&#8221; and pressing &#8220;+&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-11-59-13-am/" rel="attachment wp-att-5515"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.59.13-AM.png" alt="" width="692" height="398" class="alignnone size-large wp-image-5515" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.59.13-AM.png 692w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.59.13-AM-600x345.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-11.59.13-AM-300x173.png 300w" sizes="auto, (max-width: 692px) 100vw, 692px" /></a></p>
<p>Change the name to &#8220;RED&#8221;, Make the device role &#8220;Host write to or reads from service&#8221;.  Make the size 1 byte and set the initial value to 01 (it must be 01 not 1 or 001)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-12-11-34-pm/" rel="attachment wp-att-5523"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM-1024x871.png" alt="" width="1024" height="871" class="alignnone size-large wp-image-5523" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM-1024x871.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM-600x511.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM-300x255.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM-768x653.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.34-PM.png 1636w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>When we are looking at this remotely you would like to be able to see the user description.  So click that tab and give it a description.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-12-11-19-pm/" rel="attachment wp-att-5524"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM-1024x880.png" alt="" width="1024" height="880" class="alignnone size-large wp-image-5524" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM-1024x880.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM-600x516.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM-300x258.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM-768x660.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.11.19-PM.png 1636w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Press Generate Code button.  You will end up with a folder in the top level apps directory.  I don&#8217;t like this, so lets move it into our class projects folder.  You can do this by dragging the folder to the wiced_bt_class folder.  Now it should look like this:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-3-05-12-pm/" rel="attachment wp-att-5528"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.05.12-PM.png" alt="" width="662" height="600" class="alignnone size-full wp-image-5528" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.05.12-PM.png 662w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.05.12-PM-600x544.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.05.12-PM-300x272.png 300w" sizes="auto, (max-width: 662px) 100vw, 662px" /></a></p>
<p>Unfortunately, there are three little issues that this creates which need to be fixed.  First, you need to fix L5_BluetoothLED.c as this include is wrong.</p>
<pre class="start-line:9 lang:c decode:true">#include "../wiced_bt_class/L5_BluetoothLED/L5_BluetoothLED_db.h"
</pre>
<p>And change it to:</p>
<pre class="start-line:9 lang:c decode:true">#include "L5_BluetoothLED_db.h"
</pre>
<p>Next edit L5_BluetoothLED_db.h and add the #include &#8220;wiced.h&#8221;</p>
<pre class="start-line:9 lang:c decode:true ">#include "wiced.h"
</pre>
<p>Finally edit the L5_BluetoothLED_db.c to fix the same include problem.</p>
<pre class="start-line:11 lang:c decode:true ">#include "../wiced_bt_class/L5_BluetoothLED/L5_BluetoothLED_db.h"
</pre>
<p>It should be like this.</p>
<pre class="start-line:11 lang:c decode:true ">#include "L5_BluetoothLED_db.h"
</pre>
<p>Now edit the make target that was created by the BT Designer and change it to:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/screen-shot-2018-06-25-at-12-16-07-pm/" rel="attachment wp-att-5529"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM-1024x890.png" alt="" width="1024" height="890" class="alignnone size-large wp-image-5529" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM-1024x890.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM-600x522.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM-300x261.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM-768x668.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-12.16.07-PM.png 1162w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Remember in the earlier lesson I showed you about the WICED HCI UART and the WICED PUART.  Well by default the WICED_BT_TRACE is setup to go to the HCI UART.  So, lets fix the output of BT_TRACE to go to the PUART by changing the file &#8220;L5_BluetoothLED.c&#8221;</p>
<pre class="start-line:136 lang:c decode:true ">#if ((defined WICED_BT_TRACE_ENABLE) || (defined HCI_TRACE_OVER_TRANSPORT))
    /* Set the Debug UART as WICED_ROUTE_DEBUG_NONE to get rid of prints */
    //  wiced_set_debug_uart( WICED_ROUTE_DEBUG_NONE );

    /* Set Debug UART as WICED_ROUTE_DEBUG_TO_PUART to see debug traces on Peripheral UART (PUART) */
      wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

    /* Set the Debug UART as WICED_ROUTE_DEBUG_TO_WICED_UART to send debug strings over the WICED debug interface */
    //wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_WICED_UART );
#endif</pre>
<p>The last thing that we want to do is fix it so that when the Central writes a new value into the RED LED characteristic we should write the GPIO to the new value.  In L5_BluetoothLED.c make this change.</p>
<pre class="start-line:408 lang:c decode:true">     case HDLC_L5SERVICE_RED_VALUE:
                       WICED_BT_TRACE("LED = %d\n",l5_bluetoothled_l5service_red[0]);
                       wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_2,l5_bluetoothled_l5service_red[0]);
                       break;</pre>
<p>Now build the project and see what happens.  The first testing step will be to open CySmart.  You can see that a device called &#8220;L5_BluetoothLED&#8221; is advertising.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6004/" rel="attachment wp-att-5541"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004-576x1024.png" alt="" width="576" height="1024" class="alignnone wp-image-5541 size-large" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6004.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>When I click it, you can see that there is a GattDB.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6005/" rel="attachment wp-att-5540"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5540" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6005.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>When I click on the database, I can see that there is only one service (which makes sense as we setup only one)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6006/" rel="attachment wp-att-5539"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5539" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6006.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Click on the Service and you can see that there is only one characteristic in the service&#8230; and its value is 01.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6008/" rel="attachment wp-att-5537"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5537" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6008.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>When you click the descriptor button you can see that there is a Characteristic User Description <a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6007/" rel="attachment wp-att-5538"></a></p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/?attachment_id=5536" rel="attachment wp-att-5536"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5536" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6009.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>And finally the value is &#8220;Red LED Value&#8221;.  That is what we setup.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6010/" rel="attachment wp-att-5535"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5535" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6010.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>When you click back &#8230; then click on the write it will bring up this window where I can send a new value.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6012/" rel="attachment wp-att-5532"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5532" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6012.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>Now the value is 0x00 and the RED LED is on (remember from earlier that it is active low so that makes sense)</p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6011/" rel="attachment wp-att-5534"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011-576x1024.png" alt="" width="576" height="1024" class="alignnone size-large wp-image-5534" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011-576x1024.png 576w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011-600x1067.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011-169x300.png 169w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011-768x1365.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6011.png 1242w" sizes="auto, (max-width: 576px) 100vw, 576px" /></a></p>
<p>And when I look at the terminal I can see two writes (I wrote again before I took this screen shot)<a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/img_6004/" rel="attachment wp-att-5541"></a></p>
<p><a href="https://iotexpert.com/?attachment_id=5531" rel="attachment wp-att-5531"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM-1024x672.png" alt="" width="1024" height="672" class="alignnone size-large wp-image-5531" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM-1024x672.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM-600x394.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM-300x197.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM-768x504.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-3.17.31-PM.png 1932w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>A Tour of the Source Code</h1>
<p>The GATT Database is in the file L5_BluetoothLED_db.c</p>
<pre class="start-line:18 lang:c decode:true ">const uint8_t gatt_database[] = // Define GATT database
{
    /* Primary Service 'Generic Attribute' */
    PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ATTRIBUTE, UUID_SERVICE_GATT),

    /* Primary Service 'Generic Access' */
    PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ACCESS, UUID_SERVICE_GAP),

        /* Characteristic 'Device Name' */
        CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_DEVICE_NAME, HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE,
            UUID_CHARACTERISTIC_DEVICE_NAME, LEGATTDB_CHAR_PROP_READ,
            LEGATTDB_PERM_READABLE),

        /* Characteristic 'Appearance' */
        CHARACTERISTIC_UUID16 (HDLC_GENERIC_ACCESS_APPEARANCE, HDLC_GENERIC_ACCESS_APPEARANCE_VALUE,
            UUID_CHARACTERISTIC_APPEARANCE, LEGATTDB_CHAR_PROP_READ,
            LEGATTDB_PERM_READABLE),

    /* Primary Service 'L5Service' */
    PRIMARY_SERVICE_UUID128 (HDLS_L5SERVICE, __UUID_L5SERVICE),

        /* Characteristic 'RED' */
        CHARACTERISTIC_UUID128_WRITABLE (HDLC_L5SERVICE_RED, HDLC_L5SERVICE_RED_VALUE,
            __UUID_L5SERVICE_RED, LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,
            LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ),

            /* Descriptor 'Characteristic User Description' */
            CHAR_DESCRIPTOR_UUID16 (HDLD_L5SERVICE_RED_USER_DESCRIPTION,
                UUID_DESCRIPTOR_CHARACTERISTIC_USER_DESCRIPTION, LEGATTDB_PERM_READABLE),

};</pre>
<p>Each row in the Database table has a unique &#8220;Handle&#8221; that is defined in the L5_BluetoothLED_db.h</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">#define __UUID_L5SERVICE                      0x30, 0x9d, 0x7f, 0x29, 0x73, 0xca, 0x4f, 0xfd, 0xa5, 0x68, 0x17, 0xd8, 0x90, 0x67, 0x7f, 0x35
#define __UUID_L5SERVICE_RED                  0x29, 0xbf, 0x86, 0xa6, 0xc8, 0x6c, 0x4e, 0xa5, 0xaa, 0x56, 0xbd, 0xac, 0x72, 0x80, 0x93, 0xa9

// ***** Primary Service 'Generic Attribute'
#define HDLS_GENERIC_ATTRIBUTE                0x0001

// ***** Primary Service 'Generic Access'
#define HDLS_GENERIC_ACCESS                   0x0014
// ----- Characteristic 'Device Name'
#define HDLC_GENERIC_ACCESS_DEVICE_NAME       0x0015
#define HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE 0x0016
// ----- Characteristic 'Appearance'
#define HDLC_GENERIC_ACCESS_APPEARANCE        0x0017
#define HDLC_GENERIC_ACCESS_APPEARANCE_VALUE  0x0018

// ***** Primary Service 'L5Service'
#define HDLS_L5SERVICE                        0x0028
// ----- Characteristic 'RED'
#define HDLC_L5SERVICE_RED                    0x0029
#define HDLC_L5SERVICE_RED_VALUE              0x002A
// ===== Descriptor 'User Description'
#define HDLD_L5SERVICE_RED_USER_DESCRIPTION   0x002B</pre>
<p>Each characteristic value is held in one of the uint8_t arrays found in &#8220;L5_BluetoothLED.c&#8221;</p>
<pre class="start-line:94 lang:c decode:true ">/*******************************************************************
 * GATT Initial Value Arrays
 ******************************************************************/
uint8_t l5_bluetoothled_generic_access_device_name[]     = {'L','5','_','B','l','u','e','t','o','o','t','h','L','E','D'};
uint8_t l5_bluetoothled_generic_access_appearance[]      = {0x00,0x00};
uint8_t l5_bluetoothled_l5service_red[]                  = {0x01};
uint8_t l5_bluetoothled_l5service_red_user_description[] = {'R','E','D',' ','L','e','d',' ','V','a','l','u','e'};

/*******************************************************************
 * GATT Lookup Table
 ******************************************************************/

/* GATT attribute lookup table                                */
/* (attributes externally referenced by GATT server database) */
gatt_db_lookup_table l5_bluetoothled_gatt_db_ext_attr_tbl[] =
{
    /* { attribute handle,                  maxlen,                                                 curlen,                                                 attribute data } */
    {HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE, 15,                                                     15,                                                     l5_bluetoothled_generic_access_device_name},
    {HDLC_GENERIC_ACCESS_APPEARANCE_VALUE,  2,                                                      2,                                                      l5_bluetoothled_generic_access_appearance},
    {HDLC_L5SERVICE_RED_VALUE,              1,                                                      1,                                                      l5_bluetoothled_l5service_red},
    {HDLD_L5SERVICE_RED_USER_DESCRIPTION,   sizeof(l5_bluetoothled_l5service_red_user_description), sizeof(l5_bluetoothled_l5service_red_user_description), l5_bluetoothled_l5service_red_user_description},
};</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 4 &#8211; WICED Bluetooth: Using Snips</title>
		<link>https://iotexpert.com/lesson-4-wiced-bluetooth-using-snips/</link>
					<comments>https://iotexpert.com/lesson-4-wiced-bluetooth-using-snips/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:37:15 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5485</guid>

					<description><![CDATA[Summary In this lesson I am going to show you how to NOT write all of your own code and still get the job done.  In this lesson we are going to do three things. Examine &#38; Run the hal_gpio snip Examine &#38; Run the hal_i2c_master snip Copy the hal_i2c_master snip and make it &#8220;more [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>In this lesson I am going to show you how to NOT write all of your own code and still get the job done.  In this lesson we are going to do three things.</p>
<ol>
<li>Examine &amp; Run the hal_gpio snip</li>
<li>Examine &amp; Run the hal_i2c_master snip</li>
<li>Copy the hal_i2c_master snip and make it &#8220;more better&#8221;</li>
</ol>
<p>To modify the hal_i2c_master snip I will</p>
<ol>
<li>Make a new folder called L4_Accelerometer</li>
<li>Copy the makefile.mk and hal_i2c_master.c into the L4_Accelerometer folder</li>
<li>Create a new make target and make sure that things still work</li>
<li>Look at the LSM9DS1 datasheet</li>
<li>Update the function initialize_app to startup the Accelerometer and speed up the polling</li>
<li>Update the function comboread_cb to read the Acceleration registers and print out the values</li>
</ol>
<h1>Run hal_gpio</h1>
<p>If you dont already have a make target for snip.hal.hal_gpio create one and then program the board.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-10-16-38-am/" rel="attachment wp-att-5500"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.16.38-AM.png" alt="" width="870" height="702" class="alignnone size-full wp-image-5500" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.16.38-AM.png 870w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.16.38-AM-600x484.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.16.38-AM-300x242.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.16.38-AM-768x620.png 768w" sizes="auto, (max-width: 870px) 100vw, 870px" /></a></p>
<p>Notice that the light blinking will change speeds if you press the button.  Let&#8217;s look at the code that does this:</p>
<p>At the beginning it sets up a timer</p>
<pre class="start-line:132 lang:c decode:true ">        // Initialize timer to control the pin toggle frequency
        if (wiced_init_timer(&amp;hal_gpio_app_timer, &amp;hal_gpio_app_timer_cb, 0, WICED_SECONDS_PERIODIC_TIMER) == WICED_SUCCESS)
        {
            if (wiced_start_timer(&amp;hal_gpio_app_timer, LED_BLINK_FREQ_A_IN_SECONDS) != WICED_SUCCESS)
            {
                WICED_BT_TRACE("Seconds Timer Error\n");
            }
        }</pre>
<p>The timer calls this function each time the timer expires.</p>
<pre class="start-line:189 EnlighterJSRAW" data-enlighter-language="c" ">/*
 * The function invoked on timeout of app. seconds timer.
 */
void hal_gpio_app_timer_cb(uint32_t arg)
{
    static uint32_t wiced_seconds = 0; /* number of seconds elapsed */
    uint8_t index = 0;

    wiced_seconds++;

    if (wiced_seconds &amp; 1)
    {
        for (index = 0; index &lt; sizeof(output_pin_list); index++)
        {
            wiced_hal_gpio_set_pin_output(output_pin_list[index], GPIO_PIN_OUTPUT_LOW);
        }
    }
    else
    {
        for (index = 0; index &lt; sizeof(output_pin_list); index++)
        {
            wiced_hal_gpio_set_pin_output(output_pin_list[index], GPIO_PIN_OUTPUT_HIGH);
        }
    }
}</pre>
<p>And when the button is pressed all it does is switch back and forth between two different intervals for the timer.  And after the switch it restarts the timer.</p>
<pre class="start-line:212 lang:c decode:true">/*
 * Handle interrupt generated due to change in the GPIO state
 */
void hal_gpio_app_interrrupt_handler(void *data, uint8_t pin)
{
    static uint32_t blink_freq = LED_BLINK_FREQ_A_IN_SECONDS;

    // toggle LED blink rate upon each button press
    if (blink_freq == LED_BLINK_FREQ_A_IN_SECONDS)
    {
        blink_freq = LED_BLINK_FREQ_B_IN_SECONDS;
    }
    else
    {
        blink_freq = LED_BLINK_FREQ_A_IN_SECONDS;
    }

    if (wiced_stop_timer(&amp;hal_gpio_app_timer) == WICED_SUCCESS)
    {
        wiced_start_timer(&amp;hal_gpio_app_timer, blink_freq);
    }

    // clear the interrupt status
    wiced_hal_gpio_clear_pin_interrupt_status(pin);
}
</pre>
<h1>Run hal_i2c_master</h1>
<p>This CYW920719Q40EVB_01 development kit has an I2C LSM9DS1 accelerometer on it.  And I noticed that when looking around in the snips that the Snip called &#8220;hal_i2c_master.c&#8221; appears to talk to the chip.  Here is a little section of the comments from the top of the snip</p>
<pre class="lang:c decode:true"> *
 * WICED sample application for I2C Master usage
 *
 * This application demonstrates how to use I2C driver interface
 * to send and receive bytes or a stream of bytes over the I2C hardware as a master.
 * The on-board LSM9DS1 motion sensor acts as the I2C slave
</pre>
<p>So, lets run the snip and see what happens.  If you don&#8217;t have a make target&#8230; well then make one.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-26-at-5-06-39-pm/" rel="attachment wp-att-5612"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.06.39-PM.png" alt="" width="426" height="401" class="alignnone size-full wp-image-5612" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.06.39-PM.png 426w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-26-at-5.06.39-PM-300x282.png 300w" sizes="auto, (max-width: 426px) 100vw, 426px" /></a></p>
<p>Then make the make target.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-29-07-am/" rel="attachment wp-att-5490"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM-1024x805.png" alt="" width="1024" height="805" class="alignnone size-large wp-image-5490" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM-1024x805.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM-600x471.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM-300x236.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM-768x603.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.29.07-AM.png 1372w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>It turns out that &#8220;0&#8221; is a bug in the example project.  And printing out the WHO_AM_I register isnt really very interesting.</p>
<h1>Modify the hal_i2c_master.c Create a Better Project</h1>
<p>I don&#8217;t like making changes inside of the WICED SDK files.  But, I want to fix the bug and printout something more interesting.  So start by creating a new folder in the wiced_bt_class folder</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-36-00-am/" rel="attachment wp-att-5493"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM-1024x595.png" alt="" width="1024" height="595" class="alignnone size-large wp-image-5493" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM-1024x595.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM-600x348.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM-300x174.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM-768x446.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.00-AM.png 1078w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Type in the directory name L4_Accelerometer (notice in the screenshot below I mistyped it)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-36-37-am/" rel="attachment wp-att-5492"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM-922x1024.png" alt="" width="922" height="1024" class="alignnone size-large wp-image-5492" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM-922x1024.png 922w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM-600x666.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM-270x300.png 270w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM-768x853.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.36.37-AM.png 1050w" sizes="auto, (max-width: 922px) 100vw, 922px" /></a></p>
<p>Select the makefile.mk and the hal_i2c_master.c then right click copy the files.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-40-44-am/" rel="attachment wp-att-5495"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.40.44-AM.png" alt="" width="830" height="616" class="alignnone size-large wp-image-5495" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.40.44-AM.png 830w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.40.44-AM-600x445.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.40.44-AM-300x223.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.40.44-AM-768x570.png 768w" sizes="auto, (max-width: 830px) 100vw, 830px" /></a></p>
<p>Then select the L4_Accelerometer folder and pick paste.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-41-00-am/" rel="attachment wp-att-5494"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.41.00-AM.png" alt="" width="768" height="508" class="alignnone size-full wp-image-5494" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.41.00-AM.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.41.00-AM-600x397.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.41.00-AM-300x198.png 300w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
<p>Create a make target for the L4_Accelerometer</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-52-20-am/" rel="attachment wp-att-5497"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM-1024x795.png" alt="" width="1024" height="795" class="alignnone size-large wp-image-5497" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM-1024x795.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM-600x466.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM-300x233.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM-768x596.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.52.20-AM.png 1092w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Build it to make sure it still works.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-51-11-am/" rel="attachment wp-att-5496"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM-1024x924.png" alt="" width="1024" height="924" class="alignnone size-large wp-image-5496" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM-1024x924.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM-600x541.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM-300x271.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM-768x693.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.51.11-AM.png 1592w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now that we have a base to stand-on.  Let&#8217;s have a look at the data sheet.  I have used these before and I know that you need to turn on the Accelerometer to give you anything interesting.  Turns out CTRL_REG_6_XL is the control register we need.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-15-02-am/" rel="attachment wp-att-5487"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM-1024x270.png" alt="" width="1024" height="270" class="alignnone size-large wp-image-5487" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM-1024x270.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM-600x158.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM-300x79.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM-768x203.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.02-AM.png 1956w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-15-17-am/" rel="attachment wp-att-5486"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM-1024x974.png" alt="" width="1024" height="974" class="alignnone size-large wp-image-5486" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM-1024x974.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM-600x570.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM-300x285.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM-768x730.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.15.17-AM.png 1420w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The other interesting registers are the actual output of the accelerometer.  That is 0x28 &#8211;&gt; 0x2D</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-9-21-36-am/" rel="attachment wp-att-5489"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM-1024x440.png" alt="" width="1024" height="440" class="alignnone size-large wp-image-5489" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM-1024x440.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM-600x258.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM-300x129.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM-768x330.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-9.21.36-AM.png 1628w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Start by modifying the function initialize_app to turn on the accelerometer by writing 0x40 to register 0x20</p>
<pre class="start-line:113 EnlighterJSRAW" data-enlighter-language="c"">uint8_t status;
    // Turn on Accelerometer - Register 0x20... 2g accelerometer on @ 50hz
    uint8_t data[] = {0x20, 0x40};
    status = wiced_hal_i2c_write(data,sizeof(data),LSM9DS1_ACC_GYRO_I2C_ADDRESS);

</pre>
<p>I dont really like printing the values every two seconds so I will modify the timer:</p>
<ul>
<li>Make it a milisecond timer</li>
<li>Set it to print every 500ms</li>
</ul>
<pre class="start-line:126 EnlighterJSRAW" data-enlighter-language="c"">if ( WICED_SUCCESS == wiced_init_timer( &amp;seconds_timer, &amp;comboread_cb, 0, WICED_MILLI_SECONDS_PERIODIC_TIMER )) {
        if ( WICED_SUCCESS != wiced_start_timer( &amp;seconds_timer, 500 )) {
            WICED_BT_TRACE( "Seconds Timer Error\n\r" );
        }
    }</pre>
<p>Here is the whole function initialize_app together</p>
<pre class="start-line:107 lang:c decode:true ">void initialize_app( void )
{
    wiced_hal_i2c_init();
    uint8_t status;

    // Turn on Accelerometer - Register 0x20... 2g accelerometer on @ 50hz
    uint8_t data[] = {0x20, 0x40};
    status = wiced_hal_i2c_write(data,sizeof(data),LSM9DS1_ACC_GYRO_I2C_ADDRESS);


    /* register callback for button available on the platform */
    wiced_platform_register_button_callback( WICED_PLATFORM_BUTTON_1, button_cb, NULL, WICED_PLATFORM_BUTTON_RISING_EDGE);

    current_speed = wiced_hal_i2c_get_speed();

    WICED_BT_TRACE("Default I2C speed: %d KHz\n", (CLK_FREQ/current_speed));

    /*Start a timer for POLL_TIMER seconds*/

    if ( WICED_SUCCESS == wiced_init_timer( &amp;seconds_timer, &amp;comboread_cb, 0, WICED_MILLI_SECONDS_PERIODIC_TIMER )) {
        if ( WICED_SUCCESS != wiced_start_timer( &amp;seconds_timer, 500 )) {
            WICED_BT_TRACE( "Seconds Timer Error\n\r" );
        }
    }

}
</pre>
<p>Next I need to modify the comboread_cb callback.  It will</p>
<ul>
<li>Setup a structure to hold the three acceleration values (Line 145)</li>
<li>Then it will read from the LSM9DS1 (Line 152)</li>
<li>Then print them (Line 156)</li>
</ul>
<pre class="start-line:132 EnlighterJSRAW" data-enlighter-language="c" ">/******************************************************************************
 * This function reads the value from I2C slave and prints it
 *****************************************************************************/

void comboread_cb (uint32_t arg)
{
    UINT8  status = 0xFF;
    UINT8 reg_add = 0x28; // Acceleromter register

    typedef struct {
        int16_t ax;
        int16_t ay;
        int16_t az;
    } __attribute__((packed)) accel_val_t;

    accel_val_t data;
    status = wiced_hal_i2c_combined_read((UINT8 *)&amp;reg_add, sizeof(UINT8), (uint8_t *)&amp;data, sizeof(data), LSM9DS1_ACC_GYRO_I2C_ADDRESS);

    if(I2CM_SUCCESS == status) {

        WICED_BT_TRACE("Ax=%d Ay=%d Az=%d\n",data.ax,data.ay,data.az);
    }else if(I2CM_OP_FAILED == status) {
        WICED_BT_TRACE("I2C comboread operation failed\r\n");
    }else if(I2CM_BUSY == status) {
        WICED_BT_TRACE("I2C busy\r\n");
    }else{
        WICED_BT_TRACE("Unknown status from I2C\r\n");
    }

}</pre>
<p>Now double click the make target and make sure that everything is working.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/screen-shot-2018-06-25-at-10-40-00-am/" rel="attachment wp-att-5504"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM-1024x908.png" alt="" width="1024" height="908" class="alignnone size-large wp-image-5504" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM-1024x908.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM-600x532.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM-300x266.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM-768x681.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-25-at-10.40.00-AM.png 1182w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-4-wiced-bluetooth-using-snips/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 3 &#8211; WICED Bluetooth: The Super Mux Tool</title>
		<link>https://iotexpert.com/lesson-3-wiced-bluetooth-the-super-mux-tool/</link>
					<comments>https://iotexpert.com/lesson-3-wiced-bluetooth-the-super-mux-tool/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:36:52 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5402</guid>

					<description><![CDATA[Summary You probably noticed and wondered &#8220;Why did he use WICED_LED_2 instead of WICED_LED_1&#8221;?  The answer to that question is that by default the CYW920719Q40EVB_01 is setup with WICED_LED_2 enabled as a GPIO and WICED_LED_1 used for another purpose.  But to what purpose?  In this lesson we will answer the questions: What are the default [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>You probably noticed and wondered &#8220;Why did he use WICED_LED_2 instead of WICED_LED_1&#8221;?  The answer to that question is that by default the CYW920719Q40EVB_01 is setup with WICED_LED_2 enabled as a GPIO and WICED_LED_1 used for another purpose.  But to what purpose?  In this lesson we will answer the questions:</p>
<ol>
<li>What are the default pins?</li>
<li>How do you use the SuperMux tool?</li>
<li>How do you use a PWM?</li>
</ol>
<p>To do this we are going to copy the L2_HelloWorld project and add a PWM to drive the Green LED also known as WICED_LED_1.</p>
<p>The steps we are going to follow are</p>
<ol>
<li>Copy the L2_HelloWorld to start a new project called L3_SuperMux</li>
<li>Rename L2_HelloWorld.c</li>
<li>Fix the makefile.mk for the updated source file</li>
<li>Create a new make target</li>
<li>Program to make sure everything is still working</li>
<li>Look at the platform files for CYW920719Q40EVB_01</li>
<li>Run  the SuperMux Tool</li>
<li>Delete the SPI Slave_1 From the SuperMux</li>
<li>Add an LED to the SuperMux</li>
<li>Configure the LED to P28</li>
<li>Apply the SuperMux configuration</li>
<li>Look at the new files added to the project</li>
<li>Look a the makefile.mk</li>
<li><span>Look L3_SuperMux_pin_config.c</span></li>
<li>Update L3_SuperMux.c to have correct includes</li>
<li>Update L3_SuperMux.c to start the clock, pin and PWM</li>
<li>Program the project</li>
<li>Look at the Hardware Abstraction Layer Documentation</li>
</ol>
<h1>Copy L2_HelloWorld &#8211;&gt; L3_SuperMux</h1>
<p>Instead of starting from a blank project.  Lets make a copy of the L2_HelloWorld project.  If you right click on the L2_HelloWorld folder and select copy</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-00-42-pm/" rel="attachment wp-att-5459"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.42-PM.png" alt="" width="382" height="102" class="alignnone size-large wp-image-5459" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.42-PM.png 382w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.42-PM-300x80.png 300w" sizes="auto, (max-width: 382px) 100vw, 382px" /></a></p>
<p>Then click on the &#8220;wiced_bt_class&#8221; folder and select paste.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-00-55-pm/" rel="attachment wp-att-5458"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.55-PM.png" alt="" width="484" height="103" class="alignnone size-large wp-image-5458" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.55-PM.png 484w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.00.55-PM-300x64.png 300w" sizes="auto, (max-width: 484px) 100vw, 484px" /></a></p>
<p>WICED Studio will then complain that you already have a directory called &#8220;L2_HelloWord&#8221; and give you the opportunity to rename it.  Call the new project &#8220;L3_SuperMux&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-01-16-pm/" rel="attachment wp-att-5457"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.01.16-PM.png" alt="" width="470" height="166" class="alignnone size-full wp-image-5457" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.01.16-PM.png 470w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.01.16-PM-300x106.png 300w" sizes="auto, (max-width: 470px) 100vw, 470px" /></a></p>
<p>Now you need to rename the L2_HelloWorld.c to be L3_SuperMux.c.  Right click on the L2_HelloWorld.c and select rename</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-02-24-pm/" rel="attachment wp-att-5461"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.24-PM.png" alt="" width="391" height="257" class="alignnone size-large wp-image-5461" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.24-PM.png 391w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.24-PM-300x197.png 300w" sizes="auto, (max-width: 391px) 100vw, 391px" /></a></p>
<p>Then give it a new file name&#8230; like L3_SuperMux.c</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-02-40-pm/" rel="attachment wp-att-5460"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.40-PM.png" alt="" width="480" height="158" class="alignnone size-full wp-image-5460" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.40-PM.png 480w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.02.40-PM-300x99.png 300w" sizes="auto, (max-width: 480px) 100vw, 480px" /></a></p>
<p>Double click makefile.mk and edit it.  You need to change the comment, and the name of the APP_SRC source file.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#
# Lesson 3 - SuperMux
#
APP_SRC +=  L3_SuperMux.c

C_FLAGS += -DWICED_BT_TRACE_ENABLE
</pre>
<p>Create a make target for this project by right clicking the L2_HelloWorld Make Target, then selecting &#8220;New&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-06-23-pm/" rel="attachment wp-att-5464"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.23-PM.png" alt="" width="508" height="115" class="alignnone size-large wp-image-5464" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.23-PM.png 508w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.23-PM-300x68.png 300w" sizes="auto, (max-width: 508px) 100vw, 508px" /></a></p>
<p>That will make a new target&#8230; and it will bring up this dialog box.  Notice that it named the target &#8220;Copy of &#8230;&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-06-37-pm/" rel="attachment wp-att-5463"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.37-PM.png" alt="" width="635" height="500" class="alignnone size-large wp-image-5463" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.37-PM.png 635w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.37-PM-600x472.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.37-PM-300x236.png 300w" sizes="auto, (max-width: 635px) 100vw, 635px" /></a></p>
<p>Fix it to be &#8220;L3_SuperMux&#8221; like this:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-06-57-pm/" rel="attachment wp-att-5462"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.57-PM.png" alt="" width="634" height="503" class="alignnone size-full wp-image-5462" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.57-PM.png 634w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.57-PM-600x476.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.06.57-PM-300x238.png 300w" sizes="auto, (max-width: 634px) 100vw, 634px" /></a></p>
<p>You should now have an exact copy of L2_HelloWorld, in the project L3_SuperMux.  Double click the make target and make sure that things are still working.  When you build you should get this.  Don&#8217;t forget to &#8220;Start the Bootloader&#8221; if the programming doesn&#8217;t work.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-11-48-pm/" rel="attachment wp-att-5465"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.11.48-PM.png" alt="" width="866" height="797" class="alignnone size-full wp-image-5465" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.11.48-PM.png 866w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.11.48-PM-600x552.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.11.48-PM-300x276.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.11.48-PM-768x707.png 768w" sizes="auto, (max-width: 866px) 100vw, 866px" /></a></p>
<h1>Platform Files</h1>
<p>If you look on the back of your CYW920719Q40EVB-01 development kit you will find the exact pin map of this board.  On this picture you can see that LED1 is connected to P28</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/img_5968/" rel="attachment wp-att-5466"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5968-768x1024.jpg" alt="" width="768" height="1024" class="alignnone size-large wp-image-5466" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5968-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5968-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5968-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5968-scaled.jpg 1920w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
<p>In WICED Studio, the world &#8220;Platform&#8221; is just another word for Board Support Package.  Basically all of the configuration required to build the firmware for a specific board.  If you click on platforms you will find a directory for the CYW920719Q40EVB.  All of the default configuration for the pins are located in the file &#8220;wiced_platform_pin_config.c&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-18-42-pm/" rel="attachment wp-att-5467"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM-1024x444.png" alt="" width="1024" height="444" class="alignnone size-large wp-image-5467" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM-1024x444.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM-600x260.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM-300x130.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM-768x333.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.18.42-PM.png 1243w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>If you look at this file closely, you will see on line 47 that pin P28 is setup as the MOSI of WICED_SPI_1.  That isnt a GPIO!!!.  And you will see a whole block of code on line 74 that is commented out that COULD   configure P28 as a GPIO.  But that would require modifying our default platform files, which I dont want to do.  Now what?  Simple use the SuperMux tool.</p>
<pre class="start-line:33 EnlighterJSRAW" data-enlighter-language="c"">/* all the pins available on this platform and their chosen functionality */
const wiced_platform_gpio_t platform_gpio_pins[] =
    {
        [PLATFORM_GPIO_0 ] = {WICED_P00, WICED_GPIO              },      //Button
        [PLATFORM_GPIO_1 ] = {WICED_P01, WICED_SPI_1_MISO        },
        [PLATFORM_GPIO_2 ] = {WICED_P02, WICED_PCM_OUT_I2S_DO    },
        [PLATFORM_GPIO_3 ] = {WICED_P04, WICED_PCM_IN_I2S_DI     },
        [PLATFORM_GPIO_4 ] = {WICED_P06, WICED_GCI_SECI_IN       },
        [PLATFORM_GPIO_5 ] = {WICED_P07, WICED_SPI_1_CS          },
        [PLATFORM_GPIO_6 ] = {WICED_P10, WICED_GCI_SECI_OUT      },
        [PLATFORM_GPIO_7 ] = {WICED_P16, WICED_PCM_CLK_I2S_CLK   },
        [PLATFORM_GPIO_8 ] = {WICED_P17, WICED_PCM_SYNC_I2S_WS   },
        [PLATFORM_GPIO_9 ] = {WICED_P26, WICED_GPIO              },      //Default LED 2
        [PLATFORM_GPIO_10] = {WICED_P25, WICED_I2C_1_SCL         },
        [PLATFORM_GPIO_11] = {WICED_P28, WICED_SPI_1_MOSI        },      //Optional LED 1
        [PLATFORM_GPIO_12] = {WICED_P29, WICED_I2C_1_SDA         },
        [PLATFORM_GPIO_13] = {WICED_P33, WICED_UART_2_TXD        },
        [PLATFORM_GPIO_14] = {WICED_P34, WICED_UART_2_RXD        },
        [PLATFORM_GPIO_15] = {WICED_P38, WICED_SPI_1_CLK         },
    };

/* LED configuration */
const wiced_platform_led_config_t platform_led[] =
    {
        [WICED_PLATFORM_LED_2] =
            {
                .gpio          = (wiced_bt_gpio_numbers_t*)&amp;platform_gpio_pins[PLATFORM_GPIO_9].gpio_pin,
                .config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),
                .default_state = GPIO_PIN_OUTPUT_HIGH,
            },

// We can use either LED1 or SPI1 MOSI, by default we are using WICED_P28 for SPI1 MOSI,
// uncomment the following initialization if WICED_P28 is to be used as an LED and set PIN
// functionality in platform_gpio_pins as WICED_GPIO

//        [WICED_PLATFORM_LED_1] =
//            {
//                .gpio          = (wiced_bt_gpio_numbers_t*)&amp;platform_gpio_pins[PLATFORM_GPIO_11].gpio_pin,
//                .config        = ( GPIO_OUTPUT_ENABLE | GPIO_PULL_UP ),
//                .default_state = GPIO_PIN_OUTPUT_HIGH,
//            }
    };
</pre>
<h1>SuperMux Tool</h1>
<p>The SuperMux tool is a GUI for setting the default configurations of the Pins on the chip.  Like all capable MCUs, this chip has PWMs, SPIs, UARTs, GPIOs, I2C, ADCs etc.  Each pin on the chip can do a bunch of different functions, but only one at a time.  Each pin has a multiplexor in front of it that selects the function of that pin.  The SuperMux tool helps you setup the multiplexors for each pin on the chip.</p>
<p>To run the SuperMux tool, first click on your project directory (remember L3_SuperMux).  The select File&#8211;&gt;New&#8211;&gt;WICED SuperMux GPIO Pin Configuration</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-23-42-pm/" rel="attachment wp-att-5468"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.42-PM.png" alt="" width="842" height="440" class="alignnone size-full wp-image-5468" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.42-PM.png 842w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.42-PM-600x314.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.42-PM-300x157.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.42-PM-768x401.png 768w" sizes="auto, (max-width: 842px) 100vw, 842px" /></a></p>
<p>It will ask you which &#8220;App Name&#8221; you want it to work on.  Since we clicked on the L3_SuperMux app, it uses that name by default.  Press Next</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-23-55-pm/" rel="attachment wp-att-5471"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.55-PM.png" alt="" width="660" height="587" class="alignnone size-large wp-image-5471" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.55-PM.png 660w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.55-PM-600x534.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.23.55-PM-300x267.png 300w" sizes="auto, (max-width: 660px) 100vw, 660px" /></a></p>
<p>The SuperMux Wizard will give you the opportunity to select which pins you want to configure.  It also shows you the default configuration of each of the pins.  In this case just press &#8220;Next&#8221; because we want to configure them all.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-24-08-pm-2/" rel="attachment wp-att-5483"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.08-PM-1.png" alt="" width="661" height="585" class="alignnone size-full wp-image-5483" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.08-PM-1.png 661w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.08-PM-1-600x531.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.08-PM-1-300x266.png 300w" sizes="auto, (max-width: 661px) 100vw, 661px" /></a></p>
<p>Now you will see the functions of the chip and which pins they are assigned to.  Notice that WICED_P28 is assigned as the MOSI of SPI(Slave)_1.  We don&#8217;t want that.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-24-25-pm/" rel="attachment wp-att-5469"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.25-PM.png" alt="" width="722" height="765" class="alignnone size-full wp-image-5469" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.25-PM.png 722w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.25-PM-600x636.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.24.25-PM-283x300.png 283w" sizes="auto, (max-width: 722px) 100vw, 722px" /></a></p>
<p>Remove the SPI(Slave)_1 by selecting it and then pressing the &#8220;Remove&#8221; button</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-27-32-pm/" rel="attachment wp-att-5475"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.32-PM.png" alt="" width="725" height="771" class="alignnone size-large wp-image-5475" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.32-PM.png 725w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.32-PM-600x638.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.32-PM-282x300.png 282w" sizes="auto, (max-width: 725px) 100vw, 725px" /></a></p>
<p>Now your screen will look like this.  In order to add a new pin configuration you can press the little &#8220;+&#8221; at the bottom of the function column.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-27-48-pm/" rel="attachment wp-att-5474"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.48-PM.png" alt="" width="722" height="770" class="alignnone size-large wp-image-5474" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.48-PM.png 722w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.48-PM-600x640.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.27.48-PM-281x300.png 281w" sizes="auto, (max-width: 722px) 100vw, 722px" /></a></p>
<p>Next press the little &#8220;+&#8221; button and select LED. <a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-24-08-pm/" rel="attachment wp-att-5470"></a></p>
<p><a href="https://iotexpert.com/?attachment_id=5473" rel="attachment wp-att-5473"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.01-PM.png" alt="" width="716" height="764" class="alignnone size-large wp-image-5473" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.01-PM.png 716w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.01-PM-600x640.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.01-PM-281x300.png 281w" sizes="auto, (max-width: 716px) 100vw, 716px" /></a></p>
<p>The select which Pin you want assigned to the LED.  In this case we want WICED_P28</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-28-16-pm/" rel="attachment wp-att-5472"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.16-PM.png" alt="" width="720" height="768" class="alignnone size-full wp-image-5472" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.16-PM.png 720w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.16-PM-600x640.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.28.16-PM-281x300.png 281w" sizes="auto, (max-width: 720px) 100vw, 720px" /></a></p>
<p>After you press finish you will notice that it adds a several files to your project.  And you notice that it creates a file called &#8220;makefile.mk.bak&#8221; (which is the backup of the original makefile)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-30-47-pm/" rel="attachment wp-att-5476"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.30.47-PM.png" alt="" width="359" height="243" class="alignnone size-full wp-image-5476" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.30.47-PM.png 359w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.30.47-PM-300x203.png 300w" sizes="auto, (max-width: 359px) 100vw, 359px" /></a></p>
<p>First look at the makefile and notice that it added the &#8220;L3_SuperMux_pin_config.c&#8221; to the sources and added a CFLAG</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">#
# Lesson 3 - SuperMux
#
APP_SRC +=  L3_SuperMux.c

C_FLAGS += -DWICED_BT_TRACE_ENABLE
C_FLAGS += -DSMUX_CHIP=$(CHIP)
APP_SRC += L3_SuperMux_pin_config.c
</pre>
<p>So, what is up with the  L3_SuperMux_pin_config.c.  OH!!! I See, this is just a replacement for the default platform configuration.  Notice that P28 is now a WICED_GPIO and that it is now defined in the LED list.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">wiced_platform_gpio_t platform_gpio_pins[]=
	{
		[PLATFORM_GPIO_0]	= {WICED_P00, WICED_GPIO},
		[PLATFORM_GPIO_1]	= {WICED_P02, WICED_PCM_OUT_I2S_DO},
		[PLATFORM_GPIO_2]	= {WICED_P04, WICED_PCM_IN_I2S_DI},
		[PLATFORM_GPIO_3]	= {WICED_P06, WICED_GCI_SECI_IN},
		[PLATFORM_GPIO_4]	= {WICED_P10, WICED_GCI_SECI_OUT},
		[PLATFORM_GPIO_5]	= {WICED_P16, WICED_PCM_CLK_I2S_CLK},
		[PLATFORM_GPIO_6]	= {WICED_P17, WICED_PCM_SYNC_I2S_WS},
		[PLATFORM_GPIO_7]	= {WICED_P25, WICED_I2C_1_SCL},
		[PLATFORM_GPIO_8]	= {WICED_P26, WICED_GPIO},
		[PLATFORM_GPIO_9]	= {WICED_P28, WICED_GPIO},
		[PLATFORM_GPIO_10]	= {WICED_P29, WICED_I2C_1_SDA},
		[PLATFORM_GPIO_11]	= {WICED_P33, WICED_UART_2_TXD},
		[PLATFORM_GPIO_12]	= {WICED_P34, WICED_UART_2_RXD},
	};

const wiced_platform_button_config_t platform_button[WICED_PLATFORM_BUTTON_MAX]=
	{
		[WICED_PLATFORM_BUTTON_1] =
			{
				.gpio			= &amp;platform_gpio_pins[PLATFORM_GPIO_0].gpio_pin,
				.config			= (GPIO_INPUT_ENABLE | GPIO_PULL_UP),
				.default_state	= GPIO_PIN_OUTPUT_LOW,
				.button_pressed_value	= GPIO_PIN_OUTPUT_LOW,
			},
	};

const size_t button_count =  (sizeof(platform_button) / sizeof(wiced_platform_button_config_t));


const wiced_platform_led_config_t platform_led[WICED_PLATFORM_LED_MAX]=
	{
		[WICED_PLATFORM_LED_1] =
			{
				.gpio			= &amp;platform_gpio_pins[PLATFORM_GPIO_9].gpio_pin,
				.config			= (GPIO_OUTPUT_ENABLE | GPIO_PULL_UP),
				.default_state	= GPIO_PIN_OUTPUT_HIGH,
			},
		[WICED_PLATFORM_LED_2] =
			{
				.gpio			= &amp;platform_gpio_pins[PLATFORM_GPIO_8].gpio_pin,
				.config			= (GPIO_OUTPUT_ENABLE | GPIO_PULL_UP),
				.default_state	= GPIO_PIN_OUTPUT_HIGH,
			},
	};
</pre>
<p>Now that the pins are configured.  We need to setup the PWM.</p>
<h1>Configure the Clock and the PWM</h1>
<p>Now I will add a little bit of code to the top of  our L3_SuperMux.c to configure the PWM, Clock and Pin.</p>
<p>First add includes for the ACLK and PWM driver.</p>
<pre class="start-line:8 EnlighterJSRAW" data-enlighter-language="c" ">#include "wiced_hal_aclk.h"
#include "wiced_hal_pwm.h"</pre>
<p>Then startup the Clock, Pin and PWM.</p>
<pre class="start-line:17 lang:c decode:true">    wiced_hal_aclk_enable(2000, ACLK1, ACLK_FREQ_1_MHZ );
    wiced_hal_pwm_configure_pin (WICED_GPIO_PIN_LED_1, PWM1 );
    wiced_hal_pwm_start(PWM1, PMU_CLK, 0xFFFF-500, 0xFFFF-999,0);
</pre>
<p>If you want to turn on the PWM you need to do three things</p>
<ol>
<li>Turn on a clock to drive it (line 17) sets the clock frequency to 2000hz</li>
<li>Attach the PWM to a Pin (line 18) attaches PWM 1 to the pin</li>
<li>Turn on the PWM which is a 16-bit up-counting PWM.  When the PWM is reset it will go to 0xFFFF-999 (the period)&#8230; then it will switch at 0xFFFF-500 (the compare value)</li>
</ol>
<p>When you program this your Green LED aka WICED_LED_1 is being driven by the PWM.  And your RED LED is being driven by your firmware.</p>
<h1>Documentation</h1>
<p>All of the hardware blocks on the chip have a set of API functions to help you interface with them.  You can find all of that in the Documentation</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/screen-shot-2018-06-24-at-12-49-33-pm/" rel="attachment wp-att-5480"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM-1024x730.png" alt="" width="1024" height="730" class="alignnone size-large wp-image-5480" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM-1024x730.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM-600x428.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM-300x214.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM-768x547.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-12.49.33-PM.png 1260w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-3-wiced-bluetooth-the-super-mux-tool/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 2 &#8211; WICED Bluetooth: Your First Project(s)</title>
		<link>https://iotexpert.com/lesson-2-wiced-bluetooth-your-first-projects/</link>
					<comments>https://iotexpert.com/lesson-2-wiced-bluetooth-your-first-projects/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:36:32 +0000</pubDate>
				<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5404</guid>

					<description><![CDATA[Summary For our first project, I am going to stand on the shoulder of giants.  In 1978, Brian Kernighan and Dennis Ritchie published &#8220;The C Programming Language&#8221;.  Here are pictures of my copy. The reason you do &#8220;Hello, World&#8221; is that you want to make sure that your compiler chain, programmer etc are all working [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>Summary</h1>
<p>For our first project, I am going to stand on the shoulder of giants.  In 1978, Brian Kernighan and Dennis Ritchie published &#8220;The C Programming Language&#8221;.  Here are pictures of my copy.</p>
<p><a href="https://iotexpert.com/2017/05/10/implementing-psoc-printf/img_4427/" rel="attachment wp-att-3504"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/05/IMG_4427-e1494407890391-225x300.jpg" alt="" width="225" height="300" class="alignnone wp-image-3504 size-medium" srcset="https://iotexpert.com/wp-content/uploads/2017/05/IMG_4427-e1494407890391-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4427-e1494407890391-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4427-e1494407890391-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4427-e1494407890391-scaled.jpg 1920w" sizes="auto, (max-width: 225px) 100vw, 225px" /></a> <a href="https://iotexpert.com/2017/05/10/implementing-psoc-printf/img_4426/" rel="attachment wp-att-3505"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/05/IMG_4426-e1494407928888-225x300.jpg" alt="Kernighan &amp; Ritchie" width="225" height="300" class="alignnone wp-image-3505 size-medium" srcset="https://iotexpert.com/wp-content/uploads/2017/05/IMG_4426-e1494407928888-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4426-e1494407928888-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4426-e1494407928888-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2017/05/IMG_4426-e1494407928888-scaled.jpg 1920w" sizes="auto, (max-width: 225px) 100vw, 225px" /></a></p>
<p>The reason you do &#8220;Hello, World&#8221; is that you want to make sure that your compiler chain, programmer etc are all working correctly with something that is super simple.  The only change that I will make to their classic program is to add the &#8220;Blinking LED&#8221; which is the embedded developers version of &#8220;Hello, World&#8221;.</p>
<p>The concepts that I want to show in this lesson are.</p>
<ol>
<li>How to make a new project &#8211; makefile.mk, &lt;appname&gt;.c</li>
<li>How NOT to make a new project</li>
<li>How to create a &#8220;Make Target&#8221;</li>
<li>CYW920719Q40EVB01 Development Kit</li>
<li>WICED PUART and WICED HCI UART</li>
<li>How to start the bootloader</li>
<li>Where the documentation resides for the WICED 20719 hardware abstraction layer</li>
<li>WICED uses ThreadX RTOS</li>
</ol>
<p>To make this first project the steps are:</p>
<ol>
<li>Make a new folder called wiced_bt_class  in the Apps Folder</li>
<li>Make a new folder called L2_HelloWorld in the wiced_bt_intro Folder</li>
<li>Create a new file called L2_HelloWorld.c</li>
<li>Create a new file called makefile.mk</li>
<li>Add the code to print HelloWorld &amp; blink the LED to L2_HelloWorld.c</li>
<li>Add the secret incantation to makefile.mk to build the project</li>
<li>Create a &#8220;Make Target&#8221;</li>
<li>Connect the development kit to your computer</li>
<li>Attach a serial terminal to the PUART</li>
<li>Run the Make Target to Build and Program</li>
</ol>
<p>Lets do this!</p>
<h1>DO NOT DO File-&gt;New Project</h1>
<p>I always hate to start with a negative statement&#8230; but DO NOT make a file project by doing File-&gt;New Project.  This is used for creating a new Eclipse project, not a new WICED Studio project.  In WICED Studio we use the make external build system.  If you do File-&gt;New Project all hell is going to break loose.  So don&#8217;t do any of the things on this menu:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-10-41-22-am/" rel="attachment wp-att-5453"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-10.41.22-AM.png" alt="" width="811" height="119" class="alignnone size-full wp-image-5453" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-10.41.22-AM.png 811w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-10.41.22-AM-600x88.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-10.41.22-AM-300x44.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-10.41.22-AM-768x113.png 768w" sizes="auto, (max-width: 811px) 100vw, 811px" /></a></p>
<h1>Hello World &amp; Blinking LED</h1>
<p>Now lets get on with making a WICED Studio Project.  First create a new folder to hold the projects for the Class in the &#8220;Apps&#8221; folder by right-clicking and selecting New-&gt;Folder</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-29-50-am/" rel="attachment wp-att-5413"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.29.50-AM.png" alt="" width="492" height="282" class="alignnone size-large wp-image-5413" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.29.50-AM.png 492w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.29.50-AM-300x172.png 300w" sizes="auto, (max-width: 492px) 100vw, 492px" /></a></p>
<p>Give it the name &#8220;wiced_bt_class&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-31-42-am/" rel="attachment wp-att-5412"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.31.42-AM.png" alt="" width="527" height="586" class="alignnone size-full wp-image-5412" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.31.42-AM.png 527w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.31.42-AM-270x300.png 270w" sizes="auto, (max-width: 527px) 100vw, 527px" /></a></p>
<p>Create a folder to hold the first project called L2_HelloWorld</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-48-16-am/" rel="attachment wp-att-5422"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.16-AM.png" alt="" width="527" height="163" class="alignnone size-full wp-image-5422" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.16-AM.png 527w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.16-AM-300x93.png 300w" sizes="auto, (max-width: 527px) 100vw, 527px" /></a></p>
<p>Call the folder L2_HelloWorld</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-48-30-am/" rel="attachment wp-att-5421"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.30-AM.png" alt="" width="523" height="588" class="alignnone size-large wp-image-5421" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.30-AM.png 523w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.48.30-AM-267x300.png 267w" sizes="auto, (max-width: 523px) 100vw, 523px" /></a></p>
<p>Make a new file called L2_HelloWorld.c by right clicking on the L2_HelloWorld folder and selecting New&#8211;&gt;File</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-50-47-am/" rel="attachment wp-att-5426"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.50.47-AM.png" alt="" width="536" height="168" class="alignnone size-large wp-image-5426" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.50.47-AM.png 536w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.50.47-AM-300x94.png 300w" sizes="auto, (max-width: 536px) 100vw, 536px" /></a></p>
<p>Give it the name L2_HelloWorld.c</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-51-05-am/" rel="attachment wp-att-5425"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.05-AM.png" alt="" width="524" height="582" class="alignnone size-large wp-image-5425" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.05-AM.png 524w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.05-AM-270x300.png 270w" sizes="auto, (max-width: 524px) 100vw, 524px" /></a></p>
<p>Make a new file called makefile.mk by right clicking on the L2_HelloWorld directory and selecting New-&gt;File</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-51-23-am/" rel="attachment wp-att-5424"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.23-AM.png" alt="" width="543" height="189" class="alignnone size-large wp-image-5424" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.23-AM.png 543w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.23-AM-300x104.png 300w" sizes="auto, (max-width: 543px) 100vw, 543px" /></a></p>
<p>and giving it the name makefile.mk</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-51-36-am/" rel="attachment wp-att-5423"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.36-AM.png" alt="" width="528" height="586" class="alignnone size-full wp-image-5423" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.36-AM.png 528w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.51.36-AM-270x300.png 270w" sizes="auto, (max-width: 528px) 100vw, 528px" /></a></p>
<p>Add some code to the L2_HelloWorld.c</p>
<pre class="lang:c decode:true ">#include "wiced.h"
#include "sparcommon.h"
#include "wiced_platform.h"
#include "wiced_rtos.h"
#include "wiced_hal_gpio.h"
#include "wiced_bt_trace.h"

APPLICATION_START()
{
    wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_PUART);

    WICED_BT_TRACE("Hello, World\n");
    while(1)
    {

        WICED_BT_TRACE("Setting 0\n");
        wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_2,0);
        wiced_rtos_delay_milliseconds(500,KEEP_THREAD_ACTIVE );
        WICED_BT_TRACE("Setting 1\n");
        wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_2,1);
        wiced_rtos_delay_milliseconds(500,KEEP_THREAD_ACTIVE );
    }
}</pre>
<p>Add the secret incantation to the makefile.mk</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#
# Lesson 2 - Hello, World
#
APP_SRC +=  L2_HelloWorld.c

C_FLAGS += -DWICED_BT_TRACE_ENABLE

</pre>
<p>Create a make target</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-39-46-am/" rel="attachment wp-att-5419"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.39.46-AM.png" alt="" width="317" height="296" class="alignnone size-large wp-image-5419" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.39.46-AM.png 317w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.39.46-AM-300x280.png 300w" sizes="auto, (max-width: 317px) 100vw, 317px" /></a></p>
<p>The make target has a <strong>VERY</strong> specific format.  It is:</p>
<p>directory.directory.appname-platform download</p>
<p>In our case we have all of our projects in a directory called &#8220;wiced_bt_class&#8221;.  Then we have a directory called &#8220;L2_HelloWorld&#8221; which holds the exact project.  And our platform name is &#8220;CYW920719Q40EVB_01&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-56-44-am/" rel="attachment wp-att-5428"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.56.44-AM.png" alt="" width="571" height="380" class="alignnone size-full wp-image-5428" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.56.44-AM.png 571w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.56.44-AM-300x200.png 300w" sizes="auto, (max-width: 571px) 100vw, 571px" /></a></p>
<h1>Connect the Development Kit To Your Computer</h1>
<p>When you plug in your development kit, it will USB enumerate a TWO serial ports.  One of the serial ports (the first one) is called the &#8220;WICED HCI UART&#8221;.  The second serial port is called the &#8220;WICED Peripheral UART&#8221; (this is often abbreviated &#8220;PUART&#8221;)</p>
<p>One of the key things that the WICED HCI UART is used as is a UART to download new code to the bootloader.</p>
<p>The PUART is used as a general purpose serial port.  When we call this function it causes all of our &#8220;WICED_BT_TRACE&#8221; outputs to go to the the PUART.</p>
<pre class="lang:c decode:true ">    wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_PUART);
</pre>
<p>You can see these two UARTs on a PC by running the device manager.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-21-00-am/" rel="attachment wp-att-5435"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.00-AM.png" alt="" width="389" height="618" class="alignnone size-large wp-image-5435" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.00-AM.png 389w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.00-AM-189x300.png 189w" sizes="auto, (max-width: 389px) 100vw, 389px" /></a></p>
<p>You can see COM17 is the &#8220;WICED HCI UART&#8221; and COM18 is the &#8220;WICED Peripheral UART&#8221;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-21-30-am/" rel="attachment wp-att-5434"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.30-AM.png" alt="" width="778" height="571" class="alignnone size-full wp-image-5434" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.30-AM.png 778w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.30-AM-600x440.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.30-AM-300x220.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.21.30-AM-768x564.png 768w" sizes="auto, (max-width: 778px) 100vw, 778px" /></a></p>
<p>On my Mac I use the program &#8220;Serial&#8221; which I downloaded from the App Store.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-02-04-am/" rel="attachment wp-att-5432"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.02.04-AM.png" alt="" width="371" height="475" class="alignnone size-full wp-image-5432" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.02.04-AM.png 371w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.02.04-AM-234x300.png 234w" sizes="auto, (max-width: 371px) 100vw, 371px" /></a></p>
<p>When I run Serial and then to open a Port</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-26-33-am/" rel="attachment wp-att-5436"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.26.33-AM.png" alt="" width="340" height="199" class="alignnone size-full wp-image-5436" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.26.33-AM.png 340w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.26.33-AM-300x176.png 300w" sizes="auto, (max-width: 340px) 100vw, 340px" /></a></p>
<p>You can see the two UARTs.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-01-17-am/" rel="attachment wp-att-5431"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.01.17-AM.png" alt="" width="528" height="379" class="alignnone size-full wp-image-5431" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.01.17-AM.png 528w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.01.17-AM-300x215.png 300w" sizes="auto, (max-width: 528px) 100vw, 528px" /></a></p>
<p>In order to see the output I will connect to the port with the settings</p>
<ul>
<li>115200 Baud</li>
<li>8-n-1 (Data bits, Parity, Stop Bits)</li>
</ul>
<p>With my PC I typically use Putty (remember it was COM18 from the screen above)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-32-46-am/" rel="attachment wp-att-5437"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.32.46-AM.png" alt="" width="452" height="438" class="alignnone size-full wp-image-5437" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.32.46-AM.png 452w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.32.46-AM-300x291.png 300w" sizes="auto, (max-width: 452px) 100vw, 452px" /></a></p>
<p>On the Mac program serial you can configure it with Terminal-&gt;Settings</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-35-22-am/" rel="attachment wp-att-5438"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.22-AM.png" alt="" width="433" height="88" class="alignnone size-full wp-image-5438" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.22-AM.png 433w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.22-AM-300x61.png 300w" sizes="auto, (max-width: 433px) 100vw, 433px" /></a></p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-35-02-am/" rel="attachment wp-att-5439"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.02-AM.png" alt="" width="465" height="530" class="alignnone size-large wp-image-5439" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.02-AM.png 465w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.35.02-AM-263x300.png 263w" sizes="auto, (max-width: 465px) 100vw, 465px" /></a></p>
<h1>Program your Development Kit</h1>
<p>In the Make Target window you should see a bunch of &#8220;targets&#8221;.  You probably have a bunch more targets, which came in your installation of WICED Studio by default, but I deleted a bunch of them so I could just see the ones that I created.</p>
<p>To build and program your project, double click the make target we made before.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-40-49-am/" rel="attachment wp-att-5441"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.40.49-AM.png" alt="" width="518" height="245" class="alignnone size-full wp-image-5441" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.40.49-AM.png 518w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.40.49-AM-300x142.png 300w" sizes="auto, (max-width: 518px) 100vw, 518px" /></a></p>
<p>When you look in the console you should see something like this:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-45-45-am/" rel="attachment wp-att-5443"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.45.45-AM.png" alt="" width="863" height="690" class="alignnone size-full wp-image-5443" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.45.45-AM.png 863w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.45.45-AM-600x480.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.45.45-AM-300x240.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.45.45-AM-768x614.png 768w" sizes="auto, (max-width: 863px) 100vw, 863px" /></a></p>
<p>And when you look at your serial terminal you will see this:</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-8-59-38-am/" rel="attachment wp-att-5430"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.59.38-AM.png" alt="" width="624" height="340" class="alignnone size-full wp-image-5430" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.59.38-AM.png 624w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.59.38-AM-600x327.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-8.59.38-AM-300x163.png 300w" sizes="auto, (max-width: 624px) 100vw, 624px" /></a></p>
<p>And you should also see the blinking LED!!!</p>
<h1>Start the Bootloader</h1>
<p>If you get this message there are three posibilites</p>
<ol>
<li>The kit isn&#8217;t plugged in</li>
<li>The driver didn&#8217;t install properly</li>
<li>The bootloader wont start</li>
</ol>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/screen-shot-2018-06-24-at-9-42-02-am/" rel="attachment wp-att-5442"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.42.02-AM.png" alt="" width="709" height="249" class="alignnone size-full wp-image-5442" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.42.02-AM.png 709w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.42.02-AM-600x211.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-24-at-9.42.02-AM-300x105.png 300w" sizes="auto, (max-width: 709px) 100vw, 709px" /></a></p>
<p>Check the first two&#8230; and if that doesnt work then what this means is that the bootloader is not listening on the WICED HCI UART.  In order to fix this you need to press reset and hold down the button called &#8220;Recover&#8221;.  Then release the reset, then release the recover button.  What does this do?  Simple, when the chip comes out of reset, if the recover button is pressed, the chip starts the bootloader instead of the main application.</p>
<p>Here is a picture of the bottom corner of the board.  The button circled in Green is the &#8220;Recover&#8221;.  The button in Red is &#8220;Reset&#8221; and the Blue surrounds the LED circuit.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/img_5967/" rel="attachment wp-att-5448"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5967-1024x768.jpg" alt="" width="1024" height="768" class="alignnone size-large wp-image-5448" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5967-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5967-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5967-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5967-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The two LEDs are labeled LED1 and LED2.  LED2 is the Red one, LED1 is the Green one.  The dip switches circled in Blue connect or disconnect the LEDs from the CYW20719.  In my case you can see (barely) that the switch is set to On.  Both of these LEDs are active LOW (0 turns them on)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/img_5966/" rel="attachment wp-att-5447"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966-1024x574.jpg" alt="" width="1024" height="574" class="alignnone size-large wp-image-5447" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966-1024x574.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966-600x337.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966-300x168.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966-768x431.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5966.jpg 1198w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-2-wiced-bluetooth-your-first-projects/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 1 &#8211; WICED Bluetooth: A Tour of the Resources</title>
		<link>https://iotexpert.com/lesson-1-wiced-bluetooth-a-tour-of-the-resources/</link>
					<comments>https://iotexpert.com/lesson-1-wiced-bluetooth-a-tour-of-the-resources/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 28 Jun 2018 12:36:07 +0000</pubDate>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5368</guid>

					<description><![CDATA[A Tour of the Resources Cypress is committed to the &#8220;Whole Product&#8221;.  What that means is that we believe that you should have great software, hardware, dev kits, community etc. experience while using our chip.  So, before we get started Id like to show you all of the learning and development resources available to you. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>A Tour of the Resources</h1>
<p>Cypress is committed to the &#8220;Whole Product&#8221;.  What that means is that we believe that you should have great software, hardware, dev kits, community etc. experience while using our chip.  So, before we get started Id like to show you all of the learning and development resources available to you.</p>
<ol>
<li><a href="http://www.cypress.com/products/ble-bluetooth" target="_blank" rel="noopener">BLE &amp; Bluetooth Connectivity Solutions</a></li>
<li><a href="https://community.cypress.com/docs/DOC-14590" target="_blank" rel="noopener">WICED CYW20719 Product Page</a></li>
<li><a href="https://community.cypress.com/docs/DOC-14590" target="_blank" rel="noopener">CYW20719 Product Guide</a></li>
<li><a href="http://www.cypress.com/documentation/datasheets/cyw20719-enhanced-low-power-bredrble-bluetooth-50-soc" target="_blank" rel="noopener">CYW20719 Datasheet</a></li>
<li><a href="https://community.cypress.com/docs/DOC-14187" target="_blank" rel="noopener">CYW20719 Software Features</a></li>
<li><a href="https://community.cypress.com/docs/DOC-3021" target="_blank" rel="noopener">WICED Module Selection Guide</a></li>
<li>CYW920719Q40EVB-01 Development Kit</li>
<li><a href="http://www.cypress.com/documentation/development-kitsboards/cyw920719q40evb-01-evaluation-kit" target="_blank" rel="noopener">CYW920719Q40EVB-01 Product Page</a></li>
<li><a href="http://www.cypress.com/file/404851/download" target="_blank" rel="noopener">CYW920719 Quick Start</a></li>
<li><a href="http://www.cypress.com/file/411346/download" target="_blank" rel="noopener">CYW920719Q40EVB-01 Evaluation Board User Guide</a></li>
<li><a href="https://community.cypress.com" target="_blank" rel="noopener">Cypress Community</a></li>
<li><a href="https://community.cypress.com/community/wiced-studio-blueooth" target="_blank" rel="noopener">WICED Studio Bluetooth Community</a></li>
<li><a href="https://community.cypress.com/community/wiced-studio-blueooth/wiced-studio-bluetooth-forums" target="_blank" rel="noopener">WICED Studio Bluetooth Forums</a></li>
<li>WICED Studio</li>
<li>WICED Studio Bluetooth Example Projects</li>
<li>WICED Studio Documentation</li>
<li>WICED Bluetooth API Guide</li>
<li>WICED README.txt</li>
<li><a href="https://community.cypress.com/docs/DOC-15280" target="_blank" rel="noopener">WICED Studio Release Notes</a></li>
<li><a href="https://community.cypress.com/docs/DOC-15208" target="_blank" rel="noopener">WICED Studio Technical Brief</a></li>
<li>WICED Bluetooth 101</li>
</ol>
<h1><a href="http://www.cypress.com/products/ble-bluetooth" target="_blank" rel="noopener">Bluetooth BR+EDR Connectivity Solutions Page</a></h1>
<p>This pages gets to you all of the Cypress WICED BR+EDR+Bluetooth products</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-36-50-am/" rel="attachment wp-att-5380"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM-1024x828.png" alt="" width="1024" height="828" class="alignnone size-large wp-image-5380" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM-1024x828.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM-600x485.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM-300x243.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM-768x621.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.36.50-AM.png 1067w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WICED CYW20719 Product Page</h1>
<p>When you get the the <a href="http://www.cypress.com/products/ble-bluetooth" target="_blank" rel="noopener">BLE+Bluetooth</a> products page, then click &#8220;BLE+BT&#8221; to see just the chips Im talking about here (CYW20719)</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-9-41-30-am/" rel="attachment wp-att-5369"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM-791x1024.png" alt="" width="791" height="1024" class="alignnone size-large wp-image-5369" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM-791x1024.png 791w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM-600x776.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM-232x300.png 232w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM-768x994.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.41.30-AM.png 891w" sizes="auto, (max-width: 791px) 100vw, 791px" /></a></p>
<h1><a href="https://community.cypress.com/docs/DOC-14590" target="_blank" rel="noopener">CYW20719 Product Guide</a></h1>
<p>The Product Guide is a website that has all (most?) of the links you might need to learn about the CYW20719</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-37-48-am/" rel="attachment wp-att-5381"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.37.48-AM.png" alt="" width="920" height="1006" class="alignnone size-full wp-image-5381" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.37.48-AM.png 920w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.37.48-AM-600x656.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.37.48-AM-274x300.png 274w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.37.48-AM-768x840.png 768w" sizes="auto, (max-width: 920px) 100vw, 920px" /></a></p>
<h1><a href="http://www.cypress.com/documentation/datasheets/cyw20719-enhanced-low-power-bredrble-bluetooth-50-soc" target="_blank" rel="noopener">CYW20719 Datasheet</a></h1>
<p>The Datasheet always anchors you to the reality of what the chip can and cannot do</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-38-39-am/" rel="attachment wp-att-5382"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM-946x1024.png" alt="" width="946" height="1024" class="alignnone size-large wp-image-5382" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM-946x1024.png 946w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM-600x649.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM-277x300.png 277w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM-768x831.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.38.39-AM.png 947w" sizes="auto, (max-width: 946px) 100vw, 946px" /></a></p>
<h1><a href="https://community.cypress.com/docs/DOC-14187" target="_blank" rel="noopener">CYW20719 Software Features</a></h1>
<p>This webpage has a list of all of the stuff that you have access to inside of the WICED Bluetooth SDK.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-9-48-27-am/" rel="attachment wp-att-5370"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM-924x1024.png" alt="" width="924" height="1024" class="alignnone size-large wp-image-5370" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM-924x1024.png 924w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM-600x665.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM-271x300.png 271w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM-768x851.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.48.27-AM.png 934w" sizes="auto, (max-width: 924px) 100vw, 924px" /></a></p>
<p>And it goes on and on and on from here.</p>
<h1><a href="https://community.cypress.com/docs/DOC-3021" target="_blank" rel="noopener">WICED Module Selection Guide</a></h1>
<p>If you feel like building a Bluetooth Product, you are almost certainly going to want to use a FCC certified module.  This guide is a discussion of all of the module vendors.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-39-51-am/" rel="attachment wp-att-5383"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.39.51-AM.png" alt="" width="646" height="457" class="alignnone size-full wp-image-5383" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.39.51-AM.png 646w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.39.51-AM-600x424.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.39.51-AM-300x212.png 300w" sizes="auto, (max-width: 646px) 100vw, 646px" /></a></p>
<h1>CYW920719Q40EVB-01 Development Kit</h1>
<p>Here is the development kit.  You can see in the picture that this is an Arduino form factor board.  It has a button and and LED plus programmer and UART bridge.  Most importantly it has a daughter card with the 20719 and and antenna.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/img_5959/" rel="attachment wp-att-5375"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5959-1024x768.jpg" alt="" width="1024" height="768" class="alignnone size-large wp-image-5375" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5959-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5959-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5959-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5959-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/img_5959/" rel="attachment wp-att-5375"></a></p>
<h1><a href="http://www.cypress.com/documentation/development-kitsboards/cyw920719q40evb-01-evaluation-kit" target="_blank" rel="noopener">CYW920719Q40EVB-01 Product Page</a></h1>
<p>The product landing pages for the development kit has lots of resources specific to this kit including the manual and quick start guide.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-9-51-04-am/" rel="attachment wp-att-5371"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM-779x1024.png" alt="" width="779" height="1024" class="alignnone size-large wp-image-5371" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM-779x1024.png 779w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM-600x788.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM-228x300.png 228w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM-768x1009.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-9.51.04-AM.png 904w" sizes="auto, (max-width: 779px) 100vw, 779px" /></a></p>
<h1><a href="http://www.cypress.com/file/404851/download" target="_blank" rel="noopener">CYW920719 Quick Start</a></h1>
<p>The Quickstart guide is included in the kit.  Just a single sheet of paper that points out all of the features of the development kit.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/img_5961/" rel="attachment wp-att-5376"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5961-e1529763421110-768x1024.jpg" alt="" width="768" height="1024" class="alignnone wp-image-5376 size-large" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5961-e1529763421110-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5961-e1529763421110-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5961-e1529763421110-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5961-e1529763421110-scaled.jpg 1920w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
<h1><a href="http://www.cypress.com/file/411346/download" target="_blank" rel="noopener">CYW920719Q40EVB-01 Evaluation Board User Guide</a></h1>
<p>The Users Guide is the manual for the development kit.  It shows you how to use all of the resouces on the board and how to get going with WICED Studio.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-32-45-am/" rel="attachment wp-att-5379"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.32.45-AM.png" alt="" width="634" height="877" class="alignnone size-full wp-image-5379" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.32.45-AM.png 634w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.32.45-AM-600x830.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.32.45-AM-217x300.png 217w" sizes="auto, (max-width: 634px) 100vw, 634px" /></a></p>
<h1><a href="https://community.cypress.com" target="_blank" rel="noopener">Cypress Community</a></h1>
<p>The community is your anchor for support.  It has all of the documentation etc&#8230; and most importantly a vibrant user forum.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-40-56-am/" rel="attachment wp-att-5384"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM-1024x906.png" alt="" width="1024" height="906" class="alignnone size-large wp-image-5384" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM-1024x906.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM-600x531.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM-300x265.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM-768x679.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.40.56-AM.png 1231w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1><a href="https://community.cypress.com/community/wiced-studio-blueooth" target="_blank" rel="noopener">WICED Studio Bluetooth Community</a></h1>
<p>The Bluetooth Community website brings together all of the people and product collateral for WICED Bluetooth.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-42-04-am/" rel="attachment wp-att-5385"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM-1024x889.png" alt="" width="1024" height="889" class="alignnone size-large wp-image-5385" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM-1024x889.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM-600x521.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM-300x261.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM-768x667.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.04-AM.png 1217w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1><a href="https://community.cypress.com/community/wiced-studio-blueooth/wiced-studio-bluetooth-forums" target="_blank" rel="noopener">WICED Studio Bluetooth Forums</a></h1>
<p>The actual forum is accessible to everyone to ask questions about the Cypress products.  It is staffed by our technical support team and you will get good answers.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-42-54-am/" rel="attachment wp-att-5386"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM-1024x980.png" alt="" width="1024" height="980" class="alignnone size-large wp-image-5386" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM-1024x980.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM-600x574.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM-300x287.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM-768x735.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.42.54-AM.png 1230w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WICED Studio</h1>
<p>WICED Studio is the development tool which you can use to build projects.  This will be the central tool used for the rest of this class.</p>
<p><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/screen-shot-2018-06-23-at-6-40-04-am/" rel="attachment wp-att-5356"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-1024x810.png" alt="" width="1024" height="810" class="alignnone size-large wp-image-5356" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-1024x810.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-600x475.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-300x237.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-768x608.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM.png 1246w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WICED Studio Bluetooth Example Projects</h1>
<p>Cypress delivers a bunch of &#8220;apps&#8221; which range from small examples we call SNIPs to more fully featured projects (in the Demo) folder.  Ill be showing you how to use the in the next set of tutorials.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-44-07-am/" rel="attachment wp-att-5387"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.07-AM.png" alt="" width="222" height="693" class="alignnone size-full wp-image-5387" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.07-AM.png 222w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.07-AM-96x300.png 96w" sizes="auto, (max-width: 222px) 100vw, 222px" /></a></p>
<h1>WICED Studio Documentation</h1>
<p>In the &#8220;doc&#8221; folder resides all of the documentation for WICED bluetooth.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-44-51-am/" rel="attachment wp-att-5388"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.51-AM.png" alt="" width="428" height="431" class="alignnone size-full wp-image-5388" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.51-AM.png 428w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.51-AM-100x100.png 100w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.51-AM-150x150.png 150w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.44.51-AM-298x300.png 298w" sizes="auto, (max-width: 428px) 100vw, 428px" /></a></p>
<h1>WICED Bluetooth API Guide</h1>
<p>The API guide is doxygen generated API documentation for the WICED Bluetooth SDK.</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-45-37-am/" rel="attachment wp-att-5389"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM-1024x716.png" alt="" width="1024" height="716" class="alignnone size-large wp-image-5389" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM-1024x716.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM-600x419.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM-300x210.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM-768x537.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.45.37-AM.png 1193w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WICED Studio README.txt</h1>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-46-59-am/" rel="attachment wp-att-5391"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.46.59-AM.png" alt="" width="854" height="838" class="alignnone size-full wp-image-5391" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.46.59-AM.png 854w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.46.59-AM-600x589.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.46.59-AM-300x294.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.46.59-AM-768x754.png 768w" sizes="auto, (max-width: 854px) 100vw, 854px" /></a></p>
<h1><a href="https://community.cypress.com/docs/DOC-15280" target="_blank" rel="noopener">WICED Studio Release Notes</a></h1>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-57-19-am/" rel="attachment wp-att-5393"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.57.19-AM.png" alt="" width="815" height="702" class="alignnone size-full wp-image-5393" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.57.19-AM.png 815w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.57.19-AM-600x517.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.57.19-AM-300x258.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.57.19-AM-768x662.png 768w" sizes="auto, (max-width: 815px) 100vw, 815px" /></a></p>
<h1><a href="https://community.cypress.com/docs/DOC-15208" target="_blank" rel="noopener">WICED Studio Technical Brief</a></h1>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/screen-shot-2018-06-23-at-10-55-17-am/" rel="attachment wp-att-5392"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.55.17-AM.png" alt="" width="639" height="798" class="alignnone size-full wp-image-5392" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.55.17-AM.png 639w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.55.17-AM-600x749.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-10.55.17-AM-240x300.png 240w" sizes="auto, (max-width: 639px) 100vw, 639px" /></a></p>
<h1>WICED Bluetooth 101</h1>
<p>I have been working with  some amazing people to build a class for learning WICED Bluetooth.  You can find all of the material at <a href="https://github.com/cypresssemiconductorco/CypressAcademy_WBT101_Files" target="_blank" rel="noopener">https://github.com/cypresssemiconductorco/CypressAcademy_WBT101_Files</a></p>
<p><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/img_6022/" rel="attachment wp-att-5627"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6022-e1530113423860-768x1024.jpg" alt="" width="768" height="1024" class="alignnone size-large wp-image-5627" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_6022-e1530113423860-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6022-e1530113423860-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6022-e1530113423860-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_6022-e1530113423860-scaled.jpg 1920w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-1-wiced-bluetooth-a-tour-of-the-resources/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Lesson 0 &#8211; A Two Hour WICED Bluetooth Class</title>
		<link>https://iotexpert.com/lesson-0-a-two-hour-wiced-bluetooth-class/</link>
					<comments>https://iotexpert.com/lesson-0-a-two-hour-wiced-bluetooth-class/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Sat, 23 Jun 2018 12:59:42 +0000</pubDate>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CYW920179Q40EVB-01]]></category>
		<category><![CDATA[Mouser CYW20719 Bluetooth 5.0]]></category>
		<category><![CDATA[WICED 20719]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5347</guid>

					<description><![CDATA[Summary This is the top level web page for a two hour class about getting you started building products with WICED Bluetooth using the CYW20719.  My friend Victor told me that I am totally insane and that I have enough material for a semester long class, but I have faith in you.  The whole point [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>This is the top level web page for a two hour class about getting you started building products with WICED Bluetooth using the CYW20719.  My friend Victor told me that I am totally insane and that I have enough material for a semester long class, but I have faith in you.  The whole point of WICED Bluetooth is to make it possible for you to build your own Bluetooth application using the best Bluetooth radios in the world.  Life is too short for flaky Bluetooth!</p>
<p>When I started working on this class the marketing guys asked if they could show a &#8220;few&#8221; powerpoint slides at the begining.  But I knew that is just a euphemism for power point carpet bombing you to sleep.  That sucks, so we aren&#8217;t doing that.</p>
<p>AFH, TDD, ∏/4 DQPSK, ISM, 8DPSK, Symbol Rate, binary FM modulation, dBi, LMP, AMP, Gaussian Frequency Shift Keying,  Modulation Index, ppm, eye diagram, FCC, Frequency Offset, Slot Length, Frequency Drift, Differential Phase Encoding, Pulse Shaping, Modulation Accuracy, Differential Error Vector Magnitude, BER, Sensitivity, Co-Chanel interference, Intermodulation Characteristics, Symbol rate, Timeslot, piconet clock, piconet channel timing,  blah blah blah blah&#8230;.</p>
<p>Whew&#8230; now that is out of the way.  Forget that.  Rather than start at the bottom with the radio and <a href="https://en.wikipedia.org/wiki/Maxwell%27s_equations" target="_blank" rel="noopener">Maxwells equations</a> I going to start at the top.  Cypress has a huge team of radio designers to deal with all of that so you don&#8217;t have to.  To be clear, this stuff matter A LOT to how well your product works but it is only the second best reason to use Cypress WICED Bluetooth.  The best reason to use Cypress is that our software team lets you have access to the most robust Bluetooth stack and radio infrastructure without having to figure all that crap out.  You may, in time, dig into all of that.  But none of it matters for building your applications.</p>
<p>This workshop is hands on, as that is the only real way to learn.  This series of web pages have the exact steps that I am going to use, so you can follow along with me.</p>
<p>You will need a few things for the class:</p>
<ul>
<li>WICED Studio 6.2.1 which you can download from the <a href="https://community.cypress.com/community/wireless" target="_blank" rel="noopener">Cypress Community</a></li>
<li>Copies of the example projects which you can get from <a href="https://github.com/iotexpert/wiced_bt_intro" target="_blank" rel="noopener">GitHub</a>.</li>
<li>A CYW920719Q40EVB-01 which you can get from <a href="https://www.mouser.com/ProductDetail/Cypress-Semiconductor/CYW920719Q40EVB-01?qs=%2fha2pyFaduhzG%252b3Zf9J7TODfLtUX0QevVzWuQhEiGDqLgniWzOFufmkSgZ8vWRPo" target="_blank" rel="noopener">Mouser</a></li>
<li>A Terminal Program like <a href="http://www.putty.org" target="_blank" rel="noopener">Putty</a></li>
<li>CySmart, a Bluetooth GATT DB Browser for Android (Google Play Store) or iPhone (Apple App Store)</li>
<li>The courage to be WICED!</li>
</ul>
<p>Todays virtual workshop is going to go like this:</p>
<p><span><h1>WICED Bluetooth Using the CYW20719</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Title</th>
<th >Comment</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/">A Two Hour WICED Bluetooth Class</a></td>
<td >WICED Bluetooth Using the CYW20719 in all its glory</td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-1-wiced-bluetooth-a-tour-of-the-resources/">Resources</a></td>
<td ><span>Links to all of the Cypress WICED information including videos, application notes etc.</span></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-2-wiced-bluetooth-your-first-projects/">Your First Project</a></td>
<td >Making Hello World &amp; the Blinky LED</td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-3-wiced-bluetooth-the-super-mux-tool/">The Super Mux Tool</a></td>
<td >Learning about platforms and the Super Mux Tool</td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-4-wiced-bluetooth-using-snips/">Snips</a></td>
<td >Using the example projects to learn Bluetooth</td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-5-wiced-bluetooth-bluetooth-designer-turn-up-the-radio/">Bluetooth Designer</a></td>
<td >Using the tool to customize a project and get going fast</td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-6-wiced-bluetooth-the-peripheral-comes-alive/">The CCCD &amp; Notification</a></td>
<td >Writing back to the Central</td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-7-wiced-bluetooth-bluetooth-advertising/">Advertising  Beacon</a></td>
<td >Building a beacon project to advertise your custom information </td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-8-wiced-bluetooth-the-advertising-scanner/">Scanner</a></td>
<td >Viewing the world around you</td>
</tr>

<tr><td >9</td>
<td ><a href="https://iotexpert.com/2018/06/28/lesson-9-wiced-bluetooth-classic-serial-port/">Bluetooth Classic SPP</a></td>
<td >Using the Serial Port Profile to Transmit Lots of Data</td>
</tr>
</tbody></table></div></p>
<p>Source code: </p>
<ul>
<li>git@github.com:iotexpert/wiced_bt_intro.git</li>
<li>https://github.com/iotexpert/wiced_bt_intro</li>
</ul>
<p>&nbsp;</p></span></p>
<h1>WICED Studio 6.2.1</h1>
<p>This class is build around WICED Studio 6.2, the Cypress IDE built on top of Eclipse.  WICED Studio has all of the tools, examples and SDKs to build projects for the Cypress WICED Bluetooth and WiFi products.  We support Windows, Mac and Linux and you can download it from our community website: <a href="https://community.cypress.com/community/wireless" target="_blank" rel="noopener">https://community.cypress.com/community/wireless</a> (which I hope you have done by now)</p>
<p><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/screen-shot-2018-06-23-at-6-40-04-am/" rel="attachment wp-att-5356"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-1024x810.png" alt="" width="1024" height="810" class="alignnone size-large wp-image-5356" srcset="https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-1024x810.png 1024w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-600x475.png 600w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-300x237.png 300w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM-768x608.png 768w, https://iotexpert.com/wp-content/uploads/2018/06/Screen-Shot-2018-06-23-at-6.40.04-AM.png 1246w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>CYW920719Q40EVB-01</h1>
<p>I am going to build and program all of the projects in this class into our development kit, the CY920719Q40EVB-01.  This development kit (which you should buy from <a href="https://www.mouser.com/ProductDetail/Cypress-Semiconductor/CYW920719Q40EVB-01?qs=%2fha2pyFaduhzG%252b3Zf9J7TODfLtUX0QevVzWuQhEiGDqLgniWzOFufmkSgZ8vWRPo" target="_blank" rel="noopener">Mouser</a>) uses the Cypress CYW20719 Bluetooth chip.  This is the worlds best Dual-mode Bluetooth 5.0 chip.  Dual mode means that it does Bluetooth Classic BR/EDR as well as Bluetooth Low Energy.  Even better it can do both standards at the same time.</p>
<p><a href="https://iotexpert.com/2018/06/23/lesson-0-a-two-hour-wiced-bluetooth-class/img_5956/" rel="attachment wp-att-5358"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5956-1024x768.jpg" alt="" width="1024" height="768" class="alignnone size-large wp-image-5358" srcset="https://iotexpert.com/wp-content/uploads/2018/06/IMG_5956-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5956-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5956-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/06/IMG_5956-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lesson-0-a-two-hour-wiced-bluetooth-class/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
