<?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>Cy8CKIT-145 &#8211; IoT Expert</title>
	<atom:link href="https://iotexpert.com/category/devkits/cy8ckit-145/feed/" rel="self" type="application/rss+xml" />
	<link>https://iotexpert.com</link>
	<description>Engineering for the Internet of Things</description>
	<lastBuildDate>Fri, 09 Feb 2018 22:32:49 +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>Cy8CKIT-145 &#8211; IoT Expert</title>
	<link>https://iotexpert.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>The Lost Art of Assembly Language Programming</title>
		<link>https://iotexpert.com/lost-art-assembly-language-programming/</link>
					<comments>https://iotexpert.com/lost-art-assembly-language-programming/#comments</comments>
		
		<dc:creator><![CDATA[Darrin Vallis]]></dc:creator>
		<pubDate>Fri, 09 Feb 2018 19:53:37 +0000</pubDate>
				<category><![CDATA[CY8CKIT-042]]></category>
		<category><![CDATA[CY8CKIT-044]]></category>
		<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC 4200]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Assembly. Machine Code]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=4992</guid>

					<description><![CDATA[Cypress introduced it&#8217;s first mass market microcontroller in 2001. It used a Cypress designed 8 bit CISC processor running at 24 MHz, with as little as 4 KB Flash and 256 bytes RAM. Wrapped around that was a neat array of programmable analog and digital blocks. This may not sound like much, but with a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Cypress introduced it&#8217;s first mass market microcontroller in 2001. It used a Cypress designed 8 bit CISC processor running at 24 MHz, with as little as 4 KB Flash and 256 bytes RAM. Wrapped around that was a neat array of programmable analog and digital blocks. This may not sound like much, but with a creative mindset you could get these parts to do amazing things. For instance, I once implemented a complete ultrasonic ranging sensor with full wave analog demodulation in a single PSOC1 as shown below.</p>
<figure id="attachment_4993" aria-describedby="caption-attachment-4993" style="width: 1024px" class="wp-caption aligncenter"><a href="https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1.jpg"><img fetchpriority="high" decoding="async" width="1024" height="430" class="size-large wp-image-4993" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1-1024x430.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1-1024x430.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1-600x252.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1-300x126.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1-768x323.jpg 768w, https://iotexpert.com/wp-content/uploads/2018/02/UltrasonicRangingPSOC1.jpg 1040w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption id="caption-attachment-4993" class="wp-caption-text">PSOC1 Ultrasonic Ranging</figcaption></figure>
<p>With CPU resources at a premium, you had to write tight, efficient code to get the most out of PSOC1. A single C library could consume the entire Flash. Consequently, I wrote a <em>lot</em> of assembly code. That&#8217;s not so bad, since I actually enjoy it more than C. There&#8217;s a certain elegance to well written, fully commented machine code. In the case of PSOC1, here&#8217;s what you had to work with: 5 registers, some RAM and Flash. That&#8217;s it. Real Men Write In Assembly.</p>
<figure id="attachment_4995" aria-describedby="caption-attachment-4995" style="width: 518px" class="wp-caption aligncenter"><a href="https://iotexpert.com/wp-content/uploads/2018/02/M8Carch.jpg"><img decoding="async" width="518" height="341" class="size-full wp-image-4995" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/M8Carch.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/M8Carch.jpg 518w, https://iotexpert.com/wp-content/uploads/2018/02/M8Carch-300x197.jpg 300w" sizes="(max-width: 518px) 100vw, 518px" /></a><figcaption id="caption-attachment-4995" class="wp-caption-text">M8C Architecture</figcaption></figure>
<p>&nbsp;</p>
<p>We&#8217;ll start with simple machine code instruction to make the CPU do something. You can reference the M8C assembly language user guide <a href="http://www.cypress.com/file/72341/download">here</a> for more details. To get the M8C to execute 2+3=5 we write:</p>
<p><span style="font-family: Courier New;color: black">mov A,2       ;Load A with 2<br />
add A,3       ;Add 3 to A. Result=5 is in A<br />
</span></p>
<p>We can get fancy by using variables. Let&#8217;s add R=P+Q. Assume P is at RAM location 0x20 and Q is at location 0x21, and R is at 0x22</p>
<p><span style="font-family: Courier New;color: black">;Initialize variables<br />
mov [0x20],2  ;Load P with 2<br />
mov [0x21],3  ;Load Q with 3</span></p>
<p><span style="font-family: Courier New;color: black">;Add variables<br />
mov X,[0x20]  ;X &lt;- P<br />
mov A,[0x21]  ;A &lt;- Q<br />
adc [X],A     ;X &lt;- P + Q<br />
mov [0x22],X  ;R &lt;- X<br />
</span><br />
The fun thing about assembly is you can always dream up cool ways of doing things in less operations based on the machine&#8217;s instruction set. For example, we can simplify the above code as follows:</p>
<p><span style="font-family: Courier New;color: black">;Add variables<br />
mov [0x20],[0x22]   ;R &lt;- P<br />
adc [0x22],[0x21]   ;R &lt;- P + Q</span></p>
<p>In my experience, a good programmer with expert knowledge of the instruction set and CPU resources can always write better code than a compiler. There&#8217;s a certain human creativity that algorithms can&#8217;t match.</p>
<p>All that being said, I had not seen a good &#8220;machine code 101&#8221; tutorial for writing assembly in PSOC Creator on modern ARM M0 processors. So let&#8217;s walk through one now. We&#8217;ll use a CY8CKIT-145 and blink the LED. It&#8217;s just what happens to be laying around on the lab bench. Any PSOC4 kit will do.</p>
<p><img decoding="async" width="518" height="341" class="size-full wp-image-4995 aligncenter" alt="CY8CKIT-145-40XX" src="http://www.cypress.com/sites/default/files/media-embed/263821/CY8CKIT-145_image.png" /></p>
<p>We&#8217;ll start by creating a standard project in PSOC Creator, drop a Digital Output pin on the schematic and call it &#8220;LED&#8221;</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/1.jpg"><img loading="lazy" decoding="async" width="1023" height="585" class="alignnone wp-image-5014 size-full" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/1.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/1.jpg 1023w, https://iotexpert.com/wp-content/uploads/2018/02/1-600x343.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/02/1-300x172.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/02/1-768x439.jpg 768w" sizes="auto, (max-width: 1023px) 100vw, 1023px" /></a></p>
<p>Then open the .CYDWR file and drag pin LED to P2[5], since that&#8217;s where it is on the LED board. Yours may be in a different place on whatever board you are using.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/2.jpg"><img loading="lazy" decoding="async" width="871" height="579" class="alignnone size-full wp-image-5015" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/2.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/2.jpg 871w, https://iotexpert.com/wp-content/uploads/2018/02/2-600x399.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/02/2-300x199.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/02/2-768x511.jpg 768w" sizes="auto, (max-width: 871px) 100vw, 871px" /></a></p>
<p>Now under &#8220;Source Files&#8221; in the workspace directory you will delete main.c and replace with main.s</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/3JPG.jpg"><img loading="lazy" decoding="async" width="343" height="567" class="alignnone size-full wp-image-5016" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/3JPG.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/3JPG.jpg 343w, https://iotexpert.com/wp-content/uploads/2018/02/3JPG-181x300.jpg 181w" sizes="auto, (max-width: 343px) 100vw, 343px" /></a></p>
<p>Now right clock on &#8220;Source Files&#8221;, select &#8220;Add New File&#8221; and select &#8220;GNU ARM Assembly File&#8221; in the dialog. Rename the file from GNUArmAssembly01.s to main.s</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/4.jpg"><img loading="lazy" decoding="async" width="524" height="402" class="alignnone size-full wp-image-5017" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/4.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/4.jpg 524w, https://iotexpert.com/wp-content/uploads/2018/02/4-300x230.jpg 300w" sizes="auto, (max-width: 524px) 100vw, 524px" /></a></p>
<p>Your workspace ends up looking like this:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/5.jpg"><img loading="lazy" decoding="async" width="319" height="339" class="alignnone size-full wp-image-5018" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/5.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/5.jpg 319w, https://iotexpert.com/wp-content/uploads/2018/02/5-282x300.jpg 282w" sizes="auto, (max-width: 319px) 100vw, 319px" /></a></p>
<p>So far, so good. Now open main.s, delete everything if it&#8217;s not empty and add the following code. This sets up the IDE for M0 assembly architecture</p>
<p><span style="font-family: Courier New;color: black">// ==============================================<br />
// ARM M0 Assembly Tutorial<br />
//<br />
// 01 &#8211; Blink LED<br />
// ==============================================<br />
.syntax unified<br />
.text<br />
.thumb<br />
</span><br />
Next we need to include register definitions for the chip we are using. These are all from the PSOC4 Technical Reference Manual (TRM)</p>
<p><span style="font-family: Courier New;color: black">// ==============================================<br />
// Includes<br />
// ==============================================<br />
.include &#8220;cydevicegnu_trm.inc&#8221;<br />
</span></p>
<p>Then we are going to do some .equ statements, same as #define in C. This identifies the Port 2 GPIO data register plus bits for the LED pin in on and off state</p>
<p><span style="font-family: Courier New;color: black">// ==============================================<br />
// Defines<br />
// ==============================================<br />
.equ LED_DR,CYREG_GPIO_PRT2_DR          // LED data reg address<br />
.equ LED_PIN,5                          // P2.5<br />
.equ LED_OFF,1&lt;&lt;led_pin                 // 0010 0000<br />
.equ LED_ON,~LED_OFF                    // 1101 1111<br />
</span></p>
<p>Now you add the right syntax to set up main()</p>
<p><span style="font-family: Courier New;color: black">// ==============================================<br />
// main<br />
// ==============================================<br />
.global main<br />
.func main, main<br />
.type main, %function<br />
.thumb_func<br />
</span></p>
<p>Finally we add the code for main, which is pretty simple:</p>
<p><span style="font-family: Courier New;color: black">main:<br />
ldr r5,=LED_DR      // Load GPIO port addr to r5</span></p>
<p><span style="font-family: Courier New;color: black">loop0:<br />
ldr r6,=LED_ON      // Move led data to r6<br />
str r6,[r5]         // Write r6 data to r5 addr</span></p>
<p><span style="font-family: Courier New;color: black">ldr r0,=0xFFFFFF    // Argument passed in r0<br />
bl CyDelayCycles    // Delay for N cycles</span></p>
<p><span style="font-family: Courier New;color: black">ldr r6,=LED_OFF     // Move led data to r6<br />
str r6,[r5]         // Write r6 data to r5 addr</span></p>
<p><span style="font-family: Courier New;color: black">ldr r0,=0xFFFFFF    // Argument passed in r0<br />
bl CyDelayCycles    // Delay for N cycles</span></p>
<p><span style="font-family: Courier New;color: black">b loop0             // Branch loop0</span></p>
<p><span style="font-family: Courier New;color: black">.endfunc            // End of main<br />
.end                // End of code<br />
</span></p>
<p>One thing to note: The function CyDelayCycles is defined CyBootAsmGnu.s. Any function in assembly gets its arguments passed by the first 4 registers r0,r1,r2 and r3. Before calling the function you simply load r0 with the argument then do a bl (branch with link). This is also why I avoided the first 4 registers when messing with LED data. If you&#8217;re interested in doing more with ARM assembly, definitely read the <a href="https://iotexpert.com/wp-content/uploads/2018/02/m0p_trm.pdf">Cortex M0+ Technical Reference Manual</a>. It&#8217;s a great primer for the M0+ instruction set.</p>
<p>That&#8217;s it. End result is a blinking LED. Cool thing is you can use PSOC Creator with all it&#8217;s nice features, but sill access the power of machine code.</p>
<p>You can get the project ZIP file <a href="https://iotexpert.com/wp-content/uploads/2018/02/M0_ASM_v2.zip">here</a>.</p>
<p>Regards<br />
Darrin Vallis</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339.jpg"><img loading="lazy" decoding="async" width="1024" height="768" class="alignnone size-large wp-image-5022" alt="" src="https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339-1024x768.jpg" srcset="https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><a href="https://iotexpert.com/wp-content/uploads/2018/02/M0_ASM_v2.zip"></a><a href="https://iotexpert.com/wp-content/uploads/2018/02/20180209_133339.jpg"></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/lost-art-assembly-language-programming/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Electronica 2016 &#8211; CY8CKIT-145 User Interface</title>
		<link>https://iotexpert.com/electronica-2016-cy8ckit-145-user-interface/</link>
					<comments>https://iotexpert.com/electronica-2016-cy8ckit-145-user-interface/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Mon, 07 Nov 2016 10:07:08 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Electronica 2016]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=2225</guid>

					<description><![CDATA[I finally made it to Munich late yesterday afternoon&#8230; then I proceeded to turn my hotel room into an electronics lab as I frantically worked to finish everything for tomorrow.  Earlier this year I wrote a whole series of posts about the PSoC4000S &#38; CY8CKIT-145 after the Embedded World show.  We finally have volume production [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I finally made it to Munich late yesterday afternoon&#8230; then I proceeded to turn my hotel room into an electronics lab as I frantically worked to finish everything for tomorrow.  Earlier this year I wrote a whole series of posts about the <a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/" target="_blank">PSoC4000S &amp; CY8CKIT-145</a> after the Embedded World show.  We finally have volume production on the development kit and will be giving them out at the show this week.  So, I decided to use the -145 as part of the user interface for my Electronica project.  The devkit functions as the block labeled &#8220;PSoC Capsense&#8221;.  The wire between the &#8220;PSoC Capsense&#8221; and the &#8220;WICED WiFi&#8221; will be I2C (the green and red wire from the picture below)</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced.png" alt="electronica-wiced" width="1197" height="868" class="alignnone wp-image-2177 size-full" srcset="https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced.png 1197w, https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced-600x435.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced-300x218.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced-768x557.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/electronica-wiced-1024x743.png 1024w" sizes="auto, (max-width: 1197px) 100vw, 1197px" /></a></p>
<p>The -145 devkit has the PSoC4000S silicon on it which has the new mutual capacitance capsense block.  On the devkit, there are three mutual cap buttons and one slider.  Here is a picture of the devkit connected to the WICED WiFi board that I am going to use:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/IMG_3318.jpg"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/IMG_3318.jpg" alt="img_3318" width="4032" height="3024" class="alignnone wp-image-2226 size-full" /></a></p>
<p>I want to make as simple of a PSoC Creator project as I can possibly do as I want to be able to easily do it live.  Here it is:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM.png" alt="screen-shot-2016-11-07-at-10-12-23-am" width="888" height="720" class="alignnone wp-image-2228 size-full" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM.png 888w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM-600x486.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM-300x243.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.12.23-AM-768x623.png 768w" sizes="auto, (max-width: 888px) 100vw, 888px" /></a></p>
<p>The CapSense block is configured with three mutual cap buttons and 1 self-cap slider:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM.png" alt="screen-shot-2016-11-07-at-10-13-54-am" width="1726" height="1142" class="alignnone size-full wp-image-2229" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM.png 1726w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM-600x397.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM-300x198.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM-768x508.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.13.54-AM-1024x678.png 1024w" sizes="auto, (max-width: 1726px) 100vw, 1726px" /></a></p>
<p>On this development board, the three mutual cap buttons share the same transmit line, so you need to configure the component that way. The screen shot below shows the configuration of the &#8220;Button1_Tx&#8221; which is set to share the &#8220;Button0_Tx&#8221;.  You need to make the same setting for &#8220;Button2_Tx&#8221;.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM.png" alt="screen-shot-2016-11-07-at-10-15-34-am" width="1728" height="1144" class="alignnone size-full wp-image-2230" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM.png 1728w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM-600x397.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM-300x199.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM-768x508.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.15.34-AM-1024x678.png 1024w" sizes="auto, (max-width: 1728px) 100vw, 1728px" /></a></p>
<p>The next step is to assign all of the pins to the proper locations:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM.png" alt="screen-shot-2016-11-07-at-10-18-10-am" width="1294" height="880" class="alignnone size-full wp-image-2232" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM.png 1294w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM-600x408.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM-300x204.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM-768x522.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.18.10-AM-1024x696.png 1024w" sizes="auto, (max-width: 1294px) 100vw, 1294px" /></a></p>
<p>Finally the smallest amount of firmware that I could think up to hold it all together.</p>
<p>Line 3-6: define a structure that the WICED board will be able to read.  It will represent the position of two of the Servo motors.  The CY_PACKED provides the compiler appropriate key words to make the bytes be right next to each other in the RAM, i.e. not word aligned..</p>
<p>Line 8: initializes both positions to 50%.</p>
<p>Lines 12-17 get the components going</p>
<p>Line 22: Checks to make sure that the CapSense block is not scanning before it reads the results</p>
<p>Line 24: Tells the CapSense block to process the results from the previous scan</p>
<p>Lines 25-31: Looks at the three buttons, sets the LEDs and sets pos1 to be either 25%, 50% or 75%</p>
<p>Line 33: Reads the position of the slider and assigns it to &#8220;pos0&#8221;</p>
<p>Lines 34-35: Gets the scanning going again</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM.png" alt="screen-shot-2016-11-07-at-10-21-02-am" width="1548" height="1254" class="alignnone size-full wp-image-2233" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM.png 1548w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM-600x486.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM-300x243.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM-768x622.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.21.02-AM-1024x830.png 1024w" sizes="auto, (max-width: 1548px) 100vw, 1548px" /></a></p>
<p>To test the system I first used the bridge control panel.  First, connect to the kitprog2.  Then I setup a read from the I2C address (0x08) which is the address of my board.  I then click repeat which runs the read command over and over again.  In the picture below you can see that I tested the three position of the button (25,50 and 75 which are also known as 0x19, 0x32 and 0x4B).  Then I tested the slider by touching it about in the middle (0x3A)</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM.png" alt="screen-shot-2016-11-07-at-10-31-52-am" width="1722" height="1358" class="alignnone size-full wp-image-2235" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM.png 1722w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM-600x473.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM-300x237.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM-768x606.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.31.52-AM-1024x808.png 1024w" sizes="auto, (max-width: 1722px) 100vw, 1722px" /></a></p>
<p>The next thing to do was make sure that the WICED devkit could read my I2C slave, so I wrote some WICED firmware to read the I2C registers every 500ms:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM.png" alt="screen-shot-2016-11-07-at-10-55-08-am" width="1578" height="1176" class="alignnone size-full wp-image-2237" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM.png 1578w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM-600x447.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM-300x224.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM-768x572.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.55.08-AM-1024x763.png 1024w" sizes="auto, (max-width: 1578px) 100vw, 1578px" /></a></p>
<p>But, occasionally I  was getting a &#8220;read failed&#8221;:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM.png" alt="screen-shot-2016-11-07-at-10-58-48-am" width="1490" height="1476" class="alignnone size-full wp-image-2238" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM.png 1490w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-100x100.png 100w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-600x594.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-150x150.png 150w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-300x297.png 300w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-768x761.png 768w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.58.48-AM-1024x1014.png 1024w" sizes="auto, (max-width: 1490px) 100vw, 1490px" /></a></p>
<p>Last night in my sleep deprived state I was struggling like crazy to figure it out.  This morning after some sleep I realized that the WICED board that I have must not like getting its I2C clock stretched.  So, I changed the priority of the I2C interrupt on the PSoC and that fixed the problem:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.28.03-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.28.03-AM.png" alt="screen-shot-2016-11-07-at-10-28-03-am" width="716" height="198" class="alignnone size-full wp-image-2234" srcset="https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.28.03-AM.png 716w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.28.03-AM-600x166.png 600w, https://iotexpert.com/wp-content/uploads/2016/11/Screen-Shot-2016-11-07-at-10.28.03-AM-300x83.png 300w" sizes="auto, (max-width: 716px) 100vw, 716px" /></a></p>
<p>Keep watching here for more updates on the project.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/electronica-2016-cy8ckit-145-user-interface/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038; The SmartIO – Part 5</title>
		<link>https://iotexpert.com/psoc4000s-the-smartio-part-5/</link>
					<comments>https://iotexpert.com/psoc4000s-the-smartio-part-5/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Sun, 20 Mar 2016 10:35:35 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[SmartIO]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=776</guid>

					<description><![CDATA[This is my last post on the SmartIO.  This time, I am going to describe how to use the SmartIO to trigger an interrupt.  For this project I will start from the &#8220;SmartIOCountUp&#8221; project.  That project is a 3-bit counter.  I thought that I would choose one of the states (000) and trigger an interrupt [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is my last post on the SmartIO.  This time, I am going to describe how to use the SmartIO to trigger an interrupt.  For this project I will start from the &#8220;SmartIOCountUp&#8221; project.  That project is a 3-bit counter.  I thought that I would choose one of the states (000) and trigger an interrupt when that state is hit, then toggle the P25 user led.  I will keep data4, and gpio 3,6,7 exactly the same.  I will use gpio 2 to trigger the interrupt, which can be accomplished by setting it up as an output.  Here is the SmartIO configuration:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1.png" rel="attachment wp-att-944"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1-1024x685.png" alt="smart-io-config" width="1024" height="685" class="alignnone size-large wp-image-944" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1-1024x685.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1-600x402.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1-768x514.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-1.png 1037w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The next step is to use LUT2 to look for the &#8220;000&#8221; state and to create a rising edge.  The other states will be 0.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/lut-p22.png" rel="attachment wp-att-945"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/lut-p22.png" alt="lut-p22" width="556" height="441" class="alignnone size-full wp-image-945" srcset="https://iotexpert.com/wp-content/uploads/2016/03/lut-p22.png 556w, https://iotexpert.com/wp-content/uploads/2016/03/lut-p22-300x238.png 300w" sizes="auto, (max-width: 556px) 100vw, 556px" /></a></p>
<p>After making the modification to the SmartIO the next step is to fix the schematic.  To do this I add a pin for P22, its configuration is on the next screen.  In addition I move the P25 (aka the BlueLED on the master board) to pin by itself.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic.png" rel="attachment wp-att-941"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic.png" alt="interrupt-schematic" width="748" height="403" class="alignnone size-full wp-image-941" srcset="https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic.png 748w, https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic-600x323.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic-300x162.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/interrupt-schematic-740x400.png 740w" sizes="auto, (max-width: 748px) 100vw, 748px" /></a></p>
<p>To configure the P22 pin.  There is a trick that is required to make the pin be both an output, so that it can be connected to the SmartIO LUT as well as an Input, so that it can be connected to the Port 2 interrupt.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/pin-config.png" rel="attachment wp-att-942"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/pin-config.png" alt="pin-config" width="642" height="483" class="alignnone size-full wp-image-942" srcset="https://iotexpert.com/wp-content/uploads/2016/03/pin-config.png 642w, https://iotexpert.com/wp-content/uploads/2016/03/pin-config-600x451.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/pin-config-300x226.png 300w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></p>
<p>After setting up the pin to be both an Input and an Output you need to configure the pin to have an interrupt on the rising edge.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/int-pin.png" rel="attachment wp-att-943"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/int-pin.png" alt="int-pin" width="642" height="484" class="alignnone size-full wp-image-943" srcset="https://iotexpert.com/wp-content/uploads/2016/03/int-pin.png 642w, https://iotexpert.com/wp-content/uploads/2016/03/int-pin-600x452.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/int-pin-300x226.png 300w" sizes="auto, (max-width: 642px) 100vw, 642px" /></a></p>
<p>Then I assign the pins.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/interrput-pin-assignment.png" rel="attachment wp-att-950"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/interrput-pin-assignment.png" alt="interrput-pin-assignment" width="488" height="184" class="alignnone size-large wp-image-950" srcset="https://iotexpert.com/wp-content/uploads/2016/03/interrput-pin-assignment.png 488w, https://iotexpert.com/wp-content/uploads/2016/03/interrput-pin-assignment-300x113.png 300w" sizes="auto, (max-width: 488px) 100vw, 488px" /></a></p>
<p>The last step is to make the firmware.</p>
<ul>
<li>Lines 4-9 create an interrupt service routine</li>
<li>Line 18 registers the interrupt service routine to be called with the Port2 interrupt is triggered</li>
<li>The rest is the same as before</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/int-mainc.png" rel="attachment wp-att-946"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/int-mainc.png" alt="int-mainc" width="692" height="539" class="alignnone size-full wp-image-946" srcset="https://iotexpert.com/wp-content/uploads/2016/03/int-mainc.png 692w, https://iotexpert.com/wp-content/uploads/2016/03/int-mainc-600x467.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/int-mainc-300x234.png 300w" sizes="auto, (max-width: 692px) 100vw, 692px" /></a></p>
<p>When I run this, I see the Blue LED toggle each time it gets to state 000 (which is all three LEDs on as they are active low).</p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;SmartIO&#8221;.  This project is called &#8220;SmartIOInterrupt&#8221;.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">PSoC4000s &amp; The SmartIO – Part 1</a></td>
<td > An introduction to the SmartIO and first project</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/" target="_blank">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 1</a></td>
<td > Using mutual capacitance</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 2</a></td>
<td > Using the CapSense tuner</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/14/psoc4000s-the-smartio-part-2/" target="_blank">PSoC4000s &amp; The SmartIO – Part 2</a></td>
<td > A 3 input XOR logic gate</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/16/psoc4000s-the-smartio-part-3/">PSoC4000s &amp; The SmartIO – Part 3</a></td>
<td > A 3 bit up counter state machine</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/19/psoc4000s-the-smartio-part-4/">PSoC4000s &amp; The SmartIO – Part 4</a></td>
<td > Using an external clock with the Smart IO</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/20/psoc4000s-the-smartio-part-5/">PSoC4000s &amp; The SmartIO – Part 5</a></td>
<td > Triggering an interrupt</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-the-smartio-part-5/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038; The SmartIO – Part 4</title>
		<link>https://iotexpert.com/psoc4000s-the-smartio-part-4/</link>
					<comments>https://iotexpert.com/psoc4000s-the-smartio-part-4/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Sat, 19 Mar 2016 10:00:30 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[SmartIO]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=775</guid>

					<description><![CDATA[In the previous post I built a 3-bit counter that is clocked by the PWM.  In this example I will show you how to make the same design work with an external clock.  It seems like it would be cool to use the CapSense Button to provide the clock.  I will start by copying SmartIOCountUp [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the previous post I built a 3-bit counter that is clocked by the PWM.  In this example I will show you how to make the same design work with an external clock.  It seems like it would be cool to use the CapSense Button to provide the clock.  I will start by copying SmartIOCountUp to a new project called SmartIOCountUpExtClock.</p>
<p>First, I delete the clock and PWM.  Then add a new digital output pin (P20) that I can toggle from the CapSense handler and a digital Input pin (P21) to clock the SmartIO.  I add a wire between them on the female header on the board.</p>
<p>The next step is to modify the SmartIO.  I change data4 and data5 to bypass.  Then make gpio1 an input and then set the Clock to gpio1.  Here is what the new SmartIO configuration looks like:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config.png" rel="attachment wp-att-935"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config.png" alt="smart-io-config" width="1009" height="693" class="alignnone size-full wp-image-935" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config.png 1009w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-600x412.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-300x206.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-config-768x527.png 768w" sizes="auto, (max-width: 1009px) 100vw, 1009px" /></a></p>
<p>And the schematic.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-schematic.png" rel="attachment wp-att-936"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-schematic.png" alt="smart-io-schematic" width="572" height="368" class="alignnone size-full wp-image-936" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-schematic.png 572w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-schematic-300x193.png 300w" sizes="auto, (max-width: 572px) 100vw, 572px" /></a></p>
<p>Assign the pins.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-dwr.png" rel="attachment wp-att-937"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-dwr.png" alt="smart-io-dwr" width="487" height="368" class="alignnone size-full wp-image-937" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smart-io-dwr.png 487w, https://iotexpert.com/wp-content/uploads/2016/03/smart-io-dwr-300x227.png 300w" sizes="auto, (max-width: 487px) 100vw, 487px" /></a></p>
<p>I need to update the main.c write the CapSense button to P20 to be a clock source for the SmartIO</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/mainc.png" rel="attachment wp-att-938"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/mainc.png" alt="mainc" width="871" height="579" class="alignnone size-full wp-image-938" srcset="https://iotexpert.com/wp-content/uploads/2016/03/mainc.png 871w, https://iotexpert.com/wp-content/uploads/2016/03/mainc-600x399.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/mainc-300x199.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/mainc-768x511.png 768w" sizes="auto, (max-width: 871px) 100vw, 871px" /></a></p>
<p>After I program the board, I can &#8220;clock&#8221; my statemachine with CapSense Button2.  Cool.  Obviously this example is a bit contrived in that I am running a wire on the outside of the chip, but you could imagine that you might have a &#8220;real&#8221; example that uses an onboard clock source.</p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;SmartIO&#8221;.  This project is called &#8220;SmartIOCountUpExtClock&#8221;.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">PSoC4000s &amp; The SmartIO – Part 1</a></td>
<td > An introduction to the SmartIO and first project</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/" target="_blank">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 1</a></td>
<td > Using mutual capacitance</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 2</a></td>
<td > Using the CapSense tuner</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/14/psoc4000s-the-smartio-part-2/" target="_blank">PSoC4000s &amp; The SmartIO – Part 2</a></td>
<td > A 3 input XOR logic gate</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/16/psoc4000s-the-smartio-part-3/">PSoC4000s &amp; The SmartIO – Part 3</a></td>
<td > A 3 bit up counter state machine</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/19/psoc4000s-the-smartio-part-4/">PSoC4000s &amp; The SmartIO – Part 4</a></td>
<td > Using an external clock with the Smart IO</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/20/psoc4000s-the-smartio-part-5/">PSoC4000s &amp; The SmartIO – Part 5</a></td>
<td > Triggering an interrupt</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-the-smartio-part-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038; The SmartIO – Part 3</title>
		<link>https://iotexpert.com/psoc4000s-the-smartio-part-3/</link>
					<comments>https://iotexpert.com/psoc4000s-the-smartio-part-3/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 16 Mar 2016 10:26:18 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[SmartIO]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=774</guid>

					<description><![CDATA[For this post, I wanted to build a simple state machine inside of the SmartIO.  So I decided to build a 3-bit counter.  On the CY8CKIT145 board, port 2 is mostly connected to LEDs.  When you look at the picture below you can see that the LEDs on the left side of the board are [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>For this post, I wanted to build a simple state machine inside of the SmartIO.  So I decided to build a 3-bit counter.  On the CY8CKIT145 board, port 2 is mostly connected to LEDs.  When you look at the picture below you can see that the LEDs on the left side of the board are easiest to see, so I decided to use them to indicate the state of the counter.  You can see from my notes that I was originally considering using LED9,11,10 which are the three LEDs on the CapSense buttons board.  I also considered using LED5,6,8 which are on the right side of the slider board, but I ruled all of that out because they were hard to see.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1.jpg" rel="attachment wp-att-907"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1-768x1024.jpg" alt="IMG_2737" width="768" height="1024" class="alignnone size-large wp-image-907" srcset="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2737-1-scaled.jpg 1920w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
<p>To build this project you start by creating the schematic.  In this case I copied the design from the previous post called &#8220;145MutualCap&#8221; which had 3 CapSense buttons and 3 LEDs (LED10,11,9).  I then added:</p>
<ul>
<li>A 5 KHz Clock to drive the PWM</li>
<li>A PWM to divide down the clock to a speed that I could see and provide a clock for the counter</li>
<li>A Smart IO</li>
<li>4 Output Pins to drive LEDs (P27, P26, P25, P23)</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/counter-schematic-1.png" rel="attachment wp-att-910"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/counter-schematic-1.png" alt="counter-schematic-1" width="682" height="548" class="alignnone size-full wp-image-910" srcset="https://iotexpert.com/wp-content/uploads/2016/03/counter-schematic-1.png 682w, https://iotexpert.com/wp-content/uploads/2016/03/counter-schematic-1-600x482.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/counter-schematic-1-300x241.png 300w" sizes="auto, (max-width: 682px) 100vw, 682px" /></a></p>
<p>Next I configured the PWM with a 50% duty cycle and a Period of 10000.  This results in a 0.5Hz clock:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smartiopwm-1.png" rel="attachment wp-att-911"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smartiopwm-1.png" alt="smartiopwm" width="651" height="685" class="alignnone size-full wp-image-911" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smartiopwm-1.png 651w, https://iotexpert.com/wp-content/uploads/2016/03/smartiopwm-1-600x631.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smartiopwm-1-285x300.png 285w" sizes="auto, (max-width: 651px) 100vw, 651px" /></a></p>
<p>Then I configure the SmartIO.</p>
<ul>
<li>Setup &#8220;data4&#8221; as an input to the Smart IO.  Data 4 is the line out 0 of the TCPWM0</li>
<li>Setup &#8220;data5&#8221; as an input to the Smart IO.  Then configure it to be the &#8220;clock&#8221; for the smart IO. Data 5 is the Line_N of TCPWM0.  Originally I wanted to be able to have the clock drive LED5 as well, but this can create a timing hazard in the Smart IO and is not allowed (which is why I mirror data 4 onto the output P25.</li>
<li>Setup GPIO 7,6,5, and 3 as outputs (these outputs are connected to P27, P26, P23 which are the LEDs on the slider board.  GPIO5 is connected to P25 that is the user LED on the main board</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig.png" rel="attachment wp-att-923"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig-1024x688.png" alt="smartioconfig" width="1024" height="688" class="alignnone size-large wp-image-923" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig-1024x688.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig-600x403.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig-300x202.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig-768x516.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/smartioconfig.png 1027w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Then I configure LUTs 6, 3, 7 to implement the state table of a counter</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/state.png" rel="attachment wp-att-914"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/state.png" alt="state" width="396" height="168" class="alignnone size-full wp-image-914" srcset="https://iotexpert.com/wp-content/uploads/2016/03/state.png 396w, https://iotexpert.com/wp-content/uploads/2016/03/state-300x127.png 300w" sizes="auto, (max-width: 396px) 100vw, 396px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/lut6-1.png" rel="attachment wp-att-915"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/lut6-1.png" alt="lut6" width="583" height="416" class="alignnone size-full wp-image-915" srcset="https://iotexpert.com/wp-content/uploads/2016/03/lut6-1.png 583w, https://iotexpert.com/wp-content/uploads/2016/03/lut6-1-300x214.png 300w" sizes="auto, (max-width: 583px) 100vw, 583px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/lut3-1.png" rel="attachment wp-att-916"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/lut3-1.png" alt="lut3" width="589" height="380" class="alignnone size-full wp-image-916" srcset="https://iotexpert.com/wp-content/uploads/2016/03/lut3-1.png 589w, https://iotexpert.com/wp-content/uploads/2016/03/lut3-1-300x194.png 300w" sizes="auto, (max-width: 589px) 100vw, 589px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/lut7-1.png" rel="attachment wp-att-917"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/lut7-1.png" alt="lut7" width="568" height="420" class="alignnone size-full wp-image-917" srcset="https://iotexpert.com/wp-content/uploads/2016/03/lut7-1.png 568w, https://iotexpert.com/wp-content/uploads/2016/03/lut7-1-300x222.png 300w" sizes="auto, (max-width: 568px) 100vw, 568px" /></a></p>
<p>I want to be able to see the clock (the PWM input data4) ticking so I create a transparent LUT (000 = 0 and 111 = 1) for LUT5 which is attached to P25 which is the LED on the main board.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/lut5-1.png" rel="attachment wp-att-918"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/lut5-1.png" alt="lut5" width="578" height="405" class="alignnone size-full wp-image-918" srcset="https://iotexpert.com/wp-content/uploads/2016/03/lut5-1.png 578w, https://iotexpert.com/wp-content/uploads/2016/03/lut5-1-300x210.png 300w" sizes="auto, (max-width: 578px) 100vw, 578px" /></a></p>
<p>After this is done I need to assign the Pins.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1.png" rel="attachment wp-att-919"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1.png" alt="smartiopinassignment" width="883" height="411" class="alignnone size-full wp-image-919" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1.png 883w, https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1-600x279.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1-300x140.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smartiopinassignment-1-768x357.png 768w" sizes="auto, (max-width: 883px) 100vw, 883px" /></a></p>
<p>Followed by the very simple firmware which is copied from the previous design.  The only new code is line 9 to turn on the PWM.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/main.png" rel="attachment wp-att-921"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/main.png" alt="main" width="904" height="563" class="alignnone size-full wp-image-921" srcset="https://iotexpert.com/wp-content/uploads/2016/03/main.png 904w, https://iotexpert.com/wp-content/uploads/2016/03/main-600x374.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/main-300x187.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/main-768x478.png 768w" sizes="auto, (max-width: 904px) 100vw, 904px" /></a></p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;SmartIO&#8221;.  This project is called &#8220;SmartIOCountUp&#8221;.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">PSoC4000s &amp; The SmartIO – Part 1</a></td>
<td > An introduction to the SmartIO and first project</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/" target="_blank">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 1</a></td>
<td > Using mutual capacitance</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 2</a></td>
<td > Using the CapSense tuner</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/14/psoc4000s-the-smartio-part-2/" target="_blank">PSoC4000s &amp; The SmartIO – Part 2</a></td>
<td > A 3 input XOR logic gate</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/16/psoc4000s-the-smartio-part-3/">PSoC4000s &amp; The SmartIO – Part 3</a></td>
<td > A 3 bit up counter state machine</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/19/psoc4000s-the-smartio-part-4/">PSoC4000s &amp; The SmartIO – Part 4</a></td>
<td > Using an external clock with the Smart IO</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/20/psoc4000s-the-smartio-part-5/">PSoC4000s &amp; The SmartIO – Part 5</a></td>
<td > Triggering an interrupt</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-the-smartio-part-3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038; The SmartIO – Part 2</title>
		<link>https://iotexpert.com/psoc4000s-the-smartio-part-2/</link>
					<comments>https://iotexpert.com/psoc4000s-the-smartio-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Mon, 14 Mar 2016 10:15:15 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[SmartIO]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=773</guid>

					<description><![CDATA[In the previous posts I introduced you to the Smart IO.  I also went through the instructions to create CapSense Buttons using the new Mutual-cap CSX mode of the PSoC4000S.  In this post I am going to use the three CapSense buttons on the CY8CKIT-145 as inputs to the Smart IO.  I want to create [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">previous</a> posts I introduced you to the Smart IO.  I also went through the instructions to create CapSense Buttons using the new Mutual-cap CSX mode of the PSoC4000S.  In this post I am going to use the three CapSense buttons on the CY8CKIT-145 as inputs to the Smart IO.  I want to create a simple logic function P25 = !XOR(P24,P26,P27).  This will cause the LED that is attached P25 to light up when there is an odd number of 1&#8217;s on P24,P26,P27.  The equation is slightly strange because the LED is wired as active low (it lights up when there is a 0 written to it)</p>
<p>To make this work I soldered an 8 pin female header to Port 2 of my development kit.  I then wired:</p>
<ul>
<li>P20 &lt;&#8211;&gt; P24</li>
<li>P21 &lt;&#8211;&gt; P26</li>
<li>P22 &lt;&#8211;&gt; P27</li>
</ul>
<p>You can see all of that in the picture below.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1.jpg" rel="attachment wp-att-929"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1-768x1024.jpg" alt="IMG_2744" width="768" height="1024" class="alignnone size-large wp-image-929" srcset="https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1-768x1024.jpg 768w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1-600x800.jpg 600w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1-225x300.jpg 225w, https://iotexpert.com/wp-content/uploads/2016/03/IMG_2744-1-scaled.jpg 1920w" sizes="auto, (max-width: 768px) 100vw, 768px" /></a></p>
<p>The next step is to create the schematic for this design.  I started from the Mutual Capacitance project that I talked about in the previous post.  It has three LEDs and the Capsense Buttons.  I then add</p>
<ul>
<li>Three digital output pins (P20,P21,P22) to drive the three inputs to the SmartIO</li>
<li>Three digital input pins (P24,P26, P27) to use as inputs to the SmartIO</li>
<li>One digital output pin (P25) to drive the LED</li>
<li>The Smart IO block</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/3xorschematic.png" rel="attachment wp-att-890"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/3xorschematic.png" alt="3xorschematic" width="477" height="516" class="alignnone size-full wp-image-890" srcset="https://iotexpert.com/wp-content/uploads/2016/03/3xorschematic.png 477w, https://iotexpert.com/wp-content/uploads/2016/03/3xorschematic-277x300.png 277w" sizes="auto, (max-width: 477px) 100vw, 477px" /></a></p>
<p>The next step is to configure the SmartIO.  I setup P24,P26,P27 as &#8220;inputs&#8221; and setup P25 as an &#8220;output&#8221;</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smartio-config.png" rel="attachment wp-att-894"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/smartio-config-1024x687.png" alt="smartio-config" width="1024" height="687" class="alignnone size-large wp-image-894" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smartio-config-1024x687.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-config-600x402.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-config-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-config-768x515.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-config.png 1026w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Then I configure the LUT to match the logic equation: P25 = !XOR(P24,P26,P27)</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/LUT5-1.png" rel="attachment wp-att-893"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/LUT5-1.png" alt="LUT5" width="501" height="375" class="alignnone size-full wp-image-893" srcset="https://iotexpert.com/wp-content/uploads/2016/03/LUT5-1.png 501w, https://iotexpert.com/wp-content/uploads/2016/03/LUT5-1-300x225.png 300w" sizes="auto, (max-width: 501px) 100vw, 501px" /></a></p>
<p>Lastly I assign the pins to the correct physical pins on the chip.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/dwr.png" rel="attachment wp-att-891"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/dwr.png" alt="dwr" width="452" height="409" class="alignnone size-full wp-image-891" srcset="https://iotexpert.com/wp-content/uploads/2016/03/dwr.png 452w, https://iotexpert.com/wp-content/uploads/2016/03/dwr-300x271.png 300w" sizes="auto, (max-width: 452px) 100vw, 452px" /></a></p>
<p>Then I create the firmware by copying the main.c from the earlier CapSense example.  I then add the small amount of code to glue it all together:</p>
<ul>
<li>Line 7: start the SmartIO</li>
<li>Lines 27-29: Write to P20,P21,P22 based on the state of the input buttons.</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/3xormainc.png" rel="attachment wp-att-889"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2016/03/3xormainc.png" alt="3xormainc" width="920" height="653" class="alignnone size-full wp-image-889" srcset="https://iotexpert.com/wp-content/uploads/2016/03/3xormainc.png 920w, https://iotexpert.com/wp-content/uploads/2016/03/3xormainc-600x426.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/3xormainc-300x213.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/3xormainc-768x545.png 768w" sizes="auto, (max-width: 920px) 100vw, 920px" /></a></p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;SmartIO&#8221;.  This project is called &#8220;3Xor&#8221;.</p>
<p>In the next post I will show you how to make a state machine using the Smart IO.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">PSoC4000s &amp; The SmartIO – Part 1</a></td>
<td > An introduction to the SmartIO and first project</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/" target="_blank">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 1</a></td>
<td > Using mutual capacitance</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 2</a></td>
<td > Using the CapSense tuner</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/14/psoc4000s-the-smartio-part-2/" target="_blank">PSoC4000s &amp; The SmartIO – Part 2</a></td>
<td > A 3 input XOR logic gate</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/16/psoc4000s-the-smartio-part-3/">PSoC4000s &amp; The SmartIO – Part 3</a></td>
<td > A 3 bit up counter state machine</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/19/psoc4000s-the-smartio-part-4/">PSoC4000s &amp; The SmartIO – Part 4</a></td>
<td > Using an external clock with the Smart IO</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/20/psoc4000s-the-smartio-part-5/">PSoC4000s &amp; The SmartIO – Part 5</a></td>
<td > Triggering an interrupt</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-the-smartio-part-2/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038;  CSX Mutual CapSense Buttons Part 2</title>
		<link>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-2/</link>
					<comments>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-2/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Sat, 12 Mar 2016 11:00:14 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[Capsense]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=811</guid>

					<description><![CDATA[In the previous post I gave you the instructions to get the new Mutual Capacitance buttons going on the CY8CKIT-142.  In this post I will talk about how to add the Capsense Tuner to your project.  The Capsense tuner can talk to your design while it is running, then report back to you the parametric [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the previous post I gave you the instructions to get the new Mutual Capacitance buttons going on the CY8CKIT-142.  In this post I will talk about how to add the Capsense Tuner to your project.  The Capsense tuner can talk to your design while it is running, then report back to you the parametric of your design.</p>
<p>First you need to add the tuner to your project.  In order to do this, start with the last design, then add an EzI2C component.  Here is the new schematic:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-Schematic.png" rel="attachment wp-att-816"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-816" src="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-Schematic.png" alt="Tuner-Schematic" width="428" height="227" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-Schematic.png 428w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-Schematic-300x159.png 300w" sizes="auto, (max-width: 428px) 100vw, 428px" /></a></p>
<p>Then you configure the EZ2IC to have 16 bit sub addresses.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-EzConfig.png" rel="attachment wp-att-814"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-814" src="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-EzConfig.png" alt="Tuner-EzConfig" width="562" height="530" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-EzConfig.png 562w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-EzConfig-300x283.png 300w" sizes="auto, (max-width: 562px) 100vw, 562px" /></a></p>
<p>Then assign the EZI2C pins to the KitProg I2C bridge pins</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-DWR.png" rel="attachment wp-att-813"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-813" src="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-DWR.png" alt="Tuner-DWR" width="492" height="298" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-DWR.png 492w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-DWR-300x182.png 300w" sizes="auto, (max-width: 492px) 100vw, 492px" /></a></p>
<p>The last step is to write the firmware which is almost exactly what you had in the last project except</p>
<ul>
<li>Lines 8-9 which start the capsense block and setup the Capsense memory buffer to be readable by the remote host</li>
<li>Line 21: which updates the Capsense memory buffer with the current state of the capsense parameters</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware.png" rel="attachment wp-att-817"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-817" src="https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware-1024x601.png" alt="tuner-firmware" width="1024" height="601" srcset="https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware-1024x601.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware-600x352.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware-300x176.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware-768x451.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/tuner-firmware.png 1084w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Once all of this is done, build and program the device.  Then start the capsense tuner by right clicking the Capsense component in the schematic and saying &#8220;run Tuner&#8221;</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/launch-tuner.png" rel="attachment wp-att-818"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-818" src="https://iotexpert.com/wp-content/uploads/2016/03/launch-tuner.png" alt="launch-tuner" width="486" height="467" srcset="https://iotexpert.com/wp-content/uploads/2016/03/launch-tuner.png 486w, https://iotexpert.com/wp-content/uploads/2016/03/launch-tuner-300x288.png 300w" sizes="auto, (max-width: 486px) 100vw, 486px" /></a></p>
<p>Then configure the tuner communication parameters from the &#8220;Tools-&gt;Tuner communication setup&#8221; menu.  These should match what you have setup in the EZI2C component.  Specifically you need set the I2C addresses to be the same, and you need to have the sub-address set to &#8220;2-bytes&#8221; which is the same as the 16-bit sub-address which you set in the component above.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/tuner-comm-setup.png" rel="attachment wp-att-820"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-820" src="https://iotexpert.com/wp-content/uploads/2016/03/tuner-comm-setup.png" alt="tuner-comm-setup" width="574" height="399" srcset="https://iotexpert.com/wp-content/uploads/2016/03/tuner-comm-setup.png 574w, https://iotexpert.com/wp-content/uploads/2016/03/tuner-comm-setup-300x209.png 300w" sizes="auto, (max-width: 574px) 100vw, 574px" /></a></p>
<p>The next step is to press &#8220;connect&#8221;  and the &#8220;start&#8221;.  First make sure that your three buttons are working.  In the picture below you can see that I am touching Buttons 1 and 2 as they are &#8220;active&#8221; (red color) which means that their signal is above the threshold.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/2-buttons.png" rel="attachment wp-att-822"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-822" src="https://iotexpert.com/wp-content/uploads/2016/03/2-buttons.png" alt="2-buttons" width="984" height="675" srcset="https://iotexpert.com/wp-content/uploads/2016/03/2-buttons.png 984w, https://iotexpert.com/wp-content/uploads/2016/03/2-buttons-600x412.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/2-buttons-300x206.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/2-buttons-768x527.png 768w" sizes="auto, (max-width: 984px) 100vw, 984px" /></a></p>
<p>The next step is to look at a &#8220;graph view&#8221; of button 0.  You can do this by pressing &#8220;graph view&#8221; and selecting Button0_Rx0.  Once I switch to this view I touch the button 9 times.  You can see that as there are 9 button touches in the Status window.  A status of 1 means that the button is active and a status of 0 is an inactive.</p>
<p>In the sensor data window you can see the &#8220;baseline&#8221; which is the noise on the sensor node without a touch.  The blue line is the &#8220;RawCounts&#8221; which the amount of signal on the node.</p>
<p>In the middle window you can see the &#8220;Sensor Signal&#8221; which is the Sensor Data minus the baseline.  Any time the Sensor Signal is above the touch threshold then the sensor status is active.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph.png" rel="attachment wp-att-815"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-815" src="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph.png" alt="Tuner-graph" width="953" height="461" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph.png 953w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph-600x290.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph-300x145.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/Tuner-graph-768x372.png 768w" sizes="auto, (max-width: 953px) 100vw, 953px" /></a></p>
<p>The last step is to use the SNR measurement tab to see how robust your design is.  First click on the &#8220;SNR Measurement&#8221; tab.  Then pick out which sensor you will measure.  In this case I have setup measurement on &#8220;Button_0&#8221;.  Then click on &#8220;Acquire noise&#8221; and wait.  It will make the graph shown below which says that my noise is about 3008-2995 or about 13 counts.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise.png" rel="attachment wp-att-823"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-823" src="https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise.png" alt="BaselineNoise" width="983" height="676" srcset="https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise.png 983w, https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise-600x413.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise-300x206.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/BaselineNoise-768x528.png 768w" sizes="auto, (max-width: 983px) 100vw, 983px" /></a></p>
<p>The next step is to see how much signal you get.  Start this process by pressing &#8220;Acquire Signal&#8221; and touching the correct button.  You can see orange line represents the amount of signal when you are touching the sensor.  The system will then calculate the SNR which in this case is 56.85 which is tons.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/SNR.png" rel="attachment wp-att-824"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-824" src="https://iotexpert.com/wp-content/uploads/2016/03/SNR.png" alt="SNR" width="921" height="617" srcset="https://iotexpert.com/wp-content/uploads/2016/03/SNR.png 921w, https://iotexpert.com/wp-content/uploads/2016/03/SNR-600x402.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/SNR-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/SNR-768x515.png 768w" sizes="auto, (max-width: 921px) 100vw, 921px" /></a></p>
<p>The last thing that you could do is change the Capsense parameters in the sensor parameter screen.  For instance you could change the threshold from 100 to a bigger number to give more reliable touches.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Parameters.png" rel="attachment wp-att-825"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-825" src="https://iotexpert.com/wp-content/uploads/2016/03/Parameters.png" alt="Parameters" width="239" height="359" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Parameters.png 239w, https://iotexpert.com/wp-content/uploads/2016/03/Parameters-200x300.png 200w" sizes="auto, (max-width: 239px) 100vw, 239px" /></a></p>
<p>OK.  Now I have my capsense buttons working.  In the next posts Ill be ready to talk more about the Smart IO.</p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;145MutualCap&#8221;.  This project is called &#8220;TunerMutualCapButtons-145&#8221;.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038;  CSX Mutual CapSense Buttons Part 1</title>
		<link>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-1/</link>
					<comments>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Thu, 10 Mar 2016 13:00:12 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[Capsense]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=771</guid>

					<description><![CDATA[In the previous post I talked about my original goal to learn about the SmartIO.  But, in order fully try out the SmartIO I needed an input source.  On this board I had only one easy input from the factory &#8211; specifically the mechanical button on P0[7]- but I wanted to have multiple switches.  Well, the obvious [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">previous post</a> I talked about my original goal to learn about the SmartIO.  But, in order fully try out the SmartIO I needed an input source.  On this board I had only one easy input from the factory &#8211; specifically the mechanical button on P0[7]- but I wanted to have multiple switches.  Well, the obvious choice was to use the three Capsense Buttons on the user interface expansion board.   When I looked at that board closely I remembered that the buttons were put there to support the new Capsense functionality of the PSoC4000s family.  Inside of Cypress we call the new feature &#8220;CSX&#8221;, but its real name is &#8220;Mutual Capacitance&#8221;.  Mutual Capsense works by transmitting a signal on the &#8220;Tx&#8221; pin and then receiving that signal by capacitively coupling that signal through your finger into the &#8220;Rx&#8221; line.  Here is a picture of that part of the PCB schematic and a zoom in of the board.  You can see that there are three different size buttons.  Each of the buttons is composed of an even number of pie shaped segments.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/mutual-cap-buttons.png" rel="attachment wp-att-798"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-798" src="https://iotexpert.com/wp-content/uploads/2016/03/mutual-cap-buttons.png" alt="mutual-cap-buttons" width="347" height="250" srcset="https://iotexpert.com/wp-content/uploads/2016/03/mutual-cap-buttons.png 347w, https://iotexpert.com/wp-content/uploads/2016/03/mutual-cap-buttons-300x216.png 300w" sizes="auto, (max-width: 347px) 100vw, 347px" /></a><a href="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM.png" rel="attachment wp-att-801"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-801" src="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM.png" alt="Screen Shot 2016-03-06 at 2.03.17 PM" width="971" height="502" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM.png 971w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM-600x310.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM-300x155.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM-768x397.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-2.03.17-PM-348x180.png 348w" sizes="auto, (max-width: 971px) 100vw, 971px" /></a></p>
<p>The mutual capacitance technique has a much higher Signal-to-Noise Ratio (SnR) as compared to the Self Capacitance technique of previous chips and as a result is more immune to noise and can work through a thicker overlay.  I thought that I would try putting on overlay on my board, so I cut out a piece of 1.5mm acrylic and used double sided tape to attach it to my board.  You can see it in the photograph above.</p>
<p>To make this work I started by creating a new project called &#8220;MutualCapButtons&#8221;.  I then added the Capsense component and three digital output pins (one for each of the three LEDs on the expansion board).  Here is the schematic:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/mutual-button-schematic.png" rel="attachment wp-att-802"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-802" src="https://iotexpert.com/wp-content/uploads/2016/03/mutual-button-schematic.png" alt="mutual-button-schematic" width="335" height="221" srcset="https://iotexpert.com/wp-content/uploads/2016/03/mutual-button-schematic.png 335w, https://iotexpert.com/wp-content/uploads/2016/03/mutual-button-schematic-300x198.png 300w" sizes="auto, (max-width: 335px) 100vw, 335px" /></a></p>
<p>The next step was to configure the CapSense block by double clicking it.  I then added three buttons and set the sensing mode to CSX (Mutual-cap).</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config.png" rel="attachment wp-att-803"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-803" src="https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config.png" alt="mtutual-cap-config" width="889" height="641" srcset="https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config.png 889w, https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config-600x433.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config-300x216.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/mtutual-cap-config-768x554.png 768w" sizes="auto, (max-width: 889px) 100vw, 889px" /></a></p>
<p>It is possible to have dedicated Tx/Rx pins or you can share the Txs.  To do this, select &#8220;Advanced&#8221; and &#8220;Widget details&#8221;.  Then select &#8220;Button1_Tx&#8221;  and choose its sensor to be the same as &#8220;Button0_Tx&#8221;.  On this design I shared the Tx between all three of the buttons.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing.png" rel="attachment wp-att-804"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-804" src="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing.png" alt="Mutual-sharing" width="894" height="644" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing.png 894w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing-600x432.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing-300x216.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-sharing-768x553.png 768w" sizes="auto, (max-width: 894px) 100vw, 894px" /></a></p>
<p>The next step is to assign the pins to the correct Port/Pin locations on the chip:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/button-pin-assignments.png" rel="attachment wp-att-805"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-805" src="https://iotexpert.com/wp-content/uploads/2016/03/button-pin-assignments.png" alt="button-pin-assignments" width="495" height="249" srcset="https://iotexpert.com/wp-content/uploads/2016/03/button-pin-assignments.png 495w, https://iotexpert.com/wp-content/uploads/2016/03/button-pin-assignments-300x151.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" /></a></p>
<p>The last step is to write the firmware</p>
<ul>
<li>Lines 8-10 Start the capsense block and get the scanning going</li>
<li>Line 14: If the capsense block is done scanning then process the results</li>
<li>Line 16: Take all of the raw data from the scan and setup all of the status information</li>
<li>Lines 18-20: If the buttons are being pushed then turn on the corresponding LED</li>
<li>Lines 22-23 Start another scan</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware.png" rel="attachment wp-att-806"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-806" src="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware.png" alt="Mutual-firmware" width="849" height="506" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware.png 849w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware-600x358.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware-300x179.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/Mutual-firmware-768x458.png 768w" sizes="auto, (max-width: 849px) 100vw, 849px" /></a></p>
<p>That is all there is to making it work.</p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;145MutualCap&#8221;.  This project is called &#8220;MutualCapButtons-145&#8221;.</p>
<p>In the next post Ill talk in detail about using the Capsense Tuner to understand the Capsense performance.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-csx-mutual-capsense-buttons-part-1/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s &#038; The SmartIO &#8211; Part 1</title>
		<link>https://iotexpert.com/psoc4000s-the-smartio-part-1/</link>
					<comments>https://iotexpert.com/psoc4000s-the-smartio-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Tue, 08 Mar 2016 15:42:45 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[SmartIO]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=748</guid>

					<description><![CDATA[In the previous four posts I talked about building an IOT device using the new CY8CKIT145.  You might remember from the first post that my original objective in picking up the board was to try a new feature of PSoC Creator.  Well, over the last few days I have been trying out that feature. Actually, it isn&#8217;t [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/" target="_blank">previous</a> four posts I talked about building an IOT device using the new CY8CKIT145.  You might remember from the first post that my original objective in picking up the board was to try a new feature of PSoC Creator.  Well, over the last few days I have been trying out that feature. Actually, it isn&#8217;t a feature of the software, it is a feature of some of the new chips called the Smart IO.  The Smart IO is a programmable logic bock that sits between the High Speed IO Matrix (HSIOM) of the chip and the Input/Output Port.  The HSIOM has all of the peripherals (SCB, TCPWM etc) of the chips attached to it.  The Smart IO will allow you to take signals from inside or outside of the chip, perform logic functions on them, and then drive those signals into or out of the chip.  Some of examples of why you might want to do this include:</p>
<ul>
<li>Combining several inputs (from the outside) to trigger an interrupt</li>
<li>Inverting a signal entering the chip</li>
<li>Inverting a signal exiting the chip</li>
<li>Remapping an input from one pin to a different input (e.g. flipping Tx, Rx pins)</li>
<li>Buffering one signal into multiple output pins (to increase the drive strength)</li>
</ul>
<p>As usual with Cypress programmable logic, you can do a jaw dropping number of clever things.  This block includes sequential logic as well as combinational logic, so it is possible to make state machines in the fabric.  It also includes more surprises which have not been shown yet.</p>
<p>The Smart IO works the same as other peripheral blocks, you start by dragging the component onto the schematic and double clicking to start the customizer.</p>
<p>When you start the customizer you get the screen below.  The first thing to decide is which Port is going to use the Smart IO.  The Smart IO completely takes over an entire port.  On this chip there are two Smart IOs, one on Port 2 and one on Port 3.   When you look at the customizer there are some things to notice:</p>
<ul>
<li>On the right side of the customizer you can see the 8 GPIO pins.  The dropdown menus that are currently labeled &#8220;Bypass&#8221; allow you to select the mode of the pin (Bypass, Input, Output, None).</li>
<li>On the bottom of the customizer you can see the 8 LUTs and select their inputs.</li>
<li>On the left side of the customizer you can see the the 8 connections to/from the HSIOM.  The drop down menu that is currently labeled &#8220;Bypass&#8221; allows you to select the mode of that connection to the HSIOM (Bypass, Input, Output, None).   I will talk about the &#8220;Undefined&#8221; menu in the with the next picture</li>
<li>In the middle of the customizer is the routing matrix.  Horizontally on the routing matrix there are 8 groups of three wires.  The top wire in each group is a wire that originates with the GPIO.  The middle wire originates from the corresponding LUT.  The bottom wire originates from the HSIOM.  For example the top three wires in the picture are
<ul>
<li>Line 1: from GPIO7</li>
<li>Line 2: from LUT 7</li>
<li>Line 3: from Data7</li>
</ul>
</li>
<li>You can &#8220;make&#8221; the connection by either by clicking the solder dot or by choosing from the coresponding drop down menu (more on that below)</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio.png" rel="attachment wp-att-752"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-752" src="https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio-1024x686.png" alt="basicsmartio" width="1024" height="686" srcset="https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio-1024x686.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio-600x402.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio-768x514.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/basicsmartio.png 1027w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The other menu on the HSIOM side of the customizer says &#8220;Undefined&#8221;.  This menu has a list of each fixed function device and the inputs/outputs of that device that can be connected to that input/output.  This menu doesn&#8217;t actually change anything in your design, it is only for information.  For example you can see in the screen shot below that  data4 can connect to:</p>
<ul>
<li>TCPWM0: Line_Out</li>
<li>LCD0: COM[20]</li>
<li>LCD0: SEG[20]</li>
<li>SCB1: Spi Select[1]</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect.png" rel="attachment wp-att-756"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-756" src="https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect-1024x684.png" alt="smartio-dataselect" width="1024" height="684" srcset="https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect-1024x684.png 1024w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect-600x401.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect-300x200.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect-768x513.png 768w, https://iotexpert.com/wp-content/uploads/2016/03/smartio-dataselect.png 1029w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The best way to show you how all this works is with an example.  One of the frustrating things for me in the PSoC 4 Family has always been that the fixed function blocks (TCPWM, SCB) are only allowed to connect to a few pins on the chip.  This can be a bit of a pain if you have a board that is already wired and you need to remap a pin.  Take for example, on the Cy8CKIT-145 the user LED on the main board is connected to P2[5].  If I want to drive that LED with the Line out (instead of the Line_Out_N) I would create a schematic like this:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/BlueLEDSchematic.png" rel="attachment wp-att-758"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-758" src="https://iotexpert.com/wp-content/uploads/2016/03/BlueLEDSchematic.png" alt="BlueLEDSchematic" width="534" height="377" srcset="https://iotexpert.com/wp-content/uploads/2016/03/BlueLEDSchematic.png 534w, https://iotexpert.com/wp-content/uploads/2016/03/BlueLEDSchematic-300x212.png 300w" sizes="auto, (max-width: 534px) 100vw, 534px" /></a></p>
<p>When I go to the DWR to assign the pins I would see that the BlueLED cannot be attached to P2[5].  You can see all of the legal placements of that pin because they are highlighted in green.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment.png" rel="attachment wp-att-759"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-759" src="https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment.png" alt="blueledpinassignment" width="992" height="240" srcset="https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment.png 992w, https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment-600x145.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment-300x73.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/blueledpinassignment-768x186.png 768w" sizes="auto, (max-width: 992px) 100vw, 992px" /></a></p>
<p>If I try to do it anyway, I will get the following error when I build.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/pwm_error.png" rel="attachment wp-att-757"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-757" src="https://iotexpert.com/wp-content/uploads/2016/03/pwm_error.png" alt="pwm_error" width="773" height="714" srcset="https://iotexpert.com/wp-content/uploads/2016/03/pwm_error.png 773w, https://iotexpert.com/wp-content/uploads/2016/03/pwm_error-600x554.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/pwm_error-300x277.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/pwm_error-768x709.png 768w" sizes="auto, (max-width: 773px) 100vw, 773px" /></a></p>
<p>This error says that I cannot connect the &#8220;line&#8221; output of the TCPWM to P2[5] (the pin with the LED).  That sucks.  But, with the Smart IO, I can &#8220;remap&#8221; the TCPWM Line output to P2[5].  To do this, I will start with a by adding a SmartIO to my schematic and configuring it.</p>
<ol>
<li>Select Port 2</li>
<li>Configure GPIO 5 to &#8220;Output&#8221;.  This can be done by either clicking on the &#8220;solder dot&#8221; or by selecting output from the drop down menu</li>
<li>Select data 4 as &#8220;Input&#8221;</li>
<li>Select data 4 as &#8220;TCPWM[0].line.  Remember that this is ONLY for your information and doesn&#8217;t actually change anything in the project.</li>
<li>Select the 3 inputs to LUT5 to be the data4 line which can be done from the three drop down menus or by clicking the three corresponding solder dots.</li>
</ol>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM.png" rel="attachment wp-att-761"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-761" src="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM.png" alt="Screen Shot 2016-03-06 at 9.53.10 AM" width="1022" height="686" srcset="https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM.png 1022w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM-600x403.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-06-at-9.53.10-AM-768x516.png 768w" sizes="auto, (max-width: 1022px) 100vw, 1022px" /></a>Next, I configure the LUT to &#8220;passthrough&#8221; by setting up 000 = 0 and 111=1 (which are the only two possible combinations as the three inputs are tied together).  You change the &#8220;Out&#8221;s from 0-&gt;1 and 1-&gt;0 by clicking on it.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/LUT5.png" rel="attachment wp-att-762"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-762" src="https://iotexpert.com/wp-content/uploads/2016/03/LUT5.png" alt="LUT5" width="611" height="444" srcset="https://iotexpert.com/wp-content/uploads/2016/03/LUT5.png 611w, https://iotexpert.com/wp-content/uploads/2016/03/LUT5-600x436.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/LUT5-300x218.png 300w" sizes="auto, (max-width: 611px) 100vw, 611px" /></a></p>
<p>Then I will re-wire up the schematic to look like this:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio.png" rel="attachment wp-att-764"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-764" src="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio.png" alt="blue-led-schematic-smartio" width="636" height="328" srcset="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio.png 636w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio-600x309.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio-300x155.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-schematic-smartio-348x180.png 348w" sizes="auto, (max-width: 636px) 100vw, 636px" /></a></p>
<p>The firmware is trivial,  just start the PWM and the SmartIO</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware.png" rel="attachment wp-att-766"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-766" src="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware.png" alt="blue-led-firmware" width="879" height="316" srcset="https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware.png 879w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware-600x216.png 600w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware-300x108.png 300w, https://iotexpert.com/wp-content/uploads/2016/03/blue-led-firmware-768x276.png 768w" sizes="auto, (max-width: 879px) 100vw, 879px" /></a></p>
<p>When I program the kit the blue LED starts blinking.  Cool.</p>
<p>In the <a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/">next posts</a> I will teach you how to use some other configurations of the Smart IO and how to use the CapSense block to create inputs for the Smart IO.</p>
<p>You can find this PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;SmartIO&#8221;.  This project is called &#8220;SimpleSmartIO&#8221;.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/03/08/psoc4000s-the-smartio-part-1/" target="_blank">PSoC4000s &amp; The SmartIO – Part 1</a></td>
<td > An introduction to the SmartIO and first project</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/10/psoc4000s-csx-mutual-capsense-buttons-part-1/" target="_blank">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 1</a></td>
<td > Using mutual capacitance</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/12/psoc4000s-csx-mutual-capsense-buttons-part-2/">PSoC4000s &amp; CSX Mutual CapSense Buttons Part 2</a></td>
<td > Using the CapSense tuner</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/14/psoc4000s-the-smartio-part-2/" target="_blank">PSoC4000s &amp; The SmartIO – Part 2</a></td>
<td > A 3 input XOR logic gate</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/16/psoc4000s-the-smartio-part-3/">PSoC4000s &amp; The SmartIO – Part 3</a></td>
<td > A 3 bit up counter state machine</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/19/psoc4000s-the-smartio-part-4/">PSoC4000s &amp; The SmartIO – Part 4</a></td>
<td > Using an external clock with the Smart IO</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/20/psoc4000s-the-smartio-part-5/">PSoC4000s &amp; The SmartIO – Part 5</a></td>
<td > Triggering an interrupt</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-the-smartio-part-1/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s and the CY8CKIT145 Stamp Board &#8211; Part 4</title>
		<link>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/</link>
					<comments>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Sat, 05 Mar 2016 13:02:08 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=649</guid>

					<description><![CDATA[OK.  We&#8217;re ready for the big moment: the user test.  I was feeling pretty cool.  I had spent the week talking to 100s of people and putting on a pretty good show.  I was the master of all things PSoC, a geek rockstar.  So I programmed the firmware.  The slider worked.  I was able to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>OK.  We&#8217;re ready for the big moment: the user test.  I was feeling pretty cool.  I had spent the week talking to 100s of people and putting on a pretty good show.  I was the master of all things PSoC, a geek rockstar.  So I programmed the firmware.  The slider worked.  I was able to connect to the PRoC BLE from my app.  But for some stupid reason the the PSoC and PRoC just were not talking and I had no idea why.  And to make matters worse, I didn&#8217;t have anything I could (easily) use to debug the problem.   So much for being the king of PSoC.  I assumed that I had firmware bugs. I tried a bunch of different things, single stepping code, trying different pins, etc.  But nothing worked.  I couldn&#8217;t figure it out.  It was intensely frustrating to be stuck on the airplane with a broken design.</p>
<p>As soon as I landed in Detroit, I logged in to get my email.  I looked for messages from Rajesh (the PSoC Kit Manager) and sure enough, he had emailed me the missing schematic.  After digging through the schematic, I found the error.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/schematic-resistors.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-652" src="https://iotexpert.com/wp-content/uploads/2016/02/schematic-resistors.png" alt="schematic-resistors" width="260" height="198" /></a></p>
<p>The connection between the PRoC and PSoC had a 0 Ohm resistor that was &#8220;No Load,&#8221; meaning the footprint was there, but the board manufacturer had not put on the resistor.  This was done so that the pin could be used as a GPIO for something else.</p>
<p>Here is a zoomed-in picture of the PCB:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/missing-resistors.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-651" src="https://iotexpert.com/wp-content/uploads/2016/02/missing-resistors.png" alt="missing-resistors" width="145" height="136" /></a></p>
<p>The good news was, I was only one plane ride and an hour drive from my soldering iron.  As soon as I walked in the door, I went straight to my lab.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/fixed-resistors.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-653" src="https://iotexpert.com/wp-content/uploads/2016/02/fixed-resistors.png" alt="fixed-resistors" width="225" height="170" /></a></p>
<p>Now everything works.</p>
<p>There are two morals to this story:</p>
<ol>
<li>Don&#8217;t go to immediately to your lab after being gone for a week, as it really irritates your wife.</li>
<li>Look closely at the schematic.</li>
</ol>
<p>You can find the PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;capsenseble-145.&#8221;</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 1</a></td>
<td > The board and schematics</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/01/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 2</a></td>
<td > PSoC4000S Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/02/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 3</a></td>
<td > PRoC BLE Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/05/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 4</a></td>
<td > Debugging the problem</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s and the CY8CKIT145 Stamp Board &#8211; Part 3</title>
		<link>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/</link>
					<comments>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 02 Mar 2016 13:01:25 +0000</pubDate>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=638</guid>

					<description><![CDATA[In this post, I will take you through the PRoC BLE schematic and firmware.  I describe a very similar version to this in great detail in the video you can find on the Cypress Video Training website. First, I create a new project in my workspace called &#8220;145capsenseled-ble.&#8221;  Then, I add the UART component (the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post, I will take you through the PRoC BLE schematic and firmware.  I describe a very similar version to this in great detail in the video you can find on the <a href="http://www.cypress.com/products/how-make-ios-app-control-robot-using-bluetooth-low-energy-ble" target="_blank">Cypress Video Training website</a>.</p>
<p>First, I create a new project in my workspace called &#8220;145capsenseled-ble.&#8221;  Then, I add the UART component (the SCB version) and the BLE component.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/schematic.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-647" src="https://iotexpert.com/wp-content/uploads/2016/02/schematic.png" alt="schematic" width="358" height="269" srcset="https://iotexpert.com/wp-content/uploads/2016/02/schematic.png 358w, https://iotexpert.com/wp-content/uploads/2016/02/schematic-300x225.png 300w" sizes="auto, (max-width: 358px) 100vw, 358px" /></a></p>
<p>Next, I configure the component to be a GATT server with a custom profile and a GAP client.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/overall-profile.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-640" src="https://iotexpert.com/wp-content/uploads/2016/02/overall-profile.png" alt="overall-profile" width="727" height="693" srcset="https://iotexpert.com/wp-content/uploads/2016/02/overall-profile.png 727w, https://iotexpert.com/wp-content/uploads/2016/02/overall-profile-600x572.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/overall-profile-300x286.png 300w" sizes="auto, (max-width: 727px) 100vw, 727px" /></a></p>
<p>Then I create a custom service with two characteristics:</p>
<ul>
<li>The &#8220;led&#8221; characteristic, which is set up as a uint8 that is writeable and readable.</li>
<li>The &#8220;capsense&#8221; characteristic, which is set up as uint16 that is readable and has a &#8220;notify.&#8221;</li>
</ul>
<p>Next, I configure the UUIDs of the service and characteristics to match what is hard-coded in the iOS app.  Then, I add &#8220;Client User Descriptions&#8221; that describe the characteristics in plain text.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/gatt-settings.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-641" src="https://iotexpert.com/wp-content/uploads/2016/02/gatt-settings.png" alt="gatt-settings" width="727" height="694" srcset="https://iotexpert.com/wp-content/uploads/2016/02/gatt-settings.png 727w, https://iotexpert.com/wp-content/uploads/2016/02/gatt-settings-600x573.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/gatt-settings-300x286.png 300w" sizes="auto, (max-width: 727px) 100vw, 727px" /></a></p>
<p>Next I configure the GAP settings, specifically the advertising packet.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/advertising-packet.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-639" src="https://iotexpert.com/wp-content/uploads/2016/02/advertising-packet.png" alt="advertising-packet" width="726" height="693" srcset="https://iotexpert.com/wp-content/uploads/2016/02/advertising-packet.png 726w, https://iotexpert.com/wp-content/uploads/2016/02/advertising-packet-600x573.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/advertising-packet-300x286.png 300w" sizes="auto, (max-width: 726px) 100vw, 726px" /></a></p>
<p>I make the pin I assignments, which is just the UART Rx and Tx lines.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/dwr-pin-assignment.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-646" src="https://iotexpert.com/wp-content/uploads/2016/02/dwr-pin-assignment.png" alt="dwr-pin-assignment" width="980" height="596" srcset="https://iotexpert.com/wp-content/uploads/2016/02/dwr-pin-assignment.png 980w, https://iotexpert.com/wp-content/uploads/2016/02/dwr-pin-assignment-600x365.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/dwr-pin-assignment-300x182.png 300w" sizes="auto, (max-width: 980px) 100vw, 980px" /></a></p>
<p>Finally, I write the firmware.  I started with main.  In the infinite loop (line 116), if I have received a byte from other side, then I assign it to the global variable &#8220;fingerPos&#8221; (line 118). Next, call updateCapsense() (line 119), to update the GATT database with the new value of the slider.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/main.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-645" src="https://iotexpert.com/wp-content/uploads/2016/02/main.png" alt="main" width="840" height="502" srcset="https://iotexpert.com/wp-content/uploads/2016/02/main.png 840w, https://iotexpert.com/wp-content/uploads/2016/02/main-600x359.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/main-300x179.png 300w" sizes="auto, (max-width: 840px) 100vw, 840px" /></a></p>
<p>The updateCapsense function:</p>
<p>Lines 31/32 If there is no connection, then don&#8217;t update the GATT database.</p>
<p>Lines 33-39 Update the GATT database with the current fingerPosition.</p>
<p>Lines 42-43 If the iPhone side has asked for notification and the position has changed, then send a notification.</p>
<p>Line 44 Save the last position.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/update-capsense.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-642" src="https://iotexpert.com/wp-content/uploads/2016/02/update-capsense-1024x382.png" alt="update-capsense" width="1024" height="382" srcset="https://iotexpert.com/wp-content/uploads/2016/02/update-capsense-1024x382.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/update-capsense-600x224.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/update-capsense-300x112.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/update-capsense.png 1115w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The BleCallBack is the most complicated section of firmware.  It uses a &#8220;switch&#8221; statement to handle the different event &#8220;cases.&#8221; The cases are:</p>
<ul>
<li>CYBLE_EVT_STACK_ON &amp; CYBLE_EVT_GAP_DEVICE_DISCONNECTED:  In either of these cases you want to start the advertising function.</li>
<li>CYBLE_EVT_GATT_CONNECT_IND: When there is a connection made, update the GATT database with the current state of the CapSense and the LED.  This allows the iOS side to read the correct values.</li>
<li>CYBLE_EVT_WRITE_REQ: There are two kinds of write requests that are valid.
<ul>
<li>CYBLE_LED_CAPSENSE_LED_CHAR_HANDLE:  If the remote side writes into the LED value, then send that data to the PSoC4000S via the UART.</li>
<li>CYBLE_LEDCAPSENSE_CAPSENSE_CAPSENSECCCD: If the remote side has been asked to notify (or un-notify), then save that in the global variable capsenseNotify.</li>
</ul>
</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/ble-callback.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-644" src="https://iotexpert.com/wp-content/uploads/2016/02/ble-callback-1024x685.png" alt="ble-callback" width="1024" height="685" srcset="https://iotexpert.com/wp-content/uploads/2016/02/ble-callback-1024x685.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/ble-callback-600x401.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/ble-callback-300x201.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/ble-callback.png 1639w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>That is all of the firmware.</p>
<p>In the next post, I&#8217;ll take you through the debugging I had to do.</p>
<p>You can find the PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;capsenseble-145.&#8221;</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 1</a></td>
<td > The board and schematics</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/01/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 2</a></td>
<td > PSoC4000S Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/02/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 3</a></td>
<td > PRoC BLE Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/05/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 4</a></td>
<td > Debugging the problem</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s and the CY8CKIT145 Stamp Board &#8211; Part 2</title>
		<link>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/</link>
					<comments>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Tue, 01 Mar 2016 15:47:41 +0000</pubDate>
				<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[Capsense]]></category>
		<category><![CDATA[PSoC]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=617</guid>

					<description><![CDATA[In the previous post, I unboxed the CY8CKIT145 and showed you the schematics.   In this post, I will show you how to build the CapSense firmware that runs on the PSoC4000S.  The first decision I needed to make was how to connect the PSoC and the PRoC chips.  So I looked at the back [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/">previous post</a>, I unboxed the CY8CKIT145 and showed you the schematics.   In this post, I will show you how to build the CapSense firmware that runs on the PSoC4000S.  The first decision I needed to make was how to connect the PSoC and the PRoC chips.  So I looked at the back of the kit and there was a handy-dandy picture of the schematic in the silkscreen.  Here is a zoomed in view:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/zoom-145.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-625" src="https://iotexpert.com/wp-content/uploads/2016/02/zoom-145.png" alt="zoom-145" width="233" height="206" /></a></p>
<p>I didn&#8217;t have the schematic on the airplane, but here is a more &#8220;schematic&#8221; view of the chips on the board.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-623" src="https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c-1024x701.png" alt="systemschematic-c" width="1024" height="701" srcset="https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c-1024x701.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c-600x410.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c-300x205.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/systemschematic-c.png 1067w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>I knew that the UART source code would be slightly easier, so I picked that as the mechanism to connect the chips.  On my computer I had the &#8220;capsenseled&#8221; workspace from the videos.  So, I created a new PSoC4000S project in that workspace called &#8220;145capsenseled.&#8221;  I started with the schematic:</p>
<ol>
<li>Add the new CapSense component.  I am currently running a &#8220;nightly build&#8221; of PSoC Creator 3.3 that supports the new chip.  You can see in the PSoC Creator release I&#8217;m using there is a prototype version of the CapSense component.</li>
<li>Add 5 Digital Output Pins under software control to drive the LEDs that are next to the slider</li>
<li>Add 1 Digital Output pin to drive the blue LED</li>
<li>Add a Serial Communication Block (SCB) configured as a UART</li>
</ol>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-schematic.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-627" src="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-schematic.png" alt="capsenseled-schematic" width="456" height="464" srcset="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-schematic.png 456w, https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-schematic-295x300.png 295w" sizes="auto, (max-width: 456px) 100vw, 456px" /></a></p>
<p>Here is a screenshot of the new CapSense component configuration wizard.  You can see I added a linear slider and set up the component to use SmartSense full-auto tuning.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/capsense-configuration.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-631" src="https://iotexpert.com/wp-content/uploads/2016/02/capsense-configuration.png" alt="capsense-configuration" width="639" height="483" srcset="https://iotexpert.com/wp-content/uploads/2016/02/capsense-configuration.png 639w, https://iotexpert.com/wp-content/uploads/2016/02/capsense-configuration-600x454.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/capsense-configuration-300x227.png 300w" sizes="auto, (max-width: 639px) 100vw, 639px" /></a></p>
<p>After configuring the CapSense, I set up the pin assignments using the DWR:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-pinassignment1.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-632" src="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-pinassignment1.png" alt="capsenseled-pinassignment" width="921" height="365" srcset="https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-pinassignment1.png 921w, https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-pinassignment1-600x238.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/capsenseled-pinassignment1-300x119.png 300w" sizes="auto, (max-width: 921px) 100vw, 921px" /></a></p>
<p>Then I wrote the firmware, which was pretty straight forward.</p>
<ul>
<li>10-11 start the CapSense</li>
<li>12 start the UART</li>
<li>16: If the CapSense block is done scanning and is idle, then read the CapSense and do something with it (lines 17 -&gt; 41).</li>
<li>18: figure out where the person is touching</li>
<li>19: if they have actually touched the block</li>
<li>22-26 light up the LEDs</li>
<li>30-35 If there is no touch, then turn off the LEDs.</li>
<li>36-37 start the next scan</li>
<li>38-39: If the UART is not busy&#8230; then send the position (0-100) or (0xFF if there is no touch).</li>
<li>41-42: If there is a byte in the UART receive buffer, then light up or turn off the Blue LED. (Notice that the LED is active low so I use the &#8220;!&#8221; operation to flip the state of the signal.</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/capsense-firmware.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-633" src="https://iotexpert.com/wp-content/uploads/2016/02/capsense-firmware.png" alt="capsense-firmware" width="952" height="898" srcset="https://iotexpert.com/wp-content/uploads/2016/02/capsense-firmware.png 952w, https://iotexpert.com/wp-content/uploads/2016/02/capsense-firmware-600x566.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/capsense-firmware-300x283.png 300w" sizes="auto, (max-width: 952px) 100vw, 952px" /></a></p>
<p>After that, I programmed the kit and tested it.  It seemed like everything was good.  In the <a href="https://iotexpert.com/2016/03/02/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/" target="_blank">next post</a>, I&#8217;ll show you the schematic and firmware that runs on the PRoC BLE.</p>
<p>You can find the PSoC Creator workspace on <a href="https://github.com/iotexpert/CY8CKIT-145-Examples" target="_blank">github</a> in the directory called &#8220;capsenseble-145.&#8221;</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 1</a></td>
<td > The board and schematics</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/01/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 2</a></td>
<td > PSoC4000S Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/02/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 3</a></td>
<td > PRoC BLE Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/05/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 4</a></td>
<td > Debugging the problem</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC4000s and the CY8CKIT145 Stamp Board &#8211; Part 1</title>
		<link>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/</link>
					<comments>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Mon, 29 Feb 2016 10:00:35 +0000</pubDate>
				<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[Cy8CKIT-145]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[Capsense]]></category>
		<category><![CDATA[PSoC]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=581</guid>

					<description><![CDATA[One of the cool things about my job is I get to try out lots of new development kits before they are released to the general public.  In the previous post I talked about the demonstration I gave at the Embedded World conference using the CY8CKIT-042 BLE.  You can find a complete video tutorial for that [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>One of the cool things about my job is I get to try out lots of new development kits before they are released to the general public.  In the <a href="https://iotexpert.com/2016/02/28/embedded-world-2016/" target="_blank">previous post</a> I talked about the demonstration I gave at the Embedded World conference using the CY8CKIT-042 BLE.  You can find a complete video tutorial for that project on the cypress.com <a href="http://www.cypress.com/products/how-make-ios-app-control-robot-using-bluetooth-low-energy-ble" target="_blank">video tutorial</a> website.  While I was at the conference, I picked up an engineering sample of a new development kit and put it into my backpack because I wanted to try a new feature of PSoC Creator on the way home.  But, when I got on the airplane, I thought I would build the same project I had demonstrated at the conference using this kit.  So, in the next few posts, I am going to show you the new CY8CKIT145 Stamp Board and how to build an IOT solution with it.</p>
<p>It is called a &#8220;stamp board&#8221; because it comes in a flat postage stamp-like postcard mailer.  Here is a picture of the front and the back (you can see that it has already lived a hard life riding around in my backpack).</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2720.jpg"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-585" src="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2720-1024x768.jpg" alt="IMG_2720" width="1024" height="768" srcset="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2720-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2720-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2720-300x225.jpg 300w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Here is the back of the mailer:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2722.jpg"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-584" src="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2722-1024x768.jpg" alt="IMG_2722" width="1024" height="768" srcset="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2722-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2722-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2722-300x225.jpg 300w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>In the picture you can see the yellow label proclaiming this to be an engineering sample.  It doesn&#8217;t seem like much, but when you pull back the front of the package you get to see the surprise:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2721-1.jpg"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-586" src="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2721-1-1024x768.jpg" alt="IMG_2721-1" width="1024" height="768" srcset="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2721-1-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2721-1-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2721-1-300x225.jpg 300w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The kit can literally be broken into four separate pieces:</p>
<ol>
<li>The main board:
<ul>
<li>The <a href="http://www.cypress.com/products/32-bit-arm-cortex-m0-psoc-4-s-series" target="_blank">PSoC4000S</a></li>
<li>A reset switch</li>
<li>A user LED</li>
<li>A user push button</li>
<li>A programming selector (to pick either the PSoC4000s or the PRoC BLE (that is on the back of the kit)) as the target of the programmer</li>
<li>All of the PSoC4000S pins are available on the 100mil center headers</li>
<li>A PCB footprint for a 10-pin ARM programming header</li>
</ul>
</li>
<li>A programmer board:
<ul>
<li>A PSoC5LP programmed with KitProg2 Firmware</li>
<li>A programmer mode button</li>
<li>100mil center header with some of the PSoC5LP pins</li>
</ul>
</li>
<li>A Capsense slider user interface board with a 5 Segment Slider and 5 LEDs</li>
<li>A Capsense button user interface board with 3 mutual capacitance buttons and 3 LEDs</li>
</ol>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/145front-e.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-615" src="https://iotexpert.com/wp-content/uploads/2016/02/145front-e-1024x764.png" alt="145front-e" width="1024" height="764" srcset="https://iotexpert.com/wp-content/uploads/2016/02/145front-e-1024x764.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/145front-e-600x448.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/145front-e-300x224.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/145front-e.png 1508w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>And the back, with the tiny 10mm X 10mm PRoC BLE module:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2706.jpg"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-588" src="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2706-1024x768.jpg" alt="IMG_2706" width="1024" height="768" srcset="https://iotexpert.com/wp-content/uploads/2016/02/IMG_2706-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2016/02/IMG_2706-300x225.jpg 300w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Here is the schematic for the board:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-606" src="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1-1024x791.png" alt="CY8CKIT-145_PSOC_4A-S1-page1" width="1024" height="791" srcset="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1-1024x791.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1-600x464.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1-300x232.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page1.png 1650w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-608" src="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2-1024x791.png" alt="CY8CKIT-145_PSOC_4A-S1 page 2" width="1024" height="791" srcset="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2-1024x791.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2-600x464.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2-300x232.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page-2.png 1650w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-609" src="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3-1024x791.png" alt="CY8CKIT-145_PSOC_4A-S1-page3" width="1024" height="791" srcset="https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3-1024x791.png 1024w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3-600x464.png 600w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3-300x232.png 300w, https://iotexpert.com/wp-content/uploads/2016/02/CY8CKIT-145_PSOC_4A-S1-page3.png 1650w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>I wanted to build a project that would have two-way communication between my iPhone and the board, and would be compatible with the Swift App I had written.  The user of the board would have a capsense slider (and LEDs) of which the iPhone App could read the position.  In addition, it would have an LED that the iOS app could turn on and off.  Here is a demonstration that I filmed with my iPhone on the airplane:</p>

<a href='https://iotexpert.com/wp-content/uploads/2016/02/IMG_2708.mov'>145 Demo Video</a>

<p>In the <a href="https://iotexpert.com/2016/03/01/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/">next post</a> I will describe the overall system and show you the firmware.</p>
<p><span><p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >Index</th>
<th >Description</th>
</tr>
</thead>
<tbody>
<tr><td ><a href="https://iotexpert.com/2016/02/29/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 1</a></td>
<td > The board and schematics</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/01/psoc4000s-and-the-cy8ckit145-stamp-board-part-2/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 2</a></td>
<td > PSoC4000S Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/02/psoc4000s-and-the-cy8ckit145-stamp-board-part-3/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 3</a></td>
<td > PRoC BLE Firmware</td>
</tr>

<tr><td ><a href="https://iotexpert.com/2016/03/05/psoc4000s-and-the-cy8ckit145-stamp-board-part-4/">PSoC4000s and the CY8CKIT145 Stamp Board - Part 4</a></td>
<td > Debugging the problem</td>
</tr>
</tbody></table></div></p></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc4000s-and-the-cy8ckit145-stamp-board-part-1/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
	</channel>
</rss>
