<?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>PSoC 4000S &#8211; IoT Expert</title>
	<atom:link href="https://iotexpert.com/category/devices/psoc-4000s/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>PSoC 4000S &#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>Serial Wire View with PSOC4</title>
		<link>https://iotexpert.com/serial-wire-view-with-psoc4/</link>
					<comments>https://iotexpert.com/serial-wire-view-with-psoc4/#respond</comments>
		
		<dc:creator><![CDATA[Darrin Vallis]]></dc:creator>
		<pubDate>Sat, 18 Nov 2017 01:17:08 +0000</pubDate>
				<category><![CDATA[CY8CKIT-042]]></category>
		<category><![CDATA[CY8CKIT-044]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Embedded Design]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC 4200]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[PSoC4 BLE]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=4707</guid>

					<description><![CDATA[I use PSOC4 to invent all kinds of unique solutions for customers. Usually, they want them field upgradeable to deploy new features or fix bugs. Fortunately Cypress has a great I2C boot loader to meet this need, so I use the heck out of it. Cypress has a great debugger built into PSOC Creator which [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I use PSOC4 to invent all kinds of unique solutions for customers. Usually, they want them field upgradeable to deploy new features or fix bugs. Fortunately Cypress has a great <a href="http://www.cypress.com/documentation/application-notes/an86526-psocr-4-and-psoc-analog-coprocessor-i2c-bootloader-zh">I2C boot loader</a> to meet this need, so I use the heck out of it.</p>
<p>Cypress has a great debugger built into <a href="http://www.cypress.com/products/psoc-creator-integrated-design-environment-ide">PSOC Creator</a> which fully supports all the ARM Serial Wire Debug protocols such as breakpoints, single step, memory, register viewing etc. However, when you are running a boot loader <em>the debugger does not work!</em> Why not? Because with a boot loader there are two applications resident in PSOC4: The boot loader and application. This is not supported by Cypress implementation of SWD.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/bootloader.jpg"><img loading="lazy" decoding="async" width="300" height="155" class="alignnone wp-image-4710 size-medium" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/bootloader-300x155.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/bootloader-300x155.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/bootloader-600x311.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/bootloader.jpg 653w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Where does this leave you, the intrepid code developer, when debugging a boot loader project? Personally, I have used all kinds of methods: debug UART interface, debug I2C interface, bang out states on pins, debug Bluetooth interface &#8230; and on and on. You get the idea. All these methods burn a communications interface and require extra pins on the chip. Sometimes that&#8217;s not possible.</p>
<p>The issue recently came to a head when a customer very nearly in production experienced a boot loader failure. One system out of a few thousand was &#8220;bricked&#8221; when they tried to field  update in the lab. Their pinout is frozen, they can&#8217;t add new hardware so how do we look inside PSOC4 and see what&#8217;s going on?</p>
<p>I woke up at 2 AM and thought &#8220;Ah Ha! SWV!&#8221; (Yes, I Am A Geek) Serial Wire View is an ARM native debug protocol that let&#8217;s you XRAY the insides of any ARM MCU <em>with the right interface</em>. SWV is a protocol which runs on the SWD pins (clock and data) but also needs the Serial Wire Output (SWO) pin. Cypress left the SWO pin and associated IP off of PSOC4 to save die cost, foiling my great idea. Brief interlude to drink and bang head on desk.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug.png"><img loading="lazy" decoding="async" width="300" height="222" class="aligncenter wp-image-4712 size-medium" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug-300x222.png" srcset="https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug-300x222.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug-600x443.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug-768x567.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug-1024x756.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/3272886-coresight-debug.png 1190w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Fortunately, I don&#8217;t give up easily. At least my subconscious does not. Woke up the next night thinking &#8220;Ah Ha!&#8221; again. Wife was mildly annoyed, but tolerates my idiosyncrasies.</p>
<p>Cypress has a nice software UART transmitter implementation. I shamelessly stole it, modified for my purposes and created a custom component. (It&#8217;s pretty easy to do this by the way) Baud rate was modified to 230 KBps and the output pin forced to a specific pin with a control file.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/dtview2.jpg"><img loading="lazy" decoding="async" width="767" height="301" class="alignnone wp-image-4717 size-full" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/dtview2.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/dtview2.jpg 767w, https://iotexpert.com/wp-content/uploads/2017/11/dtview2-600x235.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/dtview2-300x118.jpg 300w" sizes="auto, (max-width: 767px) 100vw, 767px" /></a></p>
<p>Once the component is in place, you can use its _DView_Printf( ) API call to display any debug data. Here is an example:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/code.jpg"><img loading="lazy" decoding="async" width="816" height="227" class="alignnone size-full wp-image-4723" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/code.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/code.jpg 816w, https://iotexpert.com/wp-content/uploads/2017/11/code-600x167.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/code-300x83.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/code-768x214.jpg 768w" sizes="auto, (max-width: 816px) 100vw, 816px" /></a></p>
<p>More about that output pin. Cypress sells a tool for programming and debugging PSOC called <a href="http://www.cypress.com/documentation/development-kitsboards/cy8ckit-002-psoc-miniprog3-program-and-debug-kit">CY8CKIT-002</a>, aka MiniProg3. The programming connector consists of VDD, GND, reset, SWD clock and SWD data as shown below.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Header.jpg"><img loading="lazy" decoding="async" width="300" height="192" class="alignnone size-medium wp-image-4719" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/Header-300x192.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Header-300x192.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/Header-600x384.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/Header-768x492.jpg 768w, https://iotexpert.com/wp-content/uploads/2017/11/Header.jpg 814w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Since we can&#8217;t use SWD protocol for debugging anyway, we can change the pins from SWD to normal GPIO. <em>The pins still function for programming</em>. By default they are in SWD mode as shown.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/SWD_Pins.jpg"><img loading="lazy" decoding="async" width="300" height="194" class="alignnone size-medium wp-image-4720" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/SWD_Pins-300x194.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/SWD_Pins-300x194.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/SWD_Pins.jpg 587w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Going to the system tab of the .CYDWR file, we can change them to GPIO.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/ChangeToGPIO.jpg"><img loading="lazy" decoding="async" width="634" height="258" class="alignnone wp-image-4721 size-full" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/ChangeToGPIO.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/ChangeToGPIO.jpg 634w, https://iotexpert.com/wp-content/uploads/2017/11/ChangeToGPIO-600x244.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/ChangeToGPIO-300x122.jpg 300w" sizes="auto, (max-width: 634px) 100vw, 634px" /></a></p>
<p>Once we do that, the pins look like this. Here&#8217;s the trick. We now assign the TX output of our DTView component to pin 3[2], which is available  on the SWD programming header, pin 5.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/TX-UART.jpg"><img loading="lazy" decoding="async" width="300" height="204" class="alignnone size-medium wp-image-4722" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/TX-UART-300x204.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/TX-UART-300x204.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/TX-UART.jpg 533w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Can you see where we are going with this? Printf( ) data is now coming out of PSOC4 on pin 3[2], easily accessible on our debug header. This is where MiniProg3 comes in. It can actually receive data as a 230 KBps RX UART on its XRES pin. Weird, right? By building a simple interface cable we can get the data from your debug header into MiniProg3.</p>
<p>MiniProg3 XRES &#8212;&#8212; SWD HEADER pin 5</p>
<p>MiniProg3   GND &#8212;&#8212; SWD HEADER pin 2</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/20171114_102729.jpg"><img loading="lazy" decoding="async" width="653" height="490" class="alignnone wp-image-4726 size-full" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/20171114_102729.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/20171114_102729.jpg 653w, https://iotexpert.com/wp-content/uploads/2017/11/20171114_102729-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/20171114_102729-300x225.jpg 300w" sizes="auto, (max-width: 653px) 100vw, 653px" /></a></p>
<p>However, MiniProg3 does not show up as a COM port on your PC, so how do we the data? It needs to be accessed by a host application running the PP_COM API. This is documented under <em>PSOC Programmer Component Object Model COM Interface Guide</em>, Cypress specification <span style="font-family: Arial;font-size: xx-small"></span>001-45209. If you installed PSOC Creator or Programmer, this document is actually on your PC under C:\Program Files (x86)\Cypress\Programmer\Documents. Engineers don&#8217;t like to read instructions. Amazing what you can find when you do.</p>
<p>I wrote a simple  console application which opens MiniProg3 using PP_COM, retrieves data from the serial RX pin via USB and displays it like a simple terminal program. Voila! You now have a serial debugger that works for any PSOC4 project using MiniProg3 as your USB to serial dongle.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput.jpg"><img loading="lazy" decoding="async" width="1024" height="388" class="alignnone size-large wp-image-4728" alt="" src="https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput-1024x388.jpg" srcset="https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput-1024x388.jpg 1024w, https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput-600x227.jpg 600w, https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput-300x114.jpg 300w, https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput-768x291.jpg 768w, https://iotexpert.com/wp-content/uploads/2017/11/DTViewOutput.jpg 1111w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Customer was really happy with this. We were able to immediately see his problem and fixed it in about 5 minutes.</p>
<p>Finally, here are all the source files</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/DTView-Firmware.zip">DTView Firmware</a> : PSOC Creator example project and DTView component</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/DTViewer-Setup.zip">DTViewer Binary</a> : Installer for DTViewer console</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/ViewerSource.zip">ViewerSource</a> : Complete source code for DTViewer console (Requires Visual Studio 2015)</p>
<p>That&#8217;s all. Have fun with the new debugging tool.</p>
<p>DTV</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/serial-wire-view-with-psoc4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PSoC 4 Flash Write</title>
		<link>https://iotexpert.com/psoc-4-flash-write/</link>
					<comments>https://iotexpert.com/psoc-4-flash-write/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Tue, 06 Jun 2017 10:00:38 +0000</pubDate>
				<category><![CDATA[CY8CKIT-044]]></category>
		<category><![CDATA[PSoC 4000S]]></category>
		<category><![CDATA[PSoC 4200]]></category>
		<category><![CDATA[PSoC4 BLE]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=3679</guid>

					<description><![CDATA[Summary Last week I got a question from a customer about how to write into the PSoC 4 Flash.  I sent him a fairly straight forward email message explaining the process in English&#8230; but after reflecting a little bit, I decided to write an example project as &#8220;C&#8217; is often much clearer.  And yes I know [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>Last week I got a question from a customer about how to write into the PSoC 4 Flash.  I sent him a fairly straight forward email message explaining the process in English&#8230; but after reflecting a little bit, I decided to write an example project as &#8220;C&#8217; is often much clearer.  And yes I know that this article it doesn&#8217;t have much to do with IoT, but hopefully it is helpful to someone.  In this article I will explain:</p>
<ul>
<li>The organization of the PSoC 4 Flash</li>
<li>The risks and issues of writing to the PSoC 4 Flash</li>
<li>A program that demonstrates reading and writing the PSoC 4 Flash</li>
<li>How to protect rows of the PSoC 4 Flash</li>
</ul>
<h1>Organization of the PSoC 4 Flash</h1>
<p>The PSoC 4 Flash is organized into an array that starts at memory address 0x00 and has 128 byte rows.  Different versions of the chip will have different numbers of rows and possibly two arrays (in the case of PSoC 4 BLE II).  The exact configuration of your part is knowable in the firmware by a set of #defines that are built for you by PSoC Creator.  Here is a snapshot from the PSoC 4 System Reference Guide Chapter 8.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM.png" alt="PSoC 4 Flash System Reference Guide" width="1912" height="684" class="alignnone wp-image-3691 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM.png 1912w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM-600x215.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM-300x107.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM-768x275.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.04.08-AM-1024x366.png 1024w" sizes="auto, (max-width: 1912px) 100vw, 1912px" /></a></p>
<p>You can use that information along with the System call CySysFlashWriteRow() to write into the flash of your device.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM.png" alt="PSoC 4 Flash Write API" width="1918" height="896" class="alignnone wp-image-3692 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM.png 1918w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM-600x280.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM-300x140.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM-768x359.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-8.29.15-AM-1024x478.png 1024w" sizes="auto, (max-width: 1918px) 100vw, 1918px" /></a></p>
<h1>Risks and Issues Writing the PSoC 4 Flash</h1>
<p>There are several risks that you must take into account when performing a PSoC 4 Flash write (or for that matter writing Flash in any other MCU).</p>
<ul>
<li>You must write a complete row at a time.  In PSoC 4 that is 128 bytes.  So, even if you want to write only 1 byte, you will need to read in all of the data surrounding that byte in the row and make sure you don&#8217;t overwrite something important.</li>
<li>You can easily write someplace bad and brick your part (e.g. if you overwrite your program, or exception vectors, or &#8230;).  You need to be very careful that you are writing in the correct place</li>
<li>It takes 20ms, which is a long time in the context of MCU speed, to write a row of flash and the MCU comes to a standstill while that is happening (all of the interrupts are off etc.)</li>
<li>The Flash will eventually wear out.  If you look at the data sheet for PSoC 4 you will find that the endurance of the Flash is 100K writes. If you are continually updating a place in the memory, you will eventually wear it out</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM.png" alt="PSoC 4 Datasheet" width="1924" height="574" class="alignnone wp-image-3681 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM.png 1924w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM-600x179.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM-300x90.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM-768x229.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-05-31-at-2.33.10-PM-1024x305.png 1024w" sizes="auto, (max-width: 1924px) 100vw, 1924px" /></a></p>
<h1>A PSoC 4 Flash Write Demo Project</h1>
<p>To demonstrate the process of a PSoC 4 Flash write I created a project that:</p>
<ul>
<li>Initializes a 128 byte array in the Flash (aligned to a complete row) with 0&#8217;s</li>
<li>Lets you read the Flash array into a RAM array by pressing a key on the keyboard</li>
<li>Lets you printout the values of the Flash array</li>
<li>Lets you printout the values of the RAM array</li>
<li>Lets you increment the values of the RAM array</li>
<li>Lets you write the RAM array into the Flash</li>
</ul>
<p>Normally when you declare a variable in C it will be assigned to the RAM somewhere (either on the Stack or in the Data or BSS section of the RAM).  In order to have my array be assigned to the Flash, I declare the array to be &#8220;const&#8221;.  The first time I did this I did not include the &#8220;={0}&#8221; in the declaration, and the compiler decided to put the array in the RAM, but when I initialized one of the elements it assigned it to the Flash.  The CY_ALIGN() macro tells the linker to put the start of the &#8220;row&#8221; array on a 128 byte boundary.  In other words completely aligning to a Flash row.</p>
<pre class="start-line:9 lang:c decode:true">// Allocate 1 row of flash... make it aligned to the row size
// and initializde it with 0's
// the const keeps it in the flash (not in the data segment)
const uint8_t row[CY_FLASH_SIZEOF_ROW] CY_ALIGN(CY_FLASH_SIZEOF_ROW) = {0};
</pre>
<p>At the start of main, I declare array called &#8220;data&#8221; which will reside in the RAM.  I will use this array as a buffer to read Flash data into, then change it, then write it back to the Flash.</p>
<p>We know that the Flash is arranged in rows of 128 bytes (well, actually rows of size CY_FLASH_SIZEOF_ROW).  To calculate the row number of the my array &#8220;row&#8221;, I use the Address of the row divided by the row size. (the CY_FLASH_BASE is 0x00 because the Flash starts at Address 0x00)</p>
<pre class="start-line:38 lang:c decode:true">    uint8_t data[CY_FLASH_SIZEOF_ROW];
    int rowNum;
    // calculate which row in the flash that the "row" array resides
    rowNum = ((int)row - CY_FLASH_BASE) / CY_FLASH_SIZEOF_ROW;
</pre>
<p>To make things a bit easier I create a function called &#8220;dump&#8221; which just prints the values of a &#8220;size &#8220;of memory in hex format.  The function just takes an address that you want to start dumping to the screen.</p>
<pre class="start-line:14 lang:c decode:true">// This function dumps a block of memory into rows of hex ...16 bytes long in hex
void dump(uint8_t *array, int size)
{
    int i,j;
    j=0;
    for(i=0;i&lt;size;i++)
    {
        dbgprintf("%2X ",array[i]);
        j=j+1;
        if(j==16) // 16 values per line
        {
            j = 0;
            dbgprintf("\n");
        }
    }
    UART_UartPutString("\n");
}
</pre>
<p>In order to test this whole thing I use a UART to read from the keyboard and display to the screen.  The main function is just a loop that reads keys and then does a big &#8220;switch&#8221;.</p>
<p>When you press &#8216;f&#8217; it dumps the Flash &#8220;row&#8221;</p>
<p>When you press &#8216;r&#8217; it copies the Flash &#8220;row&#8221; into the array &#8220;data&#8221; (which resides in the RAM)</p>
<p>When you press &#8216;i&#8217; it increments the values in the &#8220;data&#8221; array</p>
<p>When you press &#8220;R&#8221; it dumps out the values in the &#8220;data&#8221; array</p>
<p>When you press &#8216;q&#8217; it prints out information about the rowNumber, row size etc.</p>
<pre class="start-line:48 lang:c decode:true">   for(;;)
    {
        char c;
        c = UART_UartGetChar();
        switch(c)
        {
            case 'f':
                UART_UartPutString("Dumping Flash\n");
                dump((uint8_t *)row,CY_FLASH_SIZEOF_ROW);
                break;
            case 'r':
                UART_UartPutString("Reading Flash into RAM\n");
                memcpy(data,row,(int)CY_FLASH_SIZEOF_ROW);
            break;
                
            case 'i':
                UART_UartPutString("Incrementing RAM Array\n");
                data[0] = data[0] + 1;
                for(i=1;i&lt;(int)CY_FLASH_SIZEOF_ROW;i++)
                {
                    data[i] = data[i-1]+1;
                }
            break;
            case 'R':
                dbgprintf("Dumping RAM Array\n");
                dump(data,CY_FLASH_SIZEOF_ROW);
            break;    
               
            case 'q':
                dbgprintf("Row Number = %d\n",rowNum);
                dbgprintf("RowSize = %d\n",CY_FLASH_SIZEOF_ROW);
                dbgprintf("Flash Address = %X\n",CY_FLASH_BASE);
                dbgprintf("Row Address = %X\n",(unsigned int)row);
                dbgprintf("Data Address = %X\n",(unsigned int)data);
   
            break;
</pre>
<p>When you press &#8216;w&#8217;, it writes the &#8220;data&#8221; array into the &#8220;row&#8221; array in the Flash using the &#8220;CySysFlashWriteRow()&#8221; system call</p>
<pre class="start-line:85 lang:c decode:true">            case 'w':
                dbgprintf("Writing Flash from RAM Buffer\n");            
                rval = CySysFlashWriteRow(rowNum,data);
                if(rval == CY_SYS_FLASH_SUCCESS )
                {
                    dbgprintf("Flash Write Sucess\n");
                }
                else if (rval == CY_SYS_FLASH_INVALID_ADDR)
                {
                    dbgprintf("Flash Write Failed: Invalid Address\n");
                }
                else if (rval == CY_SYS_FLASH_PROTECTED)
                {
                    dbgprintf("Flash Write Failed: Flash Protected\n");
                }
                else {
                    dbgprintf("Flash Write Failed: Unknown\n");
                }
            break;
</pre>
<h1>Testing the Program</h1>
<p>After I program the device, I first press &#8220;q&#8221; to find out the information about the PSoC 4 Flash array.  You can see that my &#8220;row&#8221; is the 46th row in the Flash and resides at address 0x1700 (as I type this I wish that I hadn&#8217;t mixed decimal and hex &#8230; and that I had called my &#8220;row&#8221; variable something other than &#8220;row&#8221;).  You can also see that the rows are 128 bytes and that the Flash array starts at address 0x0.  All that is good.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM.png" alt="PSoC 4 Flash Write Demo" width="1324" height="832" class="alignnone wp-image-3689 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM.png 1324w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM-600x377.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM-300x189.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM-768x483.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.46.37-AM-1024x643.png 1024w" sizes="auto, (max-width: 1324px) 100vw, 1324px" /></a></p>
<p>When I press &#8216;f&#8217; to dump out the Flash array, you can see that my row has all 0&#8217;s in it.  Then I press &#8216;R&#8217; to dump out my RAM array and you can see that it has garbly-gook in it (which makes sense as I didn&#8217;t initialize the array)</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM.png" alt="PSoC 4 Flash Write Demo" width="1320" height="840" class="alignnone wp-image-3684 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM.png 1320w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM-600x382.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM-300x191.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM-768x489.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.17-AM-1024x652.png 1024w" sizes="auto, (max-width: 1320px) 100vw, 1320px" /></a></p>
<p>Next, I press &#8216;r&#8217; to copy the PSoC 4 Flash array into the RAM buffer.  Then I press &#8220;i&#8221; to increment the values in the RAM array, then I dump it out.  Lastly, I press &#8216;w&#8217; to write it to the PSoC 4 Flash.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM.png" alt="PSoC 4 Flash Write Demo" width="1324" height="828" class="alignnone wp-image-3685 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM.png 1324w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM-600x375.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM-300x188.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM-768x480.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.40.54-AM-1024x640.png 1024w" sizes="auto, (max-width: 1324px) 100vw, 1324px" /></a></p>
<p>Then I hit reset on the board and press &#8216;f&#8217; to printout the PSoC 4 Flash array.  And I see success, the values were retained in the PSoC 4 Flash even after resetting the device. (or for that matter power cycling it)</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM.png" alt="PSoC 4 Flash Write Demo" width="1316" height="836" class="alignnone wp-image-3686 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM.png 1316w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM-600x381.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM-300x191.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM-768x488.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.41.52-AM-1024x651.png 1024w" sizes="auto, (max-width: 1316px) 100vw, 1316px" /></a></p>
<h1>Protecting Rows of the PSoC 4 Flash</h1>
<p>One cool feature of the PSoC 4 Flash is that you can write protect it on a row by row basis.  Meaning that you can make it so that the PSoC 4 Flash writing hardware will not overwrite rows.  You do this by going to the &#8220;Flash Security&#8221; tab of the Design Wide Resources.  Then you have 1 box for each row in the flash where you can pick &#8220;W&#8221; for Full Protection and &#8220;U&#8221; for Writable.  In the screen show below you can see me changing the row &#8220;ox1700&#8221; to Write protection.  This is the row where my Flash array resides.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM.png" alt="PSoC 4 Flash Security" width="2054" height="1244" class="alignnone wp-image-3683 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM.png 2054w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM-600x363.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM-300x182.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM-768x465.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.30.29-AM-1024x620.png 1024w" sizes="auto, (max-width: 2054px) 100vw, 2054px" /></a></p>
<p>After reprogramming my device I try to press &#8216;w&#8217; and you can see that the Write fails.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM.png" alt="PSoC 4 Flash Write Fail" width="1314" height="840" class="alignnone wp-image-3688 size-full" srcset="https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM.png 1314w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM-600x384.png 600w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM-300x192.png 300w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM-768x491.png 768w, https://iotexpert.com/wp-content/uploads/2017/06/Screen-Shot-2017-06-03-at-7.45.26-AM-1024x655.png 1024w" sizes="auto, (max-width: 1314px) 100vw, 1314px" /></a></p>
<p>As always my projects are available on the <a href="https://github.com/iotexpert/PSoC4-Flash-Write-Example" target="_blank" rel="noopener noreferrer">IoT Expert GitHub</a> site git@github.com:iotexpert/PSoC4-Flash-Write-Example.git</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/psoc-4-flash-write/feed/</wfw:commentRss>
			<slash:comments>5</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>
