tag:blogger.com,1999:blog-21689926114514286622024-03-05T11:03:41.099-05:00MSP430 LaunchPadA blog about the MSP430 LaunchPad from Texas Instruments for both beginners and experts.NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.comBlogger45125tag:blogger.com,1999:blog-2168992611451428662.post-78990549513221111212014-04-01T11:46:00.000-04:002014-04-01T11:46:47.246-04:00Introducing the Bluetooth Low Energy (BLE) BoosterPackI would like to introduce the <a href="http://store.hardwarebreakout.com/index.php?route=product/product&product_id=65" target="_blank">Bluetooth Low Energy (BLE) BoosterPack</a> for the LaunchPad, built around the <a href="https://www.bluegiga.com/en-US/products/bluetooth-4.0-modules/ble112-bluetooth--smart-module/" target="_blank">BLE112</a> module from Blugiga. Lately, I have been too busy to post new material because I have been working on an easy to use BLE BoosterPack. I’m actually very proud of the result, and am finally ready to add the board to Hardware Breakout’s webstore. Be sure to check out the <a href="http://store.hardwarebreakout.com/download/User%20Guide%20V3_1%20Rev_A.pdf" target="_blank">User Guide</a> for detailed information on the board’s features and example code (<a href="https://github.com/HardwareBreakout/BluetoothLowEnergyBoosterPack" target="_blank">on GitHub</a>).<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/_eaG7m0CxFI" width="560"></iframe>
<b><br /></b>
<b>Bluetooth Low Energy</b><br />
<b><br /></b>
For those of you not familiar with BLE, it is a version of Bluetooth that was designed for ultra-low-power devices. While it has a reduced data rate, it is simpler to implement and consumes significantly less power. If you have a wireless project that needs to have the longest battery life possible, this is the BoosterPack for you!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSYa-q8tVY20MpTTscOdffWdMeCYI_Ah2Cyr1hjnOaqK0g2kobBnJCP_NV_EEKzsajR7ka8INITOFE3f2iH8frU0Mql9BaCl2toiy9Wuyu3Cw4f1S1xu7X4LutURnJjPhRqBr0IEQ9ThsW/s1600/Pinout+V3_0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSYa-q8tVY20MpTTscOdffWdMeCYI_Ah2Cyr1hjnOaqK0g2kobBnJCP_NV_EEKzsajR7ka8INITOFE3f2iH8frU0Mql9BaCl2toiy9Wuyu3Cw4f1S1xu7X4LutURnJjPhRqBr0IEQ9ThsW/s1600/Pinout+V3_0.png" height="235" width="400" /></a></div>
<br />
<br />
<b>Integrated Power Circuitry</b><br />
<br />
While the BoosterPack system is great for having multiple boards, I often wanted multiple boards combined into one. This is why I included all the power circuitry necessary, including a Lithium battery connector, on the BLE BoosterPack. After all, almost every project I have used BLE in was battery powered. Another reason for integrating the power circuitry is that a special high-efficiency switching regulator (<a href="http://www.ti.com/product/tps62730" target="_blank">TPS62730</a>) is needed in order to optimize power consumption.<br />
<br />
<b>The BLE112 Module</b><br />
<br />
The BLE112 module from Blugiga is great, it allows for custom firmware development and programming without expensive tools. You can even update the firmware via the on-board USB connector, or use the device as a BLE dongle for a PC. This BoosterPack can even act as a stand-alone system, since the BLE112 module contains almost all you need for a simple project.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh323_6SdKqY2MuczuG5MxUnrILHrCK3TPWmn8TK3vXtnhFTxmssDKMS9qZ5B4NJ5RhwyMJAQlukt_9qFWaPUZU2m8lqZTHT4bqjKfy1V7jc2W-RLjhkA2CTGirquY7RfoDdZATzuZxTlGO/s1600/BLE+Booster+01+V3_0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh323_6SdKqY2MuczuG5MxUnrILHrCK3TPWmn8TK3vXtnhFTxmssDKMS9qZ5B4NJ5RhwyMJAQlukt_9qFWaPUZU2m8lqZTHT4bqjKfy1V7jc2W-RLjhkA2CTGirquY7RfoDdZATzuZxTlGO/s1600/BLE+Booster+01+V3_0.jpg" height="179" width="320" /></a></div>
<br />
<b>Python and Android Example Code</b><br />
<br />
Having quality example code that can be easily modified for your own purposes is very important. I have release an open source Python module with example code and an Android application that allows you to easily get up and running with BLE. Stay tuned to the <a href="http://hardwarebreakout.com/" target="_blank">Hardware Breakout blog</a> for more information on the example <a href="https://github.com/HardwareBreakout/BluetoothLowEnergyBoosterPack" target="_blank">Android app and Python module</a> in the coming days.<br />
<br />
<b>Pre-order</b><br />
<br />
While the design is completely finished and verified, I have decided wait on shipping the first batch of orders till the end of May. This decision was made to keep costs down. The more orders I can group together during the initial assembly, the lower the overall prices will be.
Be sure to stop by the <a href="http://store.hardwarebreakout.com/index.php?route=product/product&product_id=65" target="_blank">Hardware Breakout Store</a> and pre-order one today!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://store.hardwarebreakout.com/index.php?route=product/product&product_id=65" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh67OfXh6fsi0_u5fr6Gnn6_ncnnkj02s9r2DzALadtBAE7gJuoHI1DUOG3RaOq4TM3a9VKncQV-hlp8pF6JzpEx0IgKWrszhO06sIOkZKSCNiDiK4spdYOmBdUFC5XvaSwDKI_2llAc9kK/s1600/Store-Header-00.png" height="63" width="400" /></a></div>
<br />NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com14tag:blogger.com,1999:blog-2168992611451428662.post-65426053358854092022013-07-09T14:08:00.003-04:002013-07-09T14:08:54.868-04:00Miniature MSP430 Programming ConnectorThe MSP430 is perfect for low-power and super miniature projects. Not only are smaller circuit boards <a href="http://oshpark.com/" target="_blank">cheaper to make</a>, but they are desirable in many applications; such as in wireless sensor nodes, wearable electronics, and others. Standard 0.1" headers are simply too big for very small boards. To reduce the size requirement for the programming header, I have started using 0.05" headers. With this post, I would like to share how I use smaller headers to easily make my projects smaller and more cost efficient.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxA2nuWFz9JafugCD0xfqj_0cXWL-DgIWPLw7AAMi6iHPQKlHwJUzMEphfLpRLHcgaEdHBIC6R1FlP39CNAiml8fGxrj7DU-acBbcNr7KJPvsQAmbzupuv7vPc7SbRXxObVATLF9sqS3l5/s1600/Programmer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxA2nuWFz9JafugCD0xfqj_0cXWL-DgIWPLw7AAMi6iHPQKlHwJUzMEphfLpRLHcgaEdHBIC6R1FlP39CNAiml8fGxrj7DU-acBbcNr7KJPvsQAmbzupuv7vPc7SbRXxObVATLF9sqS3l5/s400/Programmer.jpg" width="266" /></a></div>
<br />
<br />
Due to how cheap the MSP430 LaunchPad is, it is often the best way to program your custom MSP430 boards. One of my earlier posts details how I <a href="http://www.msp430launchpad.com/2011/10/programming-devbo-and-external-targets.html" target="_blank">use the LaunchPad to easily program custom boards</a> using a 6 pin 0.1" header. It is important to me that I include both the UART RXD and TXD pins in the programming header for debugging purposes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7niGLSDmo3eumO9_XlsrpQSXftq6Snw__7EaYZbugXjcBRL7OmvMoW_7qj18mrZxzZCu09qeMVhvB51V0oXsmgeeiM4R_ePFzRTI8EERKGmcI6tGX42OtZFDzguvDGpKHVvMNT-hKXNr/s1600/Schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="205" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7niGLSDmo3eumO9_XlsrpQSXftq6Snw__7EaYZbugXjcBRL7OmvMoW_7qj18mrZxzZCu09qeMVhvB51V0oXsmgeeiM4R_ePFzRTI8EERKGmcI6tGX42OtZFDzguvDGpKHVvMNT-hKXNr/s320/Schematic.png" width="320" /></a></div>
<br />
The simple schematic is shown above. Using a 3x2 pin 0.05" header on the target board, I created a "converter" board which connects to the LaunchPad using a 6 pin 0.1" header. Additionally, if I want to reduce the footprint further, I can use only a single 3x1 pin 0.05" header, ignoring the VCC, RXD, and TXD pins (as long as the target device is self powered).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfWFbNDi7LHrRhhK1jS_RY_l6ph0RIn75_1xCoK9-a_vJw4exgCzpgEuOUlRSpW5PBGF7MCKYWpqSOVqLIrMk6l9ekP1lUkaZf8EvIIPMOWFHEycdlfiJqXtUUMwrPIT-3jnCfBBejHaQn/s1600/PCB.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfWFbNDi7LHrRhhK1jS_RY_l6ph0RIn75_1xCoK9-a_vJw4exgCzpgEuOUlRSpW5PBGF7MCKYWpqSOVqLIrMk6l9ekP1lUkaZf8EvIIPMOWFHEycdlfiJqXtUUMwrPIT-3jnCfBBejHaQn/s320/PCB.jpg" width="320" /></a></div>
<br />
The circuit board is shown above. It is very simple, yet very effective. The overall footprint of the programming header has been reduced significantly. Some possible improvements include the addition of a switch to allow you to choose if the device will be powered by the programmer or not, a protection diode for VCC, and a reset push button for those devices which are too small to have one. If you use the Eagle file provided below to make your own, please keep the URL to my blogs on the silkscreen.<br />
<br />
<b>Parts:</b><br />
<br />
<ul>
<li>FCI 3x2 pin 1.27 mm (0.05") header - <a href="http://www.mouser.com/ProductDetail/FCI/20021111-00006T4LF/?qs=%2fha2pyFaduiz85iDDUmG9%252bqAoTRX%2fXkSFjPC9MvJAnswYAikAbluR2yGkeQ%2fEE2A" target="_blank">Mouser 649-221111-00006T4LF</a> ($0.41)</li>
<li>FCI 36x1 pin breakaway 0.1" header - <a href="http://www.mouser.com/ProductDetail/FCI/68000-236HLF/?qs=sGAEpiMZZMs%252bGHln7q6pm24n0txessAMNIXyAUOos%2fI%3d" target="_blank">Mouser 649-68000-236HLF</a> ($0.74)</li>
<li>PCB - order from <a href="http://oshpark.com/" target="_blank">OSHpark </a>with this <a href="http://nicholasjconn.com/Files/msp430launchpad_files/Programmer.brd" target="_blank">Eagle file</a></li>
</ul>
<div>
For almost no cost at all, you now have a miniature MSP430 programming header that you can use on all of your future projects. This concludes my small but useful post.</div>
NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com6tag:blogger.com,1999:blog-2168992611451428662.post-34639903168787776922013-02-17T12:40:00.000-05:002013-02-17T12:40:04.879-05:00One Step Closer to the Iron Man Lab!Ever since I saw <a href="http://www.amazon.com/gp/product/B001FD5KJM/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B001FD5KJM&linkCode=as2&tag=msp0d-20">Iron Man</a> I have dreamed of having Tony Stark's personal lab. A <a href="http://www.hackeda.com/">newly discovered project</a> via <a href="http://hackaday.com/2013/02/12/automatic-custom-eagle-schematics/">hackaday </a>brings us one step closer!<br />
<br />
<a href="http://hackeda.com/">hackeda.com</a> allows you to generate an Eagle CAD schematic from basic circuit building blocks. While this interface is in its early stages and there is a lot of room for growth, I believe that this project can grow into an amazing tool that we can't live without.<br />
<br />
I really hope we all get behind HackEDA, I really would like to see it prosper. Imagine a day where you can spend your time being creative, rather than painstakingly creating schematics for your ideas. One thing I would like to see from HackEDA however, is an open source computer application for the whole concept. While this might create some fragmentation (which many open source projects struggle with), I believe that this project could benefit from massive and rapid development.<br />
<br />
Please keep an eye on <a href="http://www.hackeda.com/">HackEDA</a>, I believe it is the future of circuit design.<br />
<br />
<b>Easy Peasy</b><br />
<br />
Despite the fact that many newer parts are only available as surface mount components, it has never been easier to get a professionally looking electronics project completed. <a href="http://www.cadsoftusa.com/">Eagle CAD</a> is a free tool for designing very high quality circuit boards. Additionally, Eagle CAD has a multitude of libraries which can be imported and used in your project.<br />
<br />
What about creating the actual circuit board? The days are gone where you have to fight with a blank circuit board, iron on traces, and a mini-drill press to get a low-cost circuit board. There are many places where you can order cheap custom circuit boards that are very high quality! Way nicer than anything the average person could make on their own.<br />
<br />
<a href="http://oshpark.com/">OSH Park</a> allows you to directly submit your Eagle CAD circuit layout and view a rendering of it online to ensure everything looks ok. Between 2-3 weeks later you have three copies of your circuit board for $5 per square inch. Another option for larger boards is <a href="http://www.seeedstudio.com/depot/fusion-pcb-service-p-835.html?cPath=185">Seedstudio's Fusion PCB Service</a>.<br />
<br />
Great, now we have a beautiful circuit board that we have no idea how to solder. Although devices can be very hard if impossible to solder, soldering surface mount devices has never been easier. The the coming months I will be writing blog posts on my newest setup at <a href="http://hardwarebreakout.com/">Hardware Breakout</a>, finishing up my posts on a homemade <a href="http://hardwarebreakout.com/2012/07/yet-another-toaster-oven-reflow-oven/">toaster oven reflow oven</a> in addition to posting instructions on how to build a cheap (<$150) PCB stencil laser cutter.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglma6LN3Z0y0JT6GZFc1_MLwLOhZpKgtpQjTTFnI-H0yO7gBk0lNrnXyLAzW9CAp6xM7SCK6CkcbBq7h47Q0QubQofOPcKLG0h7WB4Mexblz0KdFWqZRD3DRIxQN-NBh_r_g_YY6QqAJGr/s1600/Laser+Cutter-small.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglma6LN3Z0y0JT6GZFc1_MLwLOhZpKgtpQjTTFnI-H0yO7gBk0lNrnXyLAzW9CAp6xM7SCK6CkcbBq7h47Q0QubQofOPcKLG0h7WB4Mexblz0KdFWqZRD3DRIxQN-NBh_r_g_YY6QqAJGr/s320/Laser+Cutter-small.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A quick peak at my small laser cutter.</td></tr>
</tbody></table>
It takes me no time at all to solder the smallest components with perfect accuracy With the process streamlined so much, I can focus on building cooler and more complex projects. Stay tuned for these new posts!<br />
<br />
<b>Some Additional Library Tricks</b><br />
<br />
For those of you who don't know, <a href="http://ti.com/">TI </a>and other manufacturers such as <a href="http://www.analog.com/en/index.html">Analog Devices</a> have been using a new tool which brings CAD footprints of their parts to almost any CAD software. While companies like TI provide an Eagle Cad library for many of their parts, there always parts which are not included.<br />
<br />
Let's run through the process quickly.<br />
<br />
<br />
<ol>
<li>Go to your part (for example, the <a href="http://www.ti.com/product/pcm2706">PCM2706</a>, a USB audio DAC from TI), hopefully there is a CAD/CAE Symbol section.</li>
<li>On the side, TI provides a link for the Ultra Librarian software. Install this program, this is where the magic happens.</li>
<li>Once installed, download the bxl file for the actual part and open it in Ultra Librarian.</li>
<li>The GUI is fairly straight forward. It provides a quick view of the part and allows you to check off which CAD tools you use (e.g. Eagle CAD)</li>
<li>If you selected Eagle CAD, Ultra Librarian outputs a script for adding the part to an Eagle Library.</li>
<li>Open up your desired library in Eagle, run the script. There you go! The part has been added to your library.</li>
</ol>
<div>
While this process does not create the prettiest schematic symbols, it does work very well. I have used this for many chips and am very impressed that the manufactures finally are supporting a wide variety of tools via this program.</div>
<div>
<br /></div>
<b>The Stark Lab</b><br />
<br />
I imagine a day where the following steps are all that is needed to get a great piece of hardware made.<br />
<br />
<ol>
<li>"Computer, I want a circuit board that has a powerful MSP430 on it that is powered by two AAA batteries and includes a gyroscope, a 3-axis accelerometer, a micro-SD card, and a <a href="http://store.hardwarebreakout.com/index.php?route=product/product&product_id=61">Bluetooth Low Energy radio</a>.</li>
<li>A few seconds later, my computer submits a perfect design to OSH Part without me having to double check it while it orders all the parts I need directly from <a href="http://mouser.com/">Mouser </a>or <a href="http://digikey.com/">Digikey</a>.</li>
<li>Three weeks later my board arrives and I have all the parts ready and loaded into a homemade pick and place.</li>
<li>All I have to do is hit go, and the laser cutter starts creating the stencil needed for the board</li>
<li>Some kind of robotic arm/conveyor belt then applies the stencil and solder paste to the board and then deposits the it in the pick and place machine.</li>
<li>Once all the parts are populated, the board automatically gets placed in my toaster oven reflow oven. A few minutes later, with about 5 minutes of my time all-in, I have a completed circuit board which I can now use in a new project.</li>
</ol>
<div>
While this may seem far off, it really is not as far off as you would think. I predict that in a few years, it will be possible to have a system like this for less than $500 all in. Not bad when you consider how much professional equipment which can do the same thing (albeit in mass) costs.</div>
<br />
<br />
I personally do not believe that this will reduce the need for circuit knowledge and make us stupid. I believe that this will allow us to be more creative. There will always be a need for the low level skills, but there is no reason to spend all of your time on the low level stuff!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com4tag:blogger.com,1999:blog-2168992611451428662.post-61125417086851080272012-12-02T21:29:00.003-05:002012-12-02T21:29:42.926-05:00TI Stellaris LaunchPad WorkshopFirst let me start off by saying that if you have the opportunity to go to a local TI event, do it! They are a great way to network and hear about TI products.<br />
<br />
For those of you who don't know, I am currently a PhD student at the Rochester Institute of Technology (RIT). This past Friday RIT hosted an ARM developer's day, where TI manned a both and held a workshop on the <a href="http://www.ti.com/ww/en/launchpad/stellaris_head.html?DCMP=stellaris-launchpad&HQS=stellaris-launchpad-b">Stellaris LaunchPad</a>. I not only learned a bit about TI's ARM products, but also met some great people, and managed to get a TI t-shirt! Very cool! Thank you TI!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKUq6w9IItxNijsnMA7hNxXMrT3BSxr5r9vLzMjyoq7x6axrBWTYVvfLZ2L-Wpi3m2VsEjEgZixBLPge95XwWHGfiFxD8-t2ck8Q6-Yu7qj28RNAyUBYl2I0noPXQUJu_A4noZwXzdG34v/s1600/IMG_20121130_131938.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKUq6w9IItxNijsnMA7hNxXMrT3BSxr5r9vLzMjyoq7x6axrBWTYVvfLZ2L-Wpi3m2VsEjEgZixBLPge95XwWHGfiFxD8-t2ck8Q6-Yu7qj28RNAyUBYl2I0noPXQUJu_A4noZwXzdG34v/s320/IMG_20121130_131938.jpg" width="320" /></a></div>
<br />
The workshop was setup very nicely, each attendee had their own computer (for the most part) and a Stellaris LaunchPad to play with. The presentation was quite informative and discussed not only the history of ARM processors, but also the TI products which utilize ARM technology. Much of the information presented is available online at the <a href="http://processors.wiki.ti.com/index.php/Hands-On_Training_for_TI_Embedded_Processors">TI wiki</a>, more specifically under the <a href="http://processors.wiki.ti.com/index.php/Getting_Started_with_the_Stellaris_EK-LM4F120XL_LaunchPad_Workshop?DCMP=Stellaris&HQS=StellarisLaunchPadWorkshop">"Getting Started with the Stellaris EK-LM4F120XL LaunchPad Workshop"</a> page. It's very interesting what you can learn though when you go to these workshops in person.<br />
<br />
One of the best parts of these workshops is that you get to hear about new and upcoming booster packs and development boards. The picture below shows the <a href="http://www.ti.com/tool/msp-exp430fr5739">FRAM MSP430 development board</a> with the CC3000 wifi module attached. The wifi module from TI has a built in ARM processor which runs all the stack software, allowing your embedded applications to use wifi via a serial connection (UART or SPI). I for one, am very excited for when TI releases this board.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1kPugfx14FcB00gmk6Z5xEQSzAAC76U3oZNlyA0nro3ivdAuHKpXg4M2lTtjzsBovpKbc5dDangMemWAkRn2cOEawItZuhUMzIu1mfP0yH6UVdaFjcrQpT7XzuoB-WA7TRpwGYDREqI8N/s1600/IMG_20121130_135047.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1kPugfx14FcB00gmk6Z5xEQSzAAC76U3oZNlyA0nro3ivdAuHKpXg4M2lTtjzsBovpKbc5dDangMemWAkRn2cOEawItZuhUMzIu1mfP0yH6UVdaFjcrQpT7XzuoB-WA7TRpwGYDREqI8N/s320/IMG_20121130_135047.jpg" width="274" /></a></div>
<br />
Now onto the the Stellaris LaunchPad. After the presentation by two TI field application engineers, the workshop attendees were able to power up a Stellaris LaunchPad and use the demo software that came pre-installed on the board. Take a look at the picture below; it even comes with stackable headers (which you can't really see from this angle)!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRIJnsR1chbVlHUsBi9j_I65aGRcvOymo3619uZsifBRYTKR7MwdcI0lyidJod8JKQFZ19bUZiDz3WO3cINP4cIeYc9-0JWIRoBpn7WPzQScUomf5A9bcrXGUhSKSkmcd_Hjs2HZtyfWRK/s1600/IMG_20121202_205153.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRIJnsR1chbVlHUsBi9j_I65aGRcvOymo3619uZsifBRYTKR7MwdcI0lyidJod8JKQFZ19bUZiDz3WO3cINP4cIeYc9-0JWIRoBpn7WPzQScUomf5A9bcrXGUhSKSkmcd_Hjs2HZtyfWRK/s320/IMG_20121202_205153.jpg" width="317" /></a></div>
<br />
Now why would you want to use a Stellaris LaunchPad? The main reason is that it is a more powerful processor, which is ARM based. The ARM processor on the <a href="http://www.ti.com/ww/en/launchpad/stellaris_head.html?DCMP=stellaris-launchpad&HQS=stellaris-launchpad-b">Stellaris LaunchPad</a>, the <a href="http://www.ti.com/tool/ek-lm4f120xl">LM4F120</a>, not only can be clocked at 80MHz but also has a full-speed integrated USB interface. This board will be great for project which require a high speed interface with a computer (did someone say <a href="http://reprap.org/">RepRap</a>?). Additionally, there are numerous serial ports, PWM pins, and other awesome peripherals including a high-speed 12-bit ADC. Before concluding, it is important to note that the Stellaris LaunchPad is pin compatible with the MSP430 LaunchPad; this means you can use your booster packs on the Stellaris LaunchPad as well!<br />
<br />
While I am quite busy these days with my research, I plan on creating a few posts on getting started with the Stellaris Launchpad; more specifically I would like to port over the LaunchScope code to this board. This board has so much potential and I cannot wait to see all the cool projects that will utilize it in the future.NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com1tag:blogger.com,1999:blog-2168992611451428662.post-29015732027074714862012-10-03T12:24:00.004-04:002012-10-03T12:24:57.351-04:00Review: Solar Energy Harvester Booster PackIn case you have not heard, there is a new Kickstarter for a <a href="http://www.kickstarter.com/projects/1880021630/energy-harvester-booster-pack">"Solar Energy Harvester Booster Pack"</a> built for the MSP430 LaunchPad. The people over at Athena Energy were nice enough to send me one of their boards to review. Before starting the review, I want to say how impressed I was with their communication. I received quick and helpful responses to every email I sent their way. Having backed a few Kickstarters, I can't stress how important communication is throughout the whole process.<br />
<br />
<b>First Impressions</b><br />
<br />
May I say, thank you; it is about time. Up until now, there has been no battery booster pack for the MSP430, let alone one with solar panels. This is insanity, considering how little power the MSP430 actually uses. Pair this booster pack up with any of these <a href="http://store.43oh.com/index.php?route=product/category&path=64">booster packs</a> at the 43oh store, and you have a great project in the making. The board looks great and comes with stackable headers, as any booster pack should. When the board came, the battery was disconnected using a "battery tab" (a piece of paper); a nice touch. Here are a few pictures.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4jbB5phoz0Y5m6eo1Ipd6O4bI68pbNJxrK6xW7HQLvDBYW0To1nalKeZ7GCXOJcWTNvfdDE9hbhabnvbXfupMi08nzPVRMlIyw019MizwCKtwQfbFNPOrUWn8SaLDKyUgiQyOKa-vOT8T/s1600/Energy+Harvester.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4jbB5phoz0Y5m6eo1Ipd6O4bI68pbNJxrK6xW7HQLvDBYW0To1nalKeZ7GCXOJcWTNvfdDE9hbhabnvbXfupMi08nzPVRMlIyw019MizwCKtwQfbFNPOrUWn8SaLDKyUgiQyOKa-vOT8T/s400/Energy+Harvester.jpg" width="400" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSaSBuAwIFHP8hkUqOq9Bh1LEYvYWWJCd9jA1BFw3Retic_Aw3wGP3b72DuVyESTjADehnefiqetumXnfGOMaVJ4lalGJS4P85BT5B5bHVA99E7Xnw84w-1-FhbXU2oIo-Lbir0vHhk0u3/s1600/Solar+Harvester.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSaSBuAwIFHP8hkUqOq9Bh1LEYvYWWJCd9jA1BFw3Retic_Aw3wGP3b72DuVyESTjADehnefiqetumXnfGOMaVJ4lalGJS4P85BT5B5bHVA99E7Xnw84w-1-FhbXU2oIo-Lbir0vHhk0u3/s320/Solar+Harvester.jpg" width="320" /></a></div>
<br />
<br />
The ability to plug in an external solar panel and an external lithium battery is a very nice feature. While the prototyping area is small, it is large enough to solder on custom connectors for various purposes. The silkscreen is clean and provides useful information, such as pin descriptions and information on the battery. It is obvious to me that great care was taken to ensure the operating current of the shield was as small as possible. Measuring from the battery, the board used only 27uA of current when not plugged into the MSP430 (if my Fluke can be trusted).<br />
<br />
Before plugging the board into my LaunchPad, I wanted to run a few tests first with my multimeter. The lithium battery was sitting at 4.02V (fully charged) and the regulated output was 3.37V, as expected. One feature I would like to see in a future version of this board, would be the ability to adjust VCC from 3.3V to a lower voltage.<br />
<br />
What else can I say? The board just worked. It really was plug and play. The booster packs dimensions are pretty standard and the solar cell location is also well thought out. The battery also charges as expected when fully drained. The board functions exactly as advertised.<br />
<br />
<b>Other Thoughts</b><br />
<br />
The people over at Athena Energy really care about making this board as good as possible. They have listened to all the feedback I sent them and have helped me with any problems I have run into. They really are very knowledgeable. Take a look at the <a href="http://www.kickstarter.com/projects/1880021630/energy-harvester-booster-pack/posts">update section</a> in their Kickstarter; they are planning on adding new features to the final design.<br />
<br />
I highly recommend signing up for the fully assembled version of this booster pack. While those of you that have a<a href="http://hardwarebreakout.com/2012/07/yet-another-toaster-oven-reflow-oven/"> toaster oven "reflow oven"</a> will be able to solder this up yourself, QFN packages are nearly impossible to solder by hand. Although the assembled board is pricey, I believe that it is worth it. This great chip from Texas Instruments is very underutilized in hobby projects due to the package it comes in. Additionally, since the solar cells and battery are included; it literally contains everything you need to get started on a battery powered project.<br />
<br />
As of today, there are 16 days left on the <a href="http://www.kickstarter.com/projects/1880021630/energy-harvester-booster-pack">Kickstarter<span id="goog_811959991"></span></a>. Let's get the word out and help them meet their funding goals. The convenience of this board is well worth it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://s3.amazonaws.com/ksr/assets/000/149/722/6fd4da1890a14a898ec6e73c4eeafe0b_large.JPG?1347048266" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="278" src="http://s3.amazonaws.com/ksr/assets/000/149/722/6fd4da1890a14a898ec6e73c4eeafe0b_large.JPG?1347048266" width="320" /></a></div>
<br />
<br />
<div style="text-align: center;">
<span style="font-size: large;"><b><u><i><a href="http://www.kickstarter.com/projects/1880021630/energy-harvester-booster-pack">Solar Energy Harvester Booster Pack</a></i></u></b></span></div>
<br />NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com9tag:blogger.com,1999:blog-2168992611451428662.post-48433950012292527712012-09-08T13:21:00.003-04:002012-09-08T13:21:56.735-04:00A New WebstoreToday marks the close of the old NJC's MSP430 Store. The old system which was based on PayPal buttons was very difficult to use and did not lend itself to an aesthetic and functional store. Although the old store has been removed, a new store is ready to go on my other website, <a href="http://hardwarebreakout.com/">Hardware Breakout</a>.<br />
<br />
The blog on Hardware Breakout has a long way to go before it is finished, but the <a href="http://store.hardwarebreakout.com/">Hardware Breakout Webstore</a> is complete! All of the products that you could purchase from the old webstore you will find at Hardware Breakout, except for the DEV.BO which has been discontinued. There are also many new products and breakout boards which I hope you all will love.<br />
<br />
Please note there has been one big change, shipping is no longer free on order below $5 USD. For most of you, this will not be an issue. Please read the Hardware Breakout Store <a href="http://store.hardwarebreakout.com/index.php?route=information/information&information_id=6">shipping policy</a> for more information. If you experience any problems with the new store or have any comments, please send me an email or leave a comment.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://store.hardwarebreakout.com/"><img alt="The Hardware Breakout Store" border="0" height="51" src="http://store.hardwarebreakout.com/image/data/SystemFiles/cart-header-assets.png" title="The Hardware Breakout Store" width="320" /></a></div>
NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com0tag:blogger.com,1999:blog-2168992611451428662.post-83182939686686184522012-08-07T13:52:00.000-04:002016-02-04T14:17:06.227-05:00Using a Nokia LCD Library<a href="http://sparkfun.com/">SparkFun</a> sells a great, low-cost, yet easy to use <a href="https://www.sparkfun.com/products/10168">LCD display breakout board</a> for the Nokia 5110 display. This LCD is perfect for any which requires a user interface. When I made the decision to build a <a href="http://hardwarebreakout.com/2012/07/yet-another-toaster-oven-reflow-oven/">reflow toaster oven</a>, I also decided that I wanted to be able to view the oven's progress on a small display. <span style="background-color: white;">This post supports the series I am writing about on </span><a href="http://hardwarebreakout.com/" style="background-color: white;">HardwareBreakout.com</a><span style="background-color: white;"> which discusses building your own <a href="http://hardwarebreakout.com/2012/07/yet-another-toaster-oven-reflow-oven/">toaster oven "reflow oven"</a>.</span><br />
<br />
This specific display has been used in many projects on many different microcontrollers, such as the Arduino. This means that there is already ample information out there on this LCD including libraries written for many different microcontrollers. Since reinventing the wheel is usually a bad idea, this post will discuss using an existing library for the MSP430 to meet our toaster oven needs.<br />
<br />
<b>Requirements</b><br />
<br />
My goal for this project is to display real-time information on the reflow process. This includes the current temperature in the toaster oven, the temperature the toaster oven should be at, the current zone the oven is in (e.g. cooldown, reflow, preheat), and how long the process has been going on for. Given that all of the information I would like to display is text based, implementation is fairly straight forward.<br />
<br />
There are many libraries written specifically for the MSP430 that interface with this display.<br />
<ul>
<li><a href="http://forum.43oh.com/topic/1312-nokia-5110-display/">RobG's Nokia 5110 display code</a></li>
<li><a href="http://forum.43oh.com/topic/1769-nokia-5110-c-template-class/">Nokia 5110 C++ Template Class</a></li>
<li><a href="http://forum.43oh.com/topic/2351-voltampwatt-meter/">Volt/Amp/Watt meter</a></li>
</ul>
<div>
These are just three of the many libraries which can be found for the MSP430. For this post, I have decided to use RobG's Nokia 5110 as it uses the hardware SPI rather than a software SPI.</div>
<div>
<br /></div>
<div>
It is <b>VERY </b>important to give credit where credit is due. If you use someone else's code, always include comments in your code linking to the original author. It is great that we have such an awesome community, where code is shared freely.</div>
<div>
<br /></div>
<div>
<b>The Nokia LCD</b></div>
<div>
<br /></div>
<div>
While it is not necessary to understand how the LCD works when using a fully functioning library, it can still be beneficial if you need to modify the library or if you run into problems with your project. The first step in figuring out how the Nokia 5110 works is to take a look at <a href="http://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf">the datasheet</a>.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2SAfkT19My21-5VHSrtCkoyFmTQgiZofI-EAKcXAbo3egOavuhFxLL_nWYaIraXx4Voo8WIiGHJfRrREzsw_p5iKaF5L55BljHu6dkJ7P1xlI8rUuWqoCTNcKl01NVgNL_eAu__vBHYWY/s1600/DDRAM+Organization.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2SAfkT19My21-5VHSrtCkoyFmTQgiZofI-EAKcXAbo3egOavuhFxLL_nWYaIraXx4Voo8WIiGHJfRrREzsw_p5iKaF5L55BljHu6dkJ7P1xlI8rUuWqoCTNcKl01NVgNL_eAu__vBHYWY/s400/DDRAM+Organization.png" width="193" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Shows how each pixel is organized in DRAM. Image taken from the Nokia 5110 Datasheet</td></tr>
</tbody></table>
The above image shows how each pixel on the screen is organized. There are a total of 84x48 pixels, these pixels are organized into 6 horizontal banks (zero through five), and 84 columns. Each bank contains 8 pixels, which sum up to a total of 48 rows.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvgvkAecZYul55djBzQ9qPWUfVLPdI84PObVeBV5cYE2xv9UP9wBIe_oimmYQPT9PjwOOTD0WubMG2JKj0UypBDFUE8UWMHVlWZb2OUbx0fJ21K328jJ-B44-Jubbz1JUtsb6Jmen1Q9KJ/s1600/RAM+Formatting.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvgvkAecZYul55djBzQ9qPWUfVLPdI84PObVeBV5cYE2xv9UP9wBIe_oimmYQPT9PjwOOTD0WubMG2JKj0UypBDFUE8UWMHVlWZb2OUbx0fJ21K328jJ-B44-Jubbz1JUtsb6Jmen1Q9KJ/s400/RAM+Formatting.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Shows how each byte in RAM relates to each pixels on the display. Image taken from the Nokia 5110 Datasheet</td></tr>
</tbody></table>
The above image shows how the RAM will map to a given pixel in the display. This image shows the whole display, with each row representing one bank. One byte in memory stores the data for each column in a given bank; this makes sense considering there are 8 rows of pixels in each bank.<br />
<br />
Given that we are strictly displaying text on the screen using RobG's code, we do not really need to know any of this. That being said, understanding how the memory is mapped to the display is very important if you will be creating your own graphics or characters.</div>
<div>
<br /></div>
<div>
<b>Creating an LCD Project in CCS</b></div>
<div>
<br /></div>
<div>
Since I prefer Code Composer Studio (CCS) over the other methods for programming the MSP430, I will quickly discuss how to use someone else's code in your projects.</div>
<div>
<br /></div>
<div>
The first step is to create a new project for your specific device, for this example I am using the MSP430G2553. While you can import any file to your project, I prefer to just copy and paste the code when using code posted online. For RobG's code you need to create one new file, "PCD8544.h" and copy his code directly into it. The simplest way to start with his library is to also copy his "main.c" and modify it for your project.</div>
<div>
<br /></div>
<div>
While it is possible to change some of the pin assignments around, be careful. Some of the pins need to stay where they are because they are special SPI pins built into the USCIB interface (in the MSP430G2553). To use this library in its most basic form, three functions are needed.</div>
<div>
<ul>
<li>clearBank(bank) - Clears an entire line on the LCD display and sets the current location to the beginning of the line.</li>
<li>writeStringToLCD(string) - Write a string to the LCD in the current location.</li>
<li>writeCharToLCD(char) - Write a character to the LCD in the current location.</li>
</ul>
<div>
In addition to RobB's code I will be using the printf code which I discussed in <a href="http://www.msp430launchpad.com/2012/06/using-printf.html">my previous post</a>. This allows us to display the content of our variables on the LCD display, for example the current temperature of the toaster oven. To use printf, you have to copy the <a href="https://gist.github.com/2896369#file_printf.c">printf.c</a> file into your project and then create the following two functions in your main.c file. By using these functions, the output of printf is displayed on the LCD.
</div>
</div>
<div>
<br /></div>
<div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXvYljGLvplNwiUADH7oIhXJZgc8iKpSXoJvziwnGMe_wvvyYHwaL_0m-MpC_I7Flg9zOH74DPOIOGjEN3c_NyE6eynxz4l_Z-KZMZx_50MJChxpa1H7dAht7t9FIOUmX-POLc9oVDiS-5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> /**
* puts() is used by printf() to display or send a string.. This function
* determines where printf prints to. For this case it outputs a string
* to a LCD, another option could be to send the string out via UART.
**/
void puts(char *s) {
writeStringToLCD(s);
}
/**
* puts() is used by printf() to display or send a character. This function
* determines where printf prints to. For this case it outputs a
* character to a LCD.
**/
void putc(unsigned b) {
writeCharToLCD(b);
}
</code></pre>
<br /></div>
<div>
<b>Code Snippet</b><br />
<b><br /></b></div>
<div>
The code below is a snippet from my project. This is just a quick example of using RobG's code with my project. I call this function whenever I want to display the current status of the toaster oven on the display. The variables it uses are global variables which will be updated as the program runs. I only call this function when a value is changed, so that the display is not updated unnecessarily.
<br />
<br /></div>
<div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXvYljGLvplNwiUADH7oIhXJZgc8iKpSXoJvziwnGMe_wvvyYHwaL_0m-MpC_I7Flg9zOH74DPOIOGjEN3c_NyE6eynxz4l_Z-KZMZx_50MJChxpa1H7dAht7t9FIOUmX-POLc9oVDiS-5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: 400px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> void updateStatus() {
clearBank(0); // Line 0 shows current temperature
printf("Current: ");
printf("%u", currentTemp);
writeCharToLCD(0x7f); // Degree symbol
writeStringToLCD("C");
clearBank(1); // Line 1 is empty
clearBank(2); // Line 2 shows the desired temperature
writeStringToLCD("Desired: ");
printf("%u", desiredTemp);
writeCharToLCD(0x7f); // Degree symbol
writeStringToLCD("C");
clearBank(3); // Line 3 is empty
clearBank(4); // Line 4 shows which zone the oven is in
printf("Zone: ");
writeStringToLCD(zoneString[zoneIndex]);
if (heatOn) // Line 4 includes an asterisk when the
printf("*"); // heating elements are on
clearBank(5); // Line 5 shows the time the toaster oven
printf("Time: "); // has been running
if (minutes < 10) // Make sure there are always two digits
printf("0");
printf("%u:", minutes);
if (seconds < 10) // Make sure there are always two digits
printf("0");
printf("%u", seconds);
}
</code></pre>
<br /></div>
<div>
<b>Conclusion</b><br />
<br />
Overall, integrating <a href="http://www.43oh.com/forum/viewtopic.php?f=30&t=1759&p=12173#p12104">RobG's library</a> into my project was very simple. It went without a hitch. Modifying his code for custom characters is also fairly straight forward. I hope this post helped shed some light on how the Nokia 5110 display works. It has never been easier to use such a cool display in your projects. This post supports my series on <a href="http://hardwarebreakout.com/">Hardware Breakout</a> which discusses building a <a href="http://hardwarebreakout.com/2012/07/yet-another-toaster-oven-reflow-oven/">toaster oven "reflow oven"</a>.<br />
<br />
Leave a comment and post links of your projects using the Nokia 5110!</div>
NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com4tag:blogger.com,1999:blog-2168992611451428662.post-35442707273118099712012-06-08T11:57:00.002-04:002012-08-06T15:35:36.464-04:00printf() for the MSP430<blockquote class="tr_bq">
"The output function printf translates internal values to characters."</blockquote>
This simple definition comes from the book <a href="http://www.amazon.com/gp/product/0131103628/ref=as_li_ss_tl?ie=UTF8&tag=msp0d-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0131103628">"C Programming Language<b>"</b> by Kernighan and Ritchie</a>. I highly recommend this book to anyone who is interested in learning more about C, it is a must have for any embedded programmer.<br />
<br />
The printf() function will allow us to display any value in your code so that it is human readable. What does this mean? Let's say you would like to tell the computer what temperature your MSP430 has measured; a typical output might be "Temperature: 71°F". We know how to read the internal temperature from a <a href="http://www.msp430launchpad.com/2010/09/simple-adc-example-on-launchpad.html">previous post</a>, but how do we get our MSP430 to output the above string over UART? We use the printf() function.<br />
<blockquote class="tr_bq">
printf("Temperature: %u°F\r\n", tempValue);</blockquote>
I will not be explaining how printf() actually works in this post. If you would like more information on how to use this function please see the above mentioned <a href="http://www.amazon.com/gp/product/0131103628/ref=as_li_ss_tl?ie=UTF8&tag=msp0d-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0131103628">book</a>, or this <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf/">link</a>. Due to the fact that the MSP430 has limited resources (e.g. memory), a compact version of the standard printf() function must be used.<br />
<br />
Since the printf() included in Code Composed Studio is very large and will not fit on many of the value line MSP430s, we must add our own printf() function to our projects. oPossum on the <a href="http://www.43oh.com/forum/">43oh.com forums</a> has <a href="http://www.43oh.com/forum/viewtopic.php?f=10&t=1732">shared his printf()</a> with the community and since reinventing the wheel is rarely a good idea, we will be using oPossum's code.<br />
<blockquote class="tr_bq">
"This is a tiny printf() function that can be used with the chips that come with the Launchpad. Code size is about 640 bytes with CCS."</blockquote>
This is how oPossum describes his function. While this function does not support all of the standard printf() features, it is more than sufficient for use on an MSP430. Using this function, we can format 7 separate data types: character, string, integer, unsigned integer, long, unsigned long, and hexadecimal (16-bit) formatting.<br />
<br />
I want to thank oPossum for sharing his code with the community. The code is very well written and works great! Thanks again!<br />
<br />
<b>Code</b><br />
<br />
Please scroll down for the rest of the post. One of these days I will figure out how to limit the height of my embedded code.
<br />
<br />
<script src="https://gist.github.com/2896369.js?file=printf.c">
</script>
<script src="https://gist.github.com/2896348.js?file=main.c">
</script>
<br />
<b>Customizing the Output</b><br />
<br />
Depending on your project, you will want to have printf() output differently. For this example, printf() will send the formatted string out over the UART to a computer. For a different project, you might want to output the string to an LCD, or through USB. The code provided from oPossum allows you to define two functions, puts() and putc() which determines how printf() will output the formatted string. Without defining these two functions, the printf() will actually not do a thing. printf() uses puts(char *) to send out a string value, and uses putc(unsigned) to send out a character.<br />
<br />
In the code above, my
puts(char *) and putc(unsigned) functions sends the string and character out over UART using another of my functions, sendByte(unsigned char). The code in these functions is fairly straight forward, and will not be discussed here. If you would like to another output for printf(), you would create your own puts(char *) and putc(unsigned) functions as I have done in the code above.<br />
<br />
<b>Testing the printf() Function</b><br />
<br />
I will be using a very similar setup as oPossum for testing the printf() function. The code above will send a test sequence to the computer when the MSP430 receives the character 't' over UART. I recommend using <a href="http://realterm.sourceforge.net/">Realterm </a>for interfacing with the MSP430 over UART. To connect, select the correct COM port and set the baud rate to 9600. Once connected, send the character 't' by clicking on the blank window and typing 't'. You should see the following response from the MSP430.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwsIAHhJfMF7ynwws568Ph-u5gewDl2JllAmvmfWFomEF4M2gseZ-dDg_bCi8CoK-pbxlG_mBrqwm9ufdtKREE73xCncxeloNhSCKFv_PPakt0K66CBj8yNeCIaWOUZHWTKtB8uIukJgs/s1600/RealTerm.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwsIAHhJfMF7ynwws568Ph-u5gewDl2JllAmvmfWFomEF4M2gseZ-dDg_bCi8CoK-pbxlG_mBrqwm9ufdtKREE73xCncxeloNhSCKFv_PPakt0K66CBj8yNeCIaWOUZHWTKtB8uIukJgs/s320/RealTerm.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Test sequence from the MSP430</td></tr>
</tbody></table>
<b>Conclusion</b><br />
<br />
Use this code in your projects! It really is a great piece of code. To use this printf() function to your own CCS projects, just add printf.c to your project and create your own puts(char *) and putc(unsigned) in your main c file as I have done in this example.<br />
<br />
In the next post, I will expand on the <a href="http://www.msp430launchpad.com/2012/03/using-aclk-and-32khz-crystal.html">previous post</a> by creating a real-time clock using the MSP430. Stay tuned!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com26tag:blogger.com,1999:blog-2168992611451428662.post-4090838911993863112012-03-15T18:49:00.001-04:002013-09-12T09:18:37.149-04:00Using ACLK and the 32kHz CrystalThe other day I decided to build a timer to control some lights in my apartment. As I hope to expand this mini project into a full-fledged home automation system built around the CC430, a simple light timer from Walmart would not do! Obviously, the LaunchPad is the perfect tool for the job.<br />
<br />
For example, let's say that I wanted to keep my lights on for 5 hours at night while I am on vacation. The first thing you will need is a way to tell time; this requires some sort of real-time clock. Since the high frequency clock sources on the MSP430 are not accurate enough to keep reliable time over a large period of time (anything greater than 1 minute in my opinion), a lower frequency clock will be needed. Though many of the newer MSP430s have built in 32kHz clocks, such as the the MSP430F5510, the value line series does not!<br />
<br />
<b>The 32.768kHz Crystal</b><br />
<br />
The first step for building this project is to install the 32.768kHz crystal onto the LaunchPad. From this point onward I will just be calling this 32kHz for simplicity. You might be wondering why a real time clock is based on 32.768kHz; 32768 is exactly 2^15. This number can be divided down using binary values to give you a <a href="http://en.wikipedia.org/wiki/Frequency">frequency</a> of 1Hz, or a period of 1 second. This is why 32kHz is the standard frequency used in real-time clocks.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwVhnxHqTc2g28_p7-899YSYP1lnAAFJE3aCC2ZmUu7hm5u65DSp-VlacZRBnpIOvVizM7ZbXC-77gYptdvpTjqjZMbhfeTPk485fP72qoS_SZpIXBCtIxLQBSRSruAWk6CcysvcO2BV6q/s1600/IMG_20120315_171344.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwVhnxHqTc2g28_p7-899YSYP1lnAAFJE3aCC2ZmUu7hm5u65DSp-VlacZRBnpIOvVizM7ZbXC-77gYptdvpTjqjZMbhfeTPk485fP72qoS_SZpIXBCtIxLQBSRSruAWk6CcysvcO2BV6q/s320/IMG_20120315_171344.jpg" width="267" /></a></div>
<br />
The above image shows the crystal soldered onto my LaunchPad. There are many methods you can use to solder this on, one of which is nicely documented on <a href="http://justinstech.org/2010/07/msp430-launchpad-dev-kit-how-too/">Justin's Tech blog</a>. I ended up soldering the base of the crystal first, ensuring that the clock was positioned correctly before I soldered the small leads. Use any method that works for you.<br />
<br />
<b>The LED Hello World</b><br />
<br />
The <b>first</b> thing you should do once you have this soldered onto your board, is test it. Making sure that everything works before you start a complicated project is very important. Let's make an LED turn on every two seconds, for one second. Instead of changing the timer output pins directly as we did in an <a href="http://www.msp430launchpad.com/2010/07/timers-and-clocks-and-pwm-oh-my.html">earlier post</a>, lets blink the LED manually so that we can easily expand the functionality of this program in a future post. There are a few things you should notice in the code below.<br />
<br />
<script src="https://gist.github.com/2047279.js?file=ACLK_Test.c">
</script>
In this code we divide the clock by 64 (lines 26 and 37) which causes the timer to increment 512 times a second (512Hz). Once the clock counts up to <strike>512</strike> 511 (this is because we start counting at 0), one second has gone by, and an interrupt is thrown. Now that we are entering an interrupt routine instead of automatically toggling the output, we can use this interrupt routine in the future to expand the functionality of this code.<br />
<br />
<strike>The last important line of code is line 27, where a capacitance value is set. This value matches the capacitors that come installed on your LaunchPad. In the next section, I will elaborate slightly on what this capacitance is.</strike><br />
<strike><br /></strike>
<i>Edit: This statement is actually incorrect. A big thank you goes out to Jens-Michael Gross for pointing it out to me.</i><br />
<blockquote class="tr_bq">
<i>"The capacitance setting is an internal switch that enables some silicon capacitors on the MSP die. The selection has to match the required load capacitance of the used watch crystal. You can set it to minimum (plain parasitic pin capacitance) and apply external capacitors of the proper value, if you want. However, the available options are sufficient for the most watch crystals, so external capacitors are unnecessary, even counterproductive. And external capacitors have a large tolerance that affects the crystal frequency. </i><i>The LaunchPad I just got has no capacitors installed (the C21 and C22 pads are empty, as it should be if the XCAP options are used."</i></blockquote>
<b>Custom Design</b><br />
<br />
One thing I wanted to mention before this post comes to a close, is how you can take this design off the LaunchPad and make it your own. Many projects work out so well that you just want to create a PCB or make it permanent in some other way.<br />
<br />
Working with crystals can be tricky for beginners, as there is one thing you must look out for. All crystals require a load capacitance to remain stable, <a href="http://en.wikipedia.org/wiki/Pierce_oscillator">Wikipedia (Pierce Oscillator) </a>and <a href="http://www.ti.com/lit/an/slaa322b/slaa322b.pdf">Texas Instruments</a> both have some quality information on the topic. The value of these two capacitors depend on which crystal you use. Even two crystals with the same frequency which are made by the same manufacture might require different load capacitor values. Please check the crystal's datasheet for this information. <strike>For example, the LaunchPad uses 12pF capacitors to load the crystal we just installed, yet many crystals require 22pF.</strike><br />
<strike><br /></strike>
<i>Edit: This statement is actually incorrect. Another big thank you goes out to Jens-Michael for pointing it out to me. Thanks for reading!</i><br />
<blockquote class="tr_bq">
<i>"12pF is the typical load for most crystals I've ever seen. But due to the electric connection, a 12pF load means [there will be 2] 24pF capacitance on each of the crystals sides. Reason is that (seen from the crystal), the two capacitors are in series to each other and parallel to the crystal. […] Subtract the ~2pF pin capacitance of the MSPs pins and you get [two separate] 22pF [for] external capacitors, resulting in 12pF load. The XCAP settings already include pin capacitance and the /2 factor."</i></blockquote>
<i>A bit more information and great advice from Jens-Michael!</i><br />
<blockquote class="tr_bq">
<i>"Experiments have shown that the G devices (in opposition to the AFE2x and some other x2 family devices without HFXT1 input) will accept a high-frequency TTL clock signal (e.g. from a self-oscillating quartz oscillator) on the XTIN pin, when in bypass mode. The Datasheet limits external clock to 50kHz, but there were no problems with 16MHz."</i></blockquote>
<div>
<b>Conclusion</b><br />
<b><br /></b></div>
As you can see by the following screenshot from my oscilloscope, this timer is pretty darn accurate.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy57l-SyMqgI0wS12dPwcdlMSZIM-NHjVR_0LbddjZREz8rkgxyT-2Ku22K2OgTKpr5M4KZWAOfcvQkMX4nepuj-_NoxJYwvjpkt02g7KFuAkbZmFYv8QijC4SZdVnsHLrdtyP0seF45LX/s1600/ACLK_scope.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy57l-SyMqgI0wS12dPwcdlMSZIM-NHjVR_0LbddjZREz8rkgxyT-2Ku22K2OgTKpr5M4KZWAOfcvQkMX4nepuj-_NoxJYwvjpkt02g7KFuAkbZmFYv8QijC4SZdVnsHLrdtyP0seF45LX/s320/ACLK_scope.bmp" width="320" /></a></div>
<br />
Hopefully you enjoyed this post and found it informative. I am going to try to keep things a bit more bite-sized from now on. Let me know what you think.<br />
<br />
Post links to your projects which use the ACLK or the 32kHz crystal in the comment section below!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com38tag:blogger.com,1999:blog-2168992611451428662.post-14381817442975518872011-10-27T15:41:00.003-04:002013-02-25T22:34:19.542-05:00Programming the DEV.BO and External Targets with a LaunchPadMany readers have been asking me how to program the <a href="http://www.msp430launchpad.com/2011/04/official-version-of-devbo-20.html">DEV.BO</a> with the LaunchPad. Likewise, many of you are also wondering how to program the newer MSP430 microcontrollers with the LaunchPad, such as the MSP430F55xx series.<br />
<br />
Since this seems to have sparked quite a bit of confusion, I want to make this post complete and thorough. There are two ways to program an MSP430: the first is using four-wire JTAG, the second is using two-wire JTAG. The LaunchPad can only use the two-wire JTAG method, which is also known as Spy-Bi-Wire (SBW). For the rest of this post, I will be referring to the two-wire JTAG as SBW and four-wire JTAG as just JTAG.<br />
<br />
I want to make sure this is clear before I continue; JTAG and SBW are two separate methods for programming an MSP430. The LaunchPad can program MSP430s using SBW, not JTAG. That being said, not all MSP430s can be programmed using SBW, some of the older MSP430s can only be programmed using JTAG. TI has a document, <a href="http://www.ti.com/lit/pdf/SLAU157" target="_blank">SLAU157</a>, which shows which chips support either just JTAG or both JTAG and SBW.<br />
<br />
Now that we know JTAG and SBW are different methods of programming newer MSP430s, how do we use the LaunchPad to program all these cool devices? Spy-<b><i>Bi</i></b>-Wire needs <b><i>two</i></b> wires to program an MSP430: RST and TEST. The image below shows where you can find these two pins on the Launchpad.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_DzBLb39Lisk_ZI0LoZZ_0GL9dH-is8-plggnwdaEKC6mJarXiXSfFgdrvULiOn2D1y_wNFRqib7AgenFrKy3HA5CB8diiZBDT7sRik2QGUWkKCH0z4itCAL9Hfl40fM5K7yMp9F6do2q/s1600/SBW+on+LaunchPad.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_DzBLb39Lisk_ZI0LoZZ_0GL9dH-is8-plggnwdaEKC6mJarXiXSfFgdrvULiOn2D1y_wNFRqib7AgenFrKy3HA5CB8diiZBDT7sRik2QGUWkKCH0z4itCAL9Hfl40fM5K7yMp9F6do2q/s320/SBW+on+LaunchPad.png" width="260" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The programming pins on the LaunchPad</td></tr>
</tbody></table>
The RST pin is shown by a yellow square, TEST is shown by a green square, and all of the GND pins are shown by blue squares. What about power? Well, you can either use the LaunchPad to power the DEV.BO (or your target MSP430 that supports SBW) or use an external power source. Regardless of how you power the target, you will need to also connect the LaunchPad's GND pin to the target. This is because you need a common reference for the data pins (RST and TEST); so technically you actually need a minimum of three wires to program an MSP430.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidBunVe05HjSeno4Wv34xMWpgPzsW8yxaseCZ6grhP-jysqZM0t7nJE0x9KAntoVnSeyk5k8CfU4DP1dTlTZXEB3u55sQAGT42X-b6flVY5eAmGBIoSZDjpQLlPnHW8PA9l5s-LbCmpYC_/s1600/DEV_BO_Programming.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidBunVe05HjSeno4Wv34xMWpgPzsW8yxaseCZ6grhP-jysqZM0t7nJE0x9KAntoVnSeyk5k8CfU4DP1dTlTZXEB3u55sQAGT42X-b6flVY5eAmGBIoSZDjpQLlPnHW8PA9l5s-LbCmpYC_/s320/DEV_BO_Programming.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DEV.BO programming header</td></tr>
</tbody></table>
For this post we will use the LaunchPad to not only program the DEV.BO, but to also power it during programming. The image above shows which signals make up the programming header on the DEV.BO. There is a reason that I designed the programming header pins in that order. They are the same order as the LaunchPad; this is very important. What about the GND pin on the LaunchPad? Though there is no GND pin on the programming header, the LaunchPad does have a few GND pins available on board. Depending on what you have to connect the boards together, determines which GND you should choose.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXVgFR7OMnWF2C-J6fdda4zbs8p7Bihih1OurbjK2V0TA3DhHTrGzyAgNPxKO_Hc6xMynph62zS2CJxDzNtLLjh1RgnFV8fXAJDVrUzrdQ55KlY4vcW7XlHPCNaI5H7CWnUm6fdLtFOSNd/s1600/LaunchPad+Programming+Wire.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXVgFR7OMnWF2C-J6fdda4zbs8p7Bihih1OurbjK2V0TA3DhHTrGzyAgNPxKO_Hc6xMynph62zS2CJxDzNtLLjh1RgnFV8fXAJDVrUzrdQ55KlY4vcW7XlHPCNaI5H7CWnUm6fdLtFOSNd/s320/LaunchPad+Programming+Wire.jpg" width="257" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The programming connection on the LaunchPad's side</td></tr>
</tbody></table>
The image above shows how I connect the DEV.BOs header to the LaunchPad. That nice six pin rainbow connector is available <a href="http://www.sparkfun.com/products/10366">here at SparkFun</a> and it works great for this task. Notice how I am using female connectors on this LaunchPad which makes it easy for me to connect GND to the rainbow connector using just a short breadboard wire. If you don't have access to this nice rainbow ribbon cable, you can use any method to connect these pins together.<br />
<br />
Hopefully that should clear up any confusion on how to program the DEV.BO. Using this method, you can also program any other MSP430 that supports SBW; just connect up the necessary pins and you can program away.<br />
<br />
I have two last things I want to mention. The RXD and TXD pins are not needed for programming but I included them on the DEV.BO in case they are ever needed for a project. The second thing is that you need to make sure the correct chip is selected in CCS or whatever IDE you use when programming the MSP430, otherwise it probably won't work.<br />
<br />
I hope this clears up any confusion on how to program external MSP430s, including the DEV.BO, using the LaunchPad. Please leave a comment if you have any questions about this post. Don't forget to check out the <a href="http://www.msp430launchpad.com/2011/04/official-version-of-devbo-20.html">DEV.BO</a>, which is available in <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">my online store</a>.<br />
<br />
Comment away!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com22tag:blogger.com,1999:blog-2168992611451428662.post-1592525712307342652011-10-26T19:23:00.000-04:002011-10-26T23:58:43.862-04:00Bluetooth Breakout and Free ShippingI would like add yet another product to <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">my online store</a>, NJC's Bluetooth breakout board. I would also like to announce that there is now free shipping on all orders within the contiguous United States for items on my online store.<br />
<br />
This board is based off of the <a href="http://www.rovingnetworks.com/products/RN_42">RN-42 module</a> which is very easy to use and add to your current projects. A few weeks ago I actually wrote a post on how to add <a href="http://www.google.com/url?sa=t&rct=j&q=bluetooth%20msp430%20launchpad&source=web&cd=5&ved=0CF8QFjAE&url=http%3A%2F%2Fwww.msp430launchpad.com%2F2011%2F08%2Fadding-bluetooth-to-your-msp430-project.html&ei=ST-oTr_2J6n00gHnrrX5DQ&usg=AFQjCNELr1cxhp9Pesb72f5bKLATLjkf-w&sig2=e5RgNRcFMXsJiYmw-p2-Cw">Bluetooth to your MSP430 project</a> that mentioned this breakout board. The circuit board is a modified design of <a href="http://www.sparkfun.com/products/10559">SparkFun's Bluetooth breakout board</a> which adds status LEDs and all the passive comp<span id="goog_613364402"></span><span id="goog_613364403"></span>onents needed to make this board "plug and play" right into your project while keeping all the important yet non-essential pins available. The module is also small enough that it can be added to existing projects with ease.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHk6_Y6phEXgO_viNflrnKMXacUCj8zkmCesvIR4oAGcuazYXDM3OyusE_uvK8VFQBhNDMmqQLYVnc20Dbupn4rc_JAn6mT8eLqqggZdU7MvyLLK_cFZ5AxCLjDW8HTsug_LK_iQawT9k5/s1600/Bluetooth+Populated.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHk6_Y6phEXgO_viNflrnKMXacUCj8zkmCesvIR4oAGcuazYXDM3OyusE_uvK8VFQBhNDMmqQLYVnc20Dbupn4rc_JAn6mT8eLqqggZdU7MvyLLK_cFZ5AxCLjDW8HTsug_LK_iQawT9k5/s320/Bluetooth+Populated.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Populated Bluetooth breakout board</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: -webkit-auto;">
You have two options when buying this board, either completely assembled or as a bare PCB. The completely assembled board is a good option for those of you who don't want to fuss with surface mount components, and want a guaranteed working board. The bare PCB is a great option for those of you who have no problem soldering surface mount components and who want to add Bluetooth to their project while spending as little as possible.</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHz8XRbzNihhviNXjg5MeFzSz26dcOGPeYoS2ILOTrAXKBTT5zPZX5d5tErYQf3afVGA12hk8QsI4wiyX7s_EnjqtCe4oN1V5xUY-wA4DO3dbxuwED6BZHONOnzwYY4nQWuWxX080GHrL6/s1600/Bluetooth+Pinout.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="214" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHz8XRbzNihhviNXjg5MeFzSz26dcOGPeYoS2ILOTrAXKBTT5zPZX5d5tErYQf3afVGA12hk8QsI4wiyX7s_EnjqtCe4oN1V5xUY-wA4DO3dbxuwED6BZHONOnzwYY4nQWuWxX080GHrL6/s320/Bluetooth+Pinout.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Top of the PCB with each pin labeled</td></tr>
</tbody></table>
<br />
The picture above shows the pinout of the board, which should make it very easy for you to incorporate into your project. You just need to connect the RX, TX, 3.3V, and GND to your project, and you are ready to go. The full schematic of the board can be downloaded below.<br />
<br />
Interested? Pick one up at <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">my online store</a>!<br />
<br />
Please let me know if you have any questions!<br />
<br />
<br />
<i><b>Documentation</b></i><br />
<i><a href="http://www.rovingnetworks.com/files/resources/Bluetooth-RN-42-DS.pdf">RN-42 Datasheet</a><br /><a href="http://www.rovingnetworks.com/files/resources/Bluetooth-RN-UM.pdf">RN-42 User Manual</a><br /><a href="https://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/Bluetooth_V1.pdf?attredirects=0&d=1">NJC Bluetooth Breakout Schematic</a></i>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com7tag:blogger.com,1999:blog-2168992611451428662.post-91632647607492046482011-10-13T19:16:00.000-04:002011-10-13T19:16:36.013-04:00Introducing the MAVRKWhat is the <a href="http://processors.wiki.ti.com/index.php/MAVRK_Introduction">MAVRK</a>? MAVRK stands for Module and Versatile Reference Kit. It is a new hardware platform developed by Texas Instruments which will allow you to evaluate almost any configuration of Texas Instruments' products. I have been given the opportunity to evaluate this kit before it is released and will be generating content for the community. This post will introduce you to the MAVRK and give a brief explanation of what the kit is.<br />
<br />
While I am still not sure who Texas Instruments is targeting with this board , I think that professionals, students, and hobbyists all will be able to find some interesting uses for this system.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQY6jYVNlmQkXWODB4SEsrcGloWMsQ77dMULwI27winFPR-QaxWHQff5xCq78fFmQ8wfPoo87IX_LTep5GQgyXPVqvFmRXW1P9w24M55DdlEowYgTe08B8N9s68O8VmSWqThUAa25tkJS1/s1600/P9110034.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQY6jYVNlmQkXWODB4SEsrcGloWMsQ77dMULwI27winFPR-QaxWHQff5xCq78fFmQ8wfPoo87IX_LTep5GQgyXPVqvFmRXW1P9w24M55DdlEowYgTe08B8N9s68O8VmSWqThUAa25tkJS1/s400/P9110034.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">MAVRK with two modules installed.</td></tr>
</tbody></table>
This is a picture of the MAVRK board with two modules installed. I think it's pretty cool looking!<br />
<br />
Instead of trying to explain exactly what the MAVRK is, I will give you a scenario in which you would want to use the MAVRK. Imagine you want to build a quadcopter that can be monitored and/or controlled wirelessly from a nearby computer. Instead of taking lots of time and money building prototype after prototype till you get the design right, you can use the MAVRK. First you would need a motor module, a wireless module (say Wi-Fi for example), an MSP430 module, and a few analog or digital input modules. All of these things TI apparently plans on offering at quite low prices.<br />
<br />
You would plug everything in to the motherboard, hook any accelerometers you have to the input modules, hook a few test motors up to the motor module, and start programming away. The MAVRK programming tool chain is supposed to make the integration of these modules easy and quick. If all goes to plan, you should have a working model within days, not weeks. Now all that is left is to take the MAVRK setup, and turn your working design into a custom PCB; this step should also be easy considering the MAVRK and all the modules are open source, including the hardware.<br />
<br />
I will be started a separate blog about the MAVRK system which will go into more detail about the kit and how to get started with the kit. Stay tuned! Let's see what this baby can do!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com6tag:blogger.com,1999:blog-2168992611451428662.post-20970565698417516152011-08-24T17:30:00.001-04:002011-08-24T18:55:42.413-04:00DEV.BO on eBayAfter receiving some emails from a few readers, I have decided to also sell some of my boards on eBay. I understand that this might be a more comfortable and care-free way of buying my boards. Currently I have posted a <a href="http://www.ebay.com/itm/200645172149?ssPageName=STRK:MESELX:IT&_trksid=p3984.m1555.l2649#ht_592wt_1396">DEV.BO</a> and will be posting some others soon (the list below will be updated as I post boards). If this works out well I will add other boards to my eBay account. Also, I will probably forget to remove the links when the items end; keep that in mind.<br />
<br />
<a href="http://www.ebay.com/itm/200645172149?ssPageName=STRK:MESELX:IT&_trksid=p3984.m1555.l2649#ht_592wt_1396">Click here for the DEV.BO!</a><br />
<a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=200645236496#ht_500wt_1111">Click here for the Bluetooth Breakout!</a><br />
<br />
I have a few posts in the works but if anyone has a suggestion for a simple tutorial or guide, let me know.<br />
<br />
Happy Bidding!!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com0tag:blogger.com,1999:blog-2168992611451428662.post-46702491880158329542011-08-08T17:43:00.000-04:002011-10-31T21:30:53.482-04:00Adding Bluetooth to your MSP430 ProjectMost projects which I have seen input and output some sort of data: be it a multimedia stream, sensor data, or user inputs. In this post I will discuss how to easily make your project Bluetooth enabled. For hobbyists and professionals alike one of the most important aspects of any design is cost; in my own project I had three requirements for a Bluetooth Module, low cost, low size, and very easy to use.<br />
<div>
<br />
The <a href="http://www.rovingnetworks.com/Docs/Bluetooth-RN-42-DS.pdf">RN-42</a> module, which is available at <a href="http://www.sparkfun.com/products/10253">SparkFun</a> electronics and <a href="http://www.mouser.com/search/ProductDetail.aspx?qs=L6Bu%252bmzjsgnB3cElw8OrzA%3D%3D">Mouser</a>, is a very cheap and simple way to use Bluetooth in your project. The best part about the RN-42 module is that it has an integrated antennae and contains everything needed for the Bluetooth protocol. You would be surprised how many modules require a special external microcomputer that contains a Bluetooth stack to operate.<br />
<br />
For how great the module may seen, there are a multitude of downsides. The first is not such a big deal and might not even be a downside for you. The device is in a surface mount package. For those of you who are not making your own PCBs, you can buy one at <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">my online store</a> and be done with it. For those of you on a budget, it is possible to solder wires onto each pad of the RN-42 even though I would not recommend it. The last, and my favorite solution, is to just make a custom PCB for your project and solder on the module yourself. The picture below is of a custom breakout board I made to evaluate the module. The schematic is shown later in this post.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhZYU5eCEb4DK2Nvx0aJxXANAXBEtSFDEY5h-QUEF8qDLgKJsE39jyGZfsyxhJ6gJvOHEpMtMfd2sIxhIShfDpp0_GHO57IYCO9V6t4XrZQsFVuMJE3RGae7DNiokTvGNxrr3VVQRln85u/s1600/IMAG0850.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhZYU5eCEb4DK2Nvx0aJxXANAXBEtSFDEY5h-QUEF8qDLgKJsE39jyGZfsyxhJ6gJvOHEpMtMfd2sIxhIShfDpp0_GHO57IYCO9V6t4XrZQsFVuMJE3RGae7DNiokTvGNxrr3VVQRln85u/s320/IMAG0850.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">My custom breakout board for the RN-42.</td></tr>
</tbody></table>
</div>
<div>
The other negative aspects of this module are its size and maximum baud rate. The module is a little bigger than I would like, but still reasonably small. The device also draws a bit more power than I would like, but all things considered it is not too bad for being a Bluetooth module. What bothers me the most about this device is that the maximum baud rate is very very low. I will discuss this in more detail after I show you how to integrate this device into your project.<br />
<br />
<b>Link Summary</b><br />
<br />
<a href="http://www.sparkfun.com/products/10253">RN-42 at SparkFun</a><br />
<a href="http://www.sparkfun.com/products/10269">RN-42 Breakout at SparkFun</a><br />
<a href="http://www.mouser.com/search/ProductDetail.aspx?qs=L6Bu%252bmzjsgnB3cElw8OrzA%3D%3D">RN-42 at Mouser</a><br />
<a href="http://www.rovingnetworks.com/Docs/Bluetooth-RN-42-DS.pdf">RN-42 Datasheet</a><br />
<a href="http://www.rovingnetworks.com/Docs/Bluetooth-RN-UM.pdf">Roving Networks User Manual</a><br />
<a href="http://www.msp430launchpad.com/2010/08/half-duplex-software-uart-on-launchpad.html">NJC's Software UART</a><br />
<a href="http://realterm.sourceforge.net/">RealTerm</a><br />
<br />
<b>Adding Bluetooth to your Project</b><br />
<br />
The easiest way to send and receive data using this Bluetooth module is to use a <a href="http://www.msp430launchpad.com/2010/08/half-duplex-software-uart-on-launchpad.html">UART </a>connection. The first schematic below, which is based off of the <a href="http://www.rovingnetworks.com/Docs/Bluetooth-RN-42-DS.pdf">datasheet</a> and example schematic from SparkFun, is how I connected the module to my project.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioawRtaqEy5X3YeM1S8mQ55uXieKK9iy46h2X4JCMmt-ErDV9DI_ZbHRV8694hAKERZVCWyXDjXcV-Hp7MIDtElBvTW65rWiUI6RjM3izboAXQzl5G8W1zF36SxKYkMX5vRpZEcI6L1GJL/s1600/Example.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioawRtaqEy5X3YeM1S8mQ55uXieKK9iy46h2X4JCMmt-ErDV9DI_ZbHRV8694hAKERZVCWyXDjXcV-Hp7MIDtElBvTW65rWiUI6RjM3izboAXQzl5G8W1zF36SxKYkMX5vRpZEcI6L1GJL/s400/Example.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A complicated example for hooking up the RN-42 to the MSP430F5510.</td></tr>
</tbody></table>
</div>
<div>
This shows how to connect the RN-42 to an MSP430. Please note that this is just an example and that it is much more complicated than the bare minimum; see the next schematic for the bare minimum needed. The first and most important thing I want to mention is that the device requires a supply voltage between 3V and 3.6V. Luckily I use 3.3V for most of my projects which is perfect for this module.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjnrh7VJOBv0OeY4BbNitvFIgSSfxRsA3VMVbj1ajxdAkrthPCKtDxmfGQ9LaPIqH3aRZS-iYG3pV2WPYNPV_aKZ1Lk5mFLQ3SKO5t_smqSt0KIKS2v4M_tLCUYmfrbd9MHLi1iFrjubc9/s1600/Breakout.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjnrh7VJOBv0OeY4BbNitvFIgSSfxRsA3VMVbj1ajxdAkrthPCKtDxmfGQ9LaPIqH3aRZS-iYG3pV2WPYNPV_aKZ1Lk5mFLQ3SKO5t_smqSt0KIKS2v4M_tLCUYmfrbd9MHLi1iFrjubc9/s400/Breakout.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">My custom breakout board for the RN-42</td></tr>
</tbody></table>
</div>
<div>
The figure above shows the schematic for the breakout board which I used for evaluating the device and shows what kind of connections the module needs in order to function properly. After testing the device thoroughly it was obvious to me that the device is so simple to use that I could have put it in my project right away. The range is quite good and the device is very reliable when using a baud rate of 115200.<br />
<br />
<b>Connecting</b><br />
<br />
Hopefully by now it is clear that from the hardware side of things only a UART connection is needed between the Bluetooth module and your MSP430. What about from the other side of the data stream? The computer. Linking the module to the computer was surprisingly easy. On Windows 7 (I can’t speak for any other OS or version of Windows), it was plug and play. Within a few seconds the drivers were automatically installed and I could see which COM port the module was connected to in the device manager.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCjV4ibToY8kpRXqH7MIKSlUs5WK2ku8tOb3dSv6eVJDM4Qa-fJqTY4FHSSgdNN6_3vy2J0VkuAGoDyPpw1h2MXxori5w93kc4FC54lD_tO5fWFgfH8tzVW_cN88YM2v5u6rk7PBvYmwHf/s1600/Device+Manager.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCjV4ibToY8kpRXqH7MIKSlUs5WK2ku8tOb3dSv6eVJDM4Qa-fJqTY4FHSSgdNN6_3vy2J0VkuAGoDyPpw1h2MXxori5w93kc4FC54lD_tO5fWFgfH8tzVW_cN88YM2v5u6rk7PBvYmwHf/s320/Device+Manager.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The device manager showing the RN-42 connected as COM6.</td></tr>
</tbody></table>
</div>
<div>
As I mentioned before, my terminal program of choice is <a href="http://realterm.sourceforge.net/">Realterm</a>. The first test I recommend completing when setting up the module is a simple echo test. Connect the RX and TX pins on the module together, then set the COM port to the correct port and the baud rate to 115200 baud in your terminal. Once everything is set up and the power is on, wait for the device to connect. If you have the status LEDs connected to the module (which are optional if you are worried about power consumption), the LED connected to PIO2 should turn on when the module is paired with the computer. The other status LED will blink if the device is not connected. Once connected, type a few characters in the terminal and you should receive back every character you typed into the terminal.<br />
<br />
<i>Note: If you are running off of a battery, which you probably are given that this is a post about Bluetooth, you will run into connection issues when the battery is getting low. The module will still turn on and the LEDs will still blink, but you will not be able to reliably connect. If you are having connection issues, check your battery.</i></div>
<div>
<br /></div>
<div>
That should be all that you need to know in order to add Bluetooth to your project. If you think there is something I have missed, let me know and I will add a section to this post.<br />
<br />
<b>Commands?</b><br />
<br />
Yes, this module can accept commands which allow the user to change some important settings. I will not be discussing these commands in this post. You can find all the information you need on this topic in the <a href="http://www.rovingnetworks.com/Docs/Bluetooth-RN-UM.pdf">Roving Networks User Manual</a>.<br />
<br />
<b>Baud Rate Trouble</b><br />
<br />
As I mentioned earlier I want to discuss the problems I have with the data rate of this device. My frustrations really arise from false claims on the specifications of the device from both the manufacturer and vendors. </div>
<div>
<ul>
<li>"Over air data rate of 721kbps to 2.0Mbps" - SparkFun product page</li>
<li>"Data Rate: 1200 bps to 921 Kbps" - Mouser</li>
<li>"Sustained SPP data rates - 240Kbps (slave), 300Kbps (master)" and "HCI data rates - 1.5Mbps sustained, 3.0Mbps burst in HCI mode" - Roving Networks Datasheet for the RN-42</li>
</ul>
The quotes above show where my frustrations originate. To be honest, I am not really sure where SparkFun got their numbers; if I am missing something, please point it out to me. To make things clear, this device really only functions in SPP mode, thus you have a max data rate of 240Kbps if the device is in slave mode. I'm not even sure if it's possible to put the device in HCI mode, apparently it must be done at the factory.<br />
<br />
So the datasheet is clear about the max speeds in each mode, but I am frustrated that they do not make it abundantly clear that the device cannot work in HCI mode. I emailed Roving Networks inquiring about this dilemma I was having (I wanted to use 921600 baud sustained over the air) and though they were friendly, prompt, and reasonably helpful, I was/am not happy with how misleading their datasheets are.<br />
<br />
<i>“The HCI mode is a special build of firmware the needs to be programmed at the factory.” “Please understand that in HCI mode, the bluetooth stack is running on the external host processor and the module is acting as a radio.” </i>All in all, I do commend them on their customer service, just keep in mind that realistically speaking, you will only be able to use SPP mode.<br />
<br />
<b>Conclusions</b><br />
<br />
Despite my frustrations, this is a great solution for making your project wireless. I have found very few chips or modules that can be integrated into a project with such ease. I hope this post helps a few people successfully add Bluetooth to their projects. There are so many cool possibilities for projects when using Bluetooth; the possibilities are endless! Who wouldn't want to hook up a project to an Android phone?<br />
<br />
Comment away! Let me know what projects you have added Bluetooth to!</div>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com20tag:blogger.com,1999:blog-2168992611451428662.post-16195358916362022672011-07-14T15:11:00.003-04:002011-07-14T15:13:40.567-04:00UpdateIt recently came to my attention that my webstore has not been working correctly. Instead of loading the shopping cart when an item was added, the PayPal homepage would be loaded. I believe that I have fixed everything, but please let me know if you have any more problems with the store.<br />
<br />
I apologize to any of you who tried to place an order while the store was not working correctly.<br />
<br />
<b>For any inconvenience this may have caused, all orders placed in the next week will receive an automatic refund of 20% when the item(s) ship. This is valid from 07-14-2011 until 11:59PM-EST 07-21-2011.</b><br />
<br />
Please let me know if you have any questions or concerns.NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com0tag:blogger.com,1999:blog-2168992611451428662.post-20111676678896534242011-06-07T17:13:00.000-04:002011-06-07T17:13:12.915-04:00A Simple LaunchPad DAC<div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: inherit;"><span id="internal-source-marker_0.7491415571421385" style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Here I will show you how to build a simple DAC using just the LaunchPad and a few common analog components!</span></span></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: inherit;"><span id="internal-source-marker_0.7491415571421385" style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It has been quite some time since I have posted some code and after all that has been going on I now have time to write a new technical post! Though I developed this mini-project on the MSP430F5510, I have ported it over to the MSP430G2231 so it can be implemented using just a LaunchPad and some common analog components. This project came about because I wanted to automate signal to noise testing on a product I am making and I did not have the money for a new controllable digital function generator. I needed a way generate a sine wave, then I needed to sweep across a certain small range of frequencies. At each frequency data would be logged and then analyzed in </span><a href="http://en.wikipedia.org/wiki/MATLAB"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">MATLAB</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Sounds complicated, but the principle is very simple. I wanted to build a digital to analog converter (</span><a href="http://en.wikipedia.org/wiki/Digital-to-analog_converter"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">DAC</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) using an MSP430 that can generate periodic waveforms. I came up with this concept and decided to build it mostly out of curiosity since I could have just bought a signal generator chip or high-speed DAC at a very low cost.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This post will show you how to generate a periodic analog signal using the LaunchPad and the </span><a href="http://focus.ti.com/docs/prod/folders/print/msp430g2231.html"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">MSP430G2231</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. For the sake of simplicity, I stuck to the default DCO value. This will allow us to generate a very clean sine wave at 128Hz. If the DCO is increased to 16MHz and a few other design parameters are changed the maximum frequency can be over 4kHz. Using the </span><a href="http://focus.ti.com/docs/prod/folders/print/msp430f5510.html"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">MSP430F5510 </span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I was able to generate a crystal clear 32kHz sine wave.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Why would you want to do this? Well, this code can be modified so any arbitrary analog waveform can be generated (reasonably speaking). At the very least you will learn some interesting analog principles if you decide to build this mini-project.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How it Works</span><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">First I will start out with some theory. The goal here is to generate an analog </span><a href="http://en.wikipedia.org/wiki/Sine"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">sine wave</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (or any signal for that matter). An analog signal, or a continuous signal, is not something which a microcomputer easily works with unless there are analog peripherals to make the job easy. Even then, things are quite discrete. The figures below show a continuous sine wave, and a </span><a href="http://en.wikipedia.org/wiki/Discrete_signal"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">discrete sine wave</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivkwZAiXQ5UBhLctkVuNklHudDVv0zaD_ZDWyjXtq3_F_fysbNcIzZSjilmd8uAUahelLeLLU1C-yqOavm8WUaXoB2nrMv2_42hpfDYMLgPaftL8flH4LoAGt6K77-klU0_z2ILuzNscE9/s1600/analog_sine.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivkwZAiXQ5UBhLctkVuNklHudDVv0zaD_ZDWyjXtq3_F_fysbNcIzZSjilmd8uAUahelLeLLU1C-yqOavm8WUaXoB2nrMv2_42hpfDYMLgPaftL8flH4LoAGt6K77-klU0_z2ILuzNscE9/s320/analog_sine.png" style="cursor: move;" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Continuous Sine Wave</td></tr>
</tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluAzxqDCocuGfLbowKpt3TVX_I7fi4dalOwneevf43_0_ttkryYnKyQSKf-XDKGMJV5tMQgBAu9QqMQ1tWmVgfd9DzZ59NqAChXd6Yl1H_f9_Zijj9WeAFCz2BgjoOgW3Xj16TGo6cxur/s1600/discrete_sine.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluAzxqDCocuGfLbowKpt3TVX_I7fi4dalOwneevf43_0_ttkryYnKyQSKf-XDKGMJV5tMQgBAu9QqMQ1tWmVgfd9DzZ59NqAChXd6Yl1H_f9_Zijj9WeAFCz2BgjoOgW3Xj16TGo6cxur/s320/discrete_sine.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Discrete Sine Wave</td></tr>
</tbody></table><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This is very basic theory, feel free to skip ahead to the code. As you can imagine, the more discrete points per period, the more it looks like a continuous sine wave. The minimum points needed (theoretically) to represent a certain frequency is two (see </span><a href="http://en.wikipedia.org/wiki/Aliasing"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">aliasing</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">). In order to have a clean representation of the signal though, quite a few more than two points are needed. For this post I have chosen to use 32 points per period to make a sine wave for the sake of simplicity. This actually can be reduced which will allow for greater speeds while maintaining very good signal quality.</span><br />
<span class="Apple-style-span" style="font-family: inherit;"> <span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Great, now we know how to make an analog signal from a few analog points, but how do we generate these analog points in time? </span><a href="http://en.wikipedia.org/wiki/Pulse-width_modulation"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">PWM</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. If you are unfamiliar with PWM, please check out an old post of mine </span><a href="http://www.msp430launchpad.com/2010/07/timers-and-clocks-and-pwm-oh-my.html"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">here</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and the </span><a href="http://en.wikipedia.org/wiki/Pulse-width_modulation"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">wiki page</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. By using a digital PWM signal, an analog voltage can be generated which is determined by the duty cycle of the PWM. If you take the average voltage across a single period of PWM by using a capacitor (or low-pass filter) a range of analog values can be generated.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So now we can generate the 32 analog points of our sine by using PWM with a little bit of analog circuitry.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Code</span><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Before we get to the analog circuitry I thought I would discuss the code first. As always, the code is posted </span><a href="https://gist.github.com/1012810"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">here on github</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and is embedded below.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<script src="https://gist.github.com/1012810.js?file=LaunchPad_DAC.c"></script><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">First, I would like to discuss the sine wave look-up table which is at the top of the code. The array is called wave[] and consists of the 32 values we need to make a sine wave. It is important to note that even though we have 256 possible duty cycles when using 256 clock pulses per PWM, we never go above 192 or below 64 (for a range of 128). This is very important since all of the instructions which need to get executed every interrupt take clock cycles of their own. If the duty cycle interrupt happens before the other interrupt routine finished, a pulse is missed and the output signal becomes warped.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The code itself is quite simple because we are simply generating a PWM using interrupt routines. Again, if this code seems very foreign to you, please check out </span><a href="http://www.msp430launchpad.com/2010/07/timers-and-clocks-and-pwm-oh-my.html"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">my post on PWM</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. The important difference between this code and the typical PWM code is that the duty cycle automatically is changed every period.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Every time a new period is started, the interrupt TIMERA0_VECTOR is thrown. Here will increment a counter which keeps place of our position in the sine wave array; we also will reset the counter as needed. The current value which we are going to be outputting is set to the Capture Compare Register 1 (CCR1). Though it is possible to clear or set the output pin without going into an interrupt routine, I thought it was important to show how the CCR1 interrupt is call because it is slightly different than CCR0.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A separate interrupt vector, TIMERA1_VECTOR, is thrown when the timer is equal to the value in CCR1. This is also the interrupt vector that is called for any other CCR registers that may be available on the MSP430 and overflows. For example, the MSP430F5510 has a timer with 7 capture compare registers! To determine which register threw the interrupt you must check the TAIV register. To see which bit corresponds to which capture register, see the datasheet for your device.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Other than that, if you have read my other posts, you should understand the code. If you have any questions, you know the drill.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Analog Circuitry</span><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
</span><span class="Apple-style-span" style="font-family: inherit;"><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The PWM signal will need to be average, or smoothed out. If the high frequency components are removed, only the average signal remains. Lets make a quick example before we get to the physical implementation on a breadboard.</span></span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLkmNu3GaHVxmjtbBVQZ7KJcCopl4n9tpxWqWgCR_vMlxyfe9ld5FO6wMqZ1EJfnLNBucvho_hIXQPUoQ1pfNzLTnDrxAkeX19Bf_t91vGHKNahOIYhgsCDT8f8aUECCo4BSqWv68CbYlP/s1600/modulated.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLkmNu3GaHVxmjtbBVQZ7KJcCopl4n9tpxWqWgCR_vMlxyfe9ld5FO6wMqZ1EJfnLNBucvho_hIXQPUoQ1pfNzLTnDrxAkeX19Bf_t91vGHKNahOIYhgsCDT8f8aUECCo4BSqWv68CbYlP/s320/modulated.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Example Signal</td></tr>
</tbody></table><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The above image shows a </span><a href="http://en.wikipedia.org/wiki/Rectifier"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">rectified </span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sine wave which is made up of multiple higher frequency sine waves (blue). This will allow us to visualize how filtering works. After filtering the signal using a </span><a href="http://en.wikipedia.org/wiki/Low-pass_filter"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">low-pass filter</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, which allow only the frequencies lower than the desired rectified sine wave through; realistically it is not a perfectly sharp cutoff and a little low amplitude high frequency components remain. The result is shown above in green. If this is a bit hard to understand, do not worry, this is just some background theory for those who are interested. Now, let me show you what our actual PWM output will look like for a sine wave.</span><br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: -webkit-auto;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCETVroOEUgiMcxrgmHWittCOxaJVSx2yICcmuiFPKR7IQf8HIrj4wj0nARtydXtm09NkmMvOuvxVpoCdJEAceaQ-5Ve6ovh1P-xQvSjuMbg_u37Yvs5X_BLKwhIhGGZSbvqbpiv3VLg-v/s1600/actual+pwm+and+output.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCETVroOEUgiMcxrgmHWittCOxaJVSx2yICcmuiFPKR7IQf8HIrj4wj0nARtydXtm09NkmMvOuvxVpoCdJEAceaQ-5Ve6ovh1P-xQvSjuMbg_u37Yvs5X_BLKwhIhGGZSbvqbpiv3VLg-v/s320/actual+pwm+and+output.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Actual Theoretical Output</td></tr>
</tbody></table><br />
<span class="Apple-style-span" style="font-family: inherit;"><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The above image shows what our PWM output will actually look like. You can see that there are 32 separate PWM periods which make up the sine wave. Each PWM period consists of 256 clock ticks; thus the final sine wave consists of 32*256 = ~8k clock ticks. The final sine wave output is also shown above in green. This is the result of filtering the PWM output signal. For those who are wondering, all of the graphs above were generated in MATLAB.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Circuit</span><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Great! Now we know how it all works, but how do we actually implement it. I will skip out on filter theory and just present you with a second order low-pass filter</span></span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlUgwMZjX_nBxkP_isDMXacmgEHsaNB22Ud9Ywzp-uj3IgkhPaITbcIkcAtkGieheiOgx_aVUJAd_-Tm-pIbpKNJ2w8QO_2q4j2Wzgh_2aAOUzVUAFVhtqT0tR7wQNLogT8K21AVOCZK5/s1600/SCHEMATIC+BLOG.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="93" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlUgwMZjX_nBxkP_isDMXacmgEHsaNB22Ud9Ywzp-uj3IgkhPaITbcIkcAtkGieheiOgx_aVUJAd_-Tm-pIbpKNJ2w8QO_2q4j2Wzgh_2aAOUzVUAFVhtqT0tR7wQNLogT8K21AVOCZK5/s400/SCHEMATIC+BLOG.JPG" style="cursor: move;" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Analog Circuitry</td></tr>
</tbody></table><span class="Apple-style-span" style="font-family: inherit;"><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Above is the schematic for all of the analog circuitry that is needed. The analog output, when using the code show above, from the MSP430 will be centered at approximately half of the supply voltage. If we wanted to amplify the signal further, we would need a reference voltage for any amplifier circuitry. For this project we will not do that for the sake of simplicity.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now onto the circuit. It consists of two </span><a href="http://en.wikipedia.org/wiki/Low-pass_filter"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">passive, low-pass filters</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> separated by two </span><a href="http://en.wikipedia.org/wiki/Operational_amplifier_applications#Voltage_follower_.28Unity_Buffer_Amplifier.29"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">voltage followers</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (buffers). While it is possible to simply cascade the two filters without the buffers, buffers allow </span><a href="http://en.wikipedia.org/wiki/Impedance_matching"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">impedance matching</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">; a topic which I will not discuss here. Each filter has a </span><a href="http://en.wikipedia.org/wiki/Cutoff_frequency"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">cufoff frequency </span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">of approximately 160Hz ( 1/(2*pi*10k*.1uF) ) which is slightly above the desired sine wave frequency of 128Hz and much less than the PWM frequency of 4kHz (1MHz/256 clock ticks).</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<i><span style="background-color: transparent; color: black; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Note: If you change the timing of the microcomputer to allow for faster or slower sine waves, you MUST also change the </span><a href="http://en.wikipedia.org/wiki/Cutoff_frequency"><span style="background-color: transparent; color: #000099; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">cutoff frequency </span></a><span style="background-color: transparent; color: black; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">of the low-pass filters.</span></i><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Results?</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What does the output look like? This post wouldn’t be complete without some scope captures to show the actual results. I really love when the theory works out and the results can be seen easily. Understanding the theory behind not only digital systems, but also analog circuitry can be a huge help in all sorts of projects.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUnpRRiT4oP6gc4PjXECB8XmSqVcRQxNKL2E7jr8_Bsgstn0jgEYLCFap6VrU1C43Vhg3bZV_fcClpDdrS2sKdhGtPihyphenhyphenKV_WhUN5PxGyLXDRRraq0Mq7RaMPHd_6PgfPwSmSzmw2YQumd/s1600/PWM+and+output+scope.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUnpRRiT4oP6gc4PjXECB8XmSqVcRQxNKL2E7jr8_Bsgstn0jgEYLCFap6VrU1C43Vhg3bZV_fcClpDdrS2sKdhGtPihyphenhyphenKV_WhUN5PxGyLXDRRraq0Mq7RaMPHd_6PgfPwSmSzmw2YQumd/s320/PWM+and+output+scope.png" style="cursor: move;" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Actual PWM Output</td></tr>
</tbody></table><span class="Apple-style-span" style="font-family: inherit;"><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The above image shows both the PWM output from the MSP430 and the sine wave output from the low-pass filters. Very cool! As you can see, the peak to peak voltage of the sine wave is less than the supply voltage (VDD, which is ~3.6V).</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
</span><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-bottom: 0.5em; margin-left: auto; margin-right: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiOE_K685u1uici6VtbAfGum3XZmmWFe-dG9Z3h_b0GGZ3Og1FZC4n789R94VyRj5UyvU2t4POQ1SPkf6rTXCAZBh-kcpqhzwFcCBsM-py3BOngAbj_l9pMdGV1-BjfTzJCDL366cXqcv4/s1600/just+output+scope.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiOE_K685u1uici6VtbAfGum3XZmmWFe-dG9Z3h_b0GGZ3Og1FZC4n789R94VyRj5UyvU2t4POQ1SPkf6rTXCAZBh-kcpqhzwFcCBsM-py3BOngAbj_l9pMdGV1-BjfTzJCDL366cXqcv4/s320/just+output+scope.png" style="cursor: move;" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px; padding-top: 4px; text-align: center;">Sine Wave Output</td></tr>
</tbody></table><span class="Apple-style-span" style="font-family: inherit;"><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The picture above allows you to better see the sine wave output which is 1V peak to peak and 131Hz; it sure looks great! To improve the results, some changes can be made to the project. Less points can be used per sine wave, thus increasing the maximum frequency generated. This makes the output more “jagged” but with correct filtering this would not matter. Further, if you want to increase the peak-to-peak voltage or increase the power for any reason, amplification can be used.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For all the scope measurements I used a </span><a href="http://www.amazon.com/gp/product/B001VK4TI2/ref=as_li_ss_tl?ie=UTF8&tag=msp0d-20&linkCode=as2&camp=217153&creative=399349&creativeASIN=B001VK4TI2"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Rigol Oscilloscope (DS1052E)</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> which I discovered through the </span><a href="http://www.eevblog.com/"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">EEVBlog</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. It is an amazing scope for the price and I would recommend it to anyone. Personally I think it is much better than the really low end Tektronix which are much more expensive, and I much prefer this to older analog scopes.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Final Thoughts</span><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What’s next? It is possible to change the frequency of the sine wave within the MSP430. This could also be the basis for an arbitrary digital function generated using the MSP430. The possibilities are endless! As always, if you have any questions please comment here or email me. If you want a more immediate answer (since I am busy and sometimes take a while to respond) post your question on </span><a href="http://43oh.com/forum"><span style="background-color: transparent; color: #000099; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">43oh.com/forum</span></a><span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Maybe one day soon I will combine the LaunchScope and this project to create a single, simple, controllable, single test board solution using the DEV.BO.</span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">I hope that you found this interesting. I know you all will come up with many cool uses for this project, so please comment and let me know the cool ways which you use the code.</span></span><br />
</div><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com39tag:blogger.com,1999:blog-2168992611451428662.post-2205517131293513182011-04-26T21:23:00.001-04:002011-05-01T17:35:54.407-04:00NJC's MSP430 Store Is Open For Business!Today I opened my new <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">online store!</a> The<a href="http://www.msp430launchpad.com/2011/04/official-version-of-devbo-20.html"> DEV.BO</a> is the first item in the store, and a breakout board for the MSP430F5510 called the <a href="http://www.msp430launchpad.com/2011/04/new-dev-devbreak.html">DEV.BREAK</a> is the second. The two posts before this one provide details of the two items. Please make sure you read the important information at the top of the store before you buy anything.<br />
<br />
Now that the <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">store</a> has been opened, I will be writing more technical posts which show off some cool things the LaunchPad and other MSP430s can do.<br />
<br />
Please note that all these prices are introductory and are subject to change. If you have any questions, please contact me via email: webmaster (at) msp430launchpad (dot) com.<br />
<br />
Check it out!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com3tag:blogger.com,1999:blog-2168992611451428662.post-493334105718458092011-04-26T21:22:00.002-04:002011-04-26T21:25:19.295-04:00The Official Version of the DEV.BO (2.0)Version 2.0 of the DEV.BO is now for sale in my <a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html">online store</a>!<br />
<div><br />
</div><div>The DEV.BO is a development board based off of the <a href="http://focus.ti.com/docs/prod/folders/print/msp430f5510.html">MSP430F5510</a>. This board can easily be programmed using the <a href="https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx">LaunchPad</a> or any MSP430 JTAG programmer. Click <a href="http://www.msp430launchpad.com/2011/03/devbo-is-born.html">here </a>to see the post on the older DEV.BO.</div><div><br />
<br />
<div style="background-color: transparent;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img height="400" id="internal-source-marker_0.13337405328638852" src="https://lh6.googleusercontent.com/Yt5MPTWa2u5Puz_MZtSNJuCWhTBSXmvgG0fJtcHehY1GfWb9g1wK3L3eXfff2oZVUGZJTlR0v1PPaBiSzsGTJBe2UJfMNECYP9wkAcHo6N6w4ruwX9s" style="margin-left: auto; margin-right: auto;" width="226" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DEV.BO Ver. 2.0 - Please ignore the flux residue on the board. I am out of flux remover and am expecting more in the mail soon.</td></tr>
</tbody></table></div><b><br />
</b><br />
<b>Features and Specs</b></div><div><ul><li>Based on the MSP430F5510</li>
<ul><li>Max clock speed of 25MHz</li>
<li>Integrated 32kHz crystal</li>
<li>Broad supply voltage range - 1.8 V to 3.6 V </li>
<li>25K of flash memory</li>
<li>1 USCI_A (UART/LIN/IrDA/SPI)</li>
<li>1 USCI_B (I2C/SPI)</li>
<li>2 16-bit (3CCR), 1 16-bit (5CCR), 1 16-bit (7CCR)</li>
<li>10-bit SAR ADC</li>
<li>Internal temperature sensor</li>
<li>Hardware multiplier</li>
<li>Much more!</li>
</ul><li>Connectors for both SBW and JTAG</li>
<ul><li>The SBW is made for easy connection to the LaunchPad</li>
</ul><li>USB interface (FTDI323RL)</li>
<li>On board reset button</li>
<li>1 programmable push button</li>
<li>1 programmable LED</li>
<li>Easy to use jumpers for disabling all non-mandatory circuitry</li>
<li>Extra power connectors for expansion boards</li>
</ul><br />
<b>Available Documentation</b><br />
<ul><li><a href="http://focus.ti.com/lit/ds/symlink/msp430f5510.pdf">MSP430F5510 Datasheet</a></li>
<li><a href="http://www.ti.com/litv/pdf/slau208h">MSP430x5xx/MSP430x6xx Family User's Guide</a></li>
<li><a href="http://www.ti.com/litv/zip/slac394c">TI's MSP430F5510 Example Code</a></li>
<li><a href="https://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/DEV_BO_V2Schematic.pdf">DEV.BO Ver. 2.0 Schematic</a></li>
<li><a href="http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf">FTDI FT232RL Datasheet</a></li>
<li><a href="https://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/NJCsDEV_BOPackage20110426.zip">NJC's DEV.BO Package </a>(includes all the above documents as of April 2011)</li>
</ul><br />
<b>Bare PCB (Unassembled) - $15</b><br />
<br />
If you have all the tools you need to solder one up yourself, already have an MSP430F5510 from TI's free sample program, and all of the other parts needed, you can buy just the bare unassembled PCB. The handling time will also greatly reduced if you buy the bare board. Please note, that if you select this option, you will receive no components, you will only receive the PCB.<br />
<br />
<br />
<b>Without FTDI USB (MSP430 Assembled) - $35</b><br />
<br />
This option is for those of you who do not need USB communication abilities and just want to use the MSP430F5510. If you select this option, you will receive a mostly assembled PCB. Everything needed to program and use the MSP430F5510 will be soldered onto the board but everything relating to the FTDI USB circuit (including the USB connector and the FTDI jumpers) will not be soldered to the board, and the parts will not be included. Male headers are also provided to connect to the MSP430's pins (the headers will not be soldered onto the board).<br />
<br />
<br />
<b>Full Board (Assembled) - $45</b><br />
<br />
This option comes with everything already soldered onto the board. Male headers will also be included to connect to the MSP430's pins, but they are not soldered onto the board.<br />
<br />
<br />
<b>Example Code</b><br />
<br />
Every DEV.BO which will have the MSP430 F5510 soldered onto it (Options: Without FTDI USB and Full Board) will come with a modified version of the <a href="http://www.msp430launchpad.com/2010/12/njcs-launchscope-launchpad-oscilloscope.html">LaunchScope </a>code which samples at a rate of 4kHz. This code will be released as it's own post in the upcoming weeks once I have a chance to fully document it.</div>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com10tag:blogger.com,1999:blog-2168992611451428662.post-44510853931106691582011-04-26T21:21:00.001-04:002011-04-26T21:25:42.587-04:00A New DEV - The DEV.BREAKThe second product available in my new<a href="http://www.msp430launchpad.com/p/njcs-msp430-store.html"> online store</a> is the DEV.BREAK! This board is simply a breakout board for the MSP430F5510 (or really any other chip with the 48LQFP package).<br />
<br />
Do you want to build a small project on a breadboard with one of the most powerful MSP430s out there? Then this board is for you!<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihrlJIud0yFiqrf9gVZIrxbFAlIufPXOuvMpoDDPGehpP6ee0-Kr3pDMlnlA0MOrqRiQXV72B5luSsY82bAoEakVXsM0E_gCT2f4XYPPN5OB5OlABJlPV9fv6kLwrE1E9h_jtzYa8FMHyg/s1600/DEV_BREAK_V1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihrlJIud0yFiqrf9gVZIrxbFAlIufPXOuvMpoDDPGehpP6ee0-Kr3pDMlnlA0MOrqRiQXV72B5luSsY82bAoEakVXsM0E_gCT2f4XYPPN5OB5OlABJlPV9fv6kLwrE1E9h_jtzYa8FMHyg/s320/DEV_BREAK_V1.jpg" width="136" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The bare DEV.BREAK PCB</td></tr>
</tbody></table>This board doesn't require much explanation as it just breaks out all of the MSP430F5510's pins to a breadboard-able size. In a standard breadboard the DEV.BREAK leaves room for one row of wires on each side.<br />
<br />
<b>Purchasing Options</b><br />
<br />
There are two options when purchasing this board. The first is to simply purchase the bare PCB for $9 with no chip soldered on, you will receive only the PCB (no MSP430 or headers). The second option is to buy the PCB with the MSP430 soldered onto it with headers included (but not soldered) for $20.NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com2tag:blogger.com,1999:blog-2168992611451428662.post-80656055001076807692011-04-12T13:53:00.000-04:002011-04-12T13:53:51.287-04:00Housekeeping and a StoreI have just finished created a page which lists the most popular and important past posts. There are many times where I am asked a question on a newer posts which I answered at length in a previous post. Hopefully this page is found to be useful for many of you. If you find any typos anywhere, please let me know. As always, feel free to contact me via email: webmaster <i>at </i>msp430launchpad <i>dot</i> com.<br />
<br />
Lately I have been putting my efforts into updating the look and feel of my blog to make it a bit more reader friendly. There is still much work to be done to make the new template really look and feel good, but I feel like I have made a lot of progress on organizing the blog and getting ready for the future.<br />
<br />
One of the things which I have been working on behind the scenes, is a small web store where I will be selling a few boards I have created. This includes the DEV.BO, which I wrote about <a href="http://www.blogger.com/">here</a>, and a few other simple breakout boards which are pertinent to the LaunchPad and the MSP430.<br />
<br />
Let me know what you think and stay tuned...NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com3tag:blogger.com,1999:blog-2168992611451428662.post-28201124723129942742011-03-23T19:50:00.000-04:002011-03-23T19:50:50.624-04:00Appearance ChangeI finally got around to changing the template for the blog since I was not happy with how the old version looked. Now everything should be a bit easier on the eyes and hyperlinks show up much better now.<br />
<br />
Please let me know if there is anything I forgot to change or something else that I did not notice. Hope you like it!NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com0tag:blogger.com,1999:blog-2168992611451428662.post-56835594948291837032011-03-20T01:18:00.002-04:002011-03-20T01:20:41.086-04:00The DEV.BO is Born!I would like to introduce you all to the DEV.BO prototype. This board is built around the MSP430F5510, it not only includes the typical on-board items, but also an FTDI chip.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxrX-_3BsBtSODIRCyEfqbD1oULlqTmQ1P-tNcPfoRaQgbVeB5hWx8SGPZFU98UNbBhdRN4yXeJEB1QIWAZQVJuq5_2IKEeLOpxchkl7qbDpQ2nC17wBfEn7365S7reKkMtM5E-8DxqGxS/s1600/NJC+DEV20110302_04.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxrX-_3BsBtSODIRCyEfqbD1oULlqTmQ1P-tNcPfoRaQgbVeB5hWx8SGPZFU98UNbBhdRN4yXeJEB1QIWAZQVJuq5_2IKEeLOpxchkl7qbDpQ2nC17wBfEn7365S7reKkMtM5E-8DxqGxS/s400/NJC+DEV20110302_04.JPG" width="347" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The Dev.BO</td></tr>
</tbody></table>As I have mentioned in previous posts, I was using the MSP430F5528 in a personal project of mine (which I will be posting when I have more time). TI just released a new set of chips in the MSP430F55xx series, one of which caught my eye, the MSP430F5510. This chip has all of the features I needed the 5528 for, but is half the price! Granted the 5510 does has less memory and a less precise ADC (and is lacking a few other things) but this was not important to my project.<br />
<br />
<i>Note: The MSP430F5510 on the DEV.BO is the 48 pin version which has a bit less peripherals than the larger sized MSP4305510 package.</i><br />
<br />
I needed to get a board made for my project and decided to just go ahead and make a small target board which I might start selling if all goes well. Keep in mind this just a prototype and I need to test at least one more version before I can start selling them.<br />
<br />
<b>Some DEV.BO’s Features</b><br />
<ul><li>Based on the MSP430F5510</li>
<ul><li>Max clock speed of 25MHz</li>
<li>Integrated 32kHz crystal</li>
<li>25K of flash memory</li>
<li>1 USCI_A (UART/LIN/IrDA/SPI)</li>
<li>1 USCI_B (I2C/SPI)</li>
<li>2 16-bit (3CCR), 1 16-bit (5CCR), 1 16-bit (7CCR)</li>
<li>10-bit SAR ADC</li>
<li>Much more!</li>
</ul><li>Connectors for both SBW and JTAG</li>
<li>USB interface (FTDI323RL)</li>
<li>1 programmable push button</li>
<li>1 programmable LED</li>
<li>Much more!</li>
</ul><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2YI4dBWlz7UrNJZzhq-74wGg-Wrrf6Ye0Xu3JkSO3wLENDqbrCxsyRqOXyaSqdVch8_oRf6CiRAxCJ_IbVUp5LTixgfJQ3S5C7Y9hw8ND8_GAQdWeLXY2bCU9Qw5xStG3trQ_DW0f9FDc/s1600/NJC+DEV20110302_11.JPG" imageanchor="1"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2YI4dBWlz7UrNJZzhq-74wGg-Wrrf6Ye0Xu3JkSO3wLENDqbrCxsyRqOXyaSqdVch8_oRf6CiRAxCJ_IbVUp5LTixgfJQ3S5C7Y9hw8ND8_GAQdWeLXY2bCU9Qw5xStG3trQ_DW0f9FDc/s320/NJC+DEV20110302_11.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DEV.BO size comparison</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: left;">As you can see in the picture above, it is quite small. For me, it replaces the MSP430F5528 target board on the right and the FTDI breakout board from <a href="http://www.sparkfun.com/products/718">SparkFun </a>on the upper left.</div><br />
I am still here and working hard, sorry that my last posts have been quite sporadic. I love how the DEV.BO came out and am excited to get it more finalized in the upcoming weeks. It makes programming the 5510 a breeze because of how simple it is to connect to the LaunchPad. I was very frustrated with my MSP430F5528 target board and how many wires I needed to get things up and running. Mouser just got the MSP430F5510 (in the correct package) in stock, so I can start pushing things along.<br />
<br />
The reason I wanted to post this now was because my next two posts will be about one of my latest mini projects - a heart beat detection algorithm implemented on an MSP430F55xx. Once I finish those posts I will delve into the details of I2C because it can be a very confusing topic for beginners (and even advanced developers!).NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com12tag:blogger.com,1999:blog-2168992611451428662.post-4371653300174804062011-01-09T15:06:00.002-05:002011-01-09T15:07:20.379-05:00Getting a PCB MadeI was recently asked where I get my PCBs made and realized that many people do not know of the great online PCB services which are available to hobbyists.<br />
<br />
A few months ago I needed to get a PCB made for the first time in years and started the search for cheap places to get my board manufactured quickly with reasonable tolerances. I needed small quantities of a duel layer, surface mount, board with solder-mask and silkscreen on both sides. This usually adds more money to a PCB order than I was willing to spend on my small quick prototype board.<br />
<br />
I found three services which met my cost requirements and did not have an unreasonable lead time. Here are my thoughts and a review on the PCB service I used.<br />
<br />
<b>MakePCB.com</b><br />
<br />
<a href="http://makepcb.com/">http://makepcb.com/</a><br />
<br />
This was the first board house I found which has reasonable pricing and a simple online quote system that you do not need to sign up for. I hate those websites where you have to give your personal information in order to receive a quote. This option seemed to be the best for me while I was living abroad since shipping to Europe was the same as the US. I ended up not using this service because there was no information on the website about how long it takes get your board. The major benefit to using this service is that if you want medium sized quantities the pricing scales very well. Check out their online <a href="http://makepcb.com/">quote calculator</a>.<br />
<br />
If anyone has used this service, send me a note or comment here. I'm very interested to see if anyone has had a good experience with this board house.<br />
<br />
<b>BatchPCB<br />
</b><br />
<a href="http://batchpcb.com/">http://batchpcb.com</a><br />
<br />
This is a service run by SparkFun electronics and seems to be a great option when you do not need a board quickly. As with MakePCB, I ended up not using this service. On their FAQ page they say that it takes anywhere from 3 weeks to 4 weeks to receive your board. For the price this is very reasonable - considering most hobby projects are usually not time critical. One great feature of this website is that they save your board design and you can get new boards made at less cost; you can even sell your designs!<br />
<br />
The pricing is "$10 setup fee (shown as a handling charge) - $2.50 per square inch for 2 layer designs". This makes the pricing better for larger boards than the last service I mention here.<br />
<br />
This site has great reviews from a multitude of people. Check out <a href="http://forum.sparkfun.com/viewforum.php?f=16">this forum</a> for more reviews and information on the service.<br />
<br />
<b>Dorkbot PCB Group Order<br />
</b><br />
<b><span class="Apple-style-span" style="font-weight: normal;"><a href="http://dorkbotpdx.org/wiki/pcb_order">http://dorkbotpdx.org/wiki/pcb_order</a></span></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://content.laen.org/dorkbotpdx/pcb_order.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="462" src="http://content.laen.org/dorkbotpdx/pcb_order.png" width="520" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;">(Image from <a href="http://dorkbotpdx.org/wiki/pcb_order">http://dorkbotpdx.org/wiki/pcb_order</a>)</div><br />
This service works in a similar way as BatchPCB does. The person who runs the website fills up a large panel with multiple orders from hobbyists in order to keep costs very low. They are very helpful and answered all the questions I had; they also check to make sure your design is saved in the right format for their process and the boards are spaced properly. They send the boards out as soon as a panel fills up or a certain date has passed. Recently the boards have been filling up quickly and there has been more than one order per month.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0Qm6i7ZH0_C1pPJRhz9XINhAzU2mqzA8u93_6oUKDi70aX_1glFQx9QSiB-WEhhsX8WNnZK84xUXudf4n_5_pfW9ZFsvXgv8uMXbl7N5ANBlzbaBjigj2E3pE5mcQB7DxOajUAazOw7mU/s1600/IMAG0061.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0Qm6i7ZH0_C1pPJRhz9XINhAzU2mqzA8u93_6oUKDi70aX_1glFQx9QSiB-WEhhsX8WNnZK84xUXudf4n_5_pfW9ZFsvXgv8uMXbl7N5ANBlzbaBjigj2E3pE5mcQB7DxOajUAazOw7mU/s320/IMAG0061.jpg" width="308" /></a></div><br />
This service is great for very small sized boards, which is a major reason I used this site for my boards. My board size was slightly more than 4 square inches and my design was ready a few days before the panel was due to go out. The overall lead time once the panel is sent out, is about 2 weeks. This works great if you can plan to have your board ready a few days before the panel goes out.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7k-TD9echtr-DZAm82PInW50GarT1HB9uQOQ6eO6EljrDZ5xz0BQzXX5z0rICvhQ2gP6zuomySvrDSiO4s9Mrad-iP5M-jkd0FUUzPqMTxfNvSUDIGdOStx1x5wLKYVntrIA71zWnbJjv/s1600/IMAG0067.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7k-TD9echtr-DZAm82PInW50GarT1HB9uQOQ6eO6EljrDZ5xz0BQzXX5z0rICvhQ2gP6zuomySvrDSiO4s9Mrad-iP5M-jkd0FUUzPqMTxfNvSUDIGdOStx1x5wLKYVntrIA71zWnbJjv/s200/IMAG0067.jpg" width="200" /></a></div><br />
<br />
I received three copies of my board which can be seen in the previous two pictures. The solder-mask was purple (which looks awesome by the way), the silkscreen is clear and readable, and the boards work perfectly! The build quality was spectacular and I am very impressed. I <u>HIGHLY</u> recommend this service to anyone who wants a PCB made. Like BatchPCB they also have a 4-layer service. International shipping is also very reasonable.<br />
<br />
I also wanted to thank <a href="http://blog.docstech.net/2010/08/30/measure-three-times-fab-once/">Doc</a> for telling me about this service. As you can see by his blog post, it is very important to double and triple check a design before it is sent off to the board house. :-)<br />
<br />
<b>Final Thoughts<br />
</b><br />
<b><span class="Apple-style-span" style="font-weight: normal;">On a side note, my larger board (which can be seen in the pictures above) does have an MSP430 on it. The design uses a MSP430F2013 with the GND, RST, and TEST pins brought out through headers for programming.</span></b><br />
<br />
I hope some of you find this information useful and possibly end up turning one of your small projects into a real permanent "product". It's very rewarding to see one of your designs working on a PCB. If you have used any other great cheap services, comment away.NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com10tag:blogger.com,1999:blog-2168992611451428662.post-69259739703662799092010-12-23T20:51:00.140-05:002012-01-26T12:40:48.079-05:00NJC's LaunchScope (A LaunchPad Oscilloscope)After getting caught up on 43oh.com I am ready to get back to work! For all of you who have been patiently waiting for the final post in the oscilloscope project, it is here. I introduce to you, the LaunchScope. In this post I will present the code for implementing an oscilloscope (a slow oscilloscope) using only the LaunchPad and the MSP430G2231 that comes with it, in addition to providing the source code for the computer application I wrote to go along with the hardware.<br />
<br />
<b>Background</b><br />
<br />
I originally built this project a few months ago for the MSP430F5528 for testing my own project which involved data acquisition of biomedical related signals. The 5528 has a built in USB and as such I could use a reasonably high sample rate; when using the LaunchPad though, one is seriously limited by the speeds at which you can transmit data out. As I've mentioned in <a href="http://www.msp430launchpad.com/2010/08/using-usi-as-uart.html">one of my other posts</a>, it's possible to use the SPI as a quasi-hardware UART for high speed transmission; this would allow you to use a much higher sample rate.<br />
<br />
There is very little code on the microcomputer that needs to be added from the last post, all that is missing is the code for continuous reading of the analog channel. In addition to the functions needed for starting and stopping the ADC, the start and stop codes sent to the chip need to be handled.<br />
<br />
The <a href="http://www.msp430launchpad.com/2010/09/simple-adc-example-on-launchpad.html">last post</a> implemented a speed test which shows you how fast your setup is capable of transmitting data; this value will be used to determine the sample rate of the microcomputer. It is important to not sample at a rate higher than you can process the data because in addition to timing troubles you will end up missing and dropping samples, which could be detrimental depending on the application. Additionally, the code presented in last post can measure a single channel’s voltage using the MSP430F2231; the channels measured were one external channel (A3), the internal temperature sensor, and the internal VCC measure.<br />
<br />
I was asked a question in a comment on my previous post, where the analog pin A3 is and I would like to explain that a little bit here before we get started. Almost every pin on all of the MSP430s have multiple functions, these functions can be found in the chips datasheet (not the family guide). For the MSP430F2231 which is the chip used with this series of posts, this can be found on page 6 in <a href="http://focus.ti.com/lit/ds/symlink/msp430g2231.pdf">the datasheet</a>. Here we can see that in the 14 pin version of the chip pin 5 is not only P1.3, but also ADC10CLK, A3, VREF--, and VEREF. The explanations of each purpose is also included in this table. The datasheet is one of the most useful resources you will have; everyone should have the <a href="http://focus.ti.com/lit/ds/symlink/msp430g2231.pdf">datasheet</a> and <a href="http://focus.ti.com/lit/ug/slau144f/slau144f.pdf">family guide</a> easily accessible during development.<br />
<br />
<b>The Computer Application</b><br />
<div>
<b><br />
</b></div>
<div>
Find the .zip file of my project <a href="https://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/NJCs%20MSP430%20LaunchScope.zip?attredirects=0&d=1">here</a>.<br />
<br />
Find just the install for the application <a href="https://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/LaunchScopeInstall.zip?attredirects=0&d=1">here</a>. <i>(Note: No promises that this will work for you)</i><br />
<br />
I have decided to post the source code for my computer application since I know how useful it might be to many of you. The reason I was hesitant to post the code is because I do not document and comment my C# code as well as I do my MSP430 code. For anyone who downloads and uses my C# application, please do not expect well documented and commented code, though I will do my best to answer your questions on the <a href="http://43oh.com/forum">43oh.com/forum</a>. Also, as with all of my code I ask anyone who uses it to mention in the code and anywhere it may be published or posted to site my blog and give me credit for whatever I have written. This includes the software UART and any other functions which I have specifically written.<br />
<br />
The computer application looks the same as the one I posted previously, except now the streaming buttons are not greyed out. The main difference is the oscilloscope code which will display a waveform in real time on the screen quite beautifully. Back when I needed this code for my own project I was writing my own library for displaying the waveform but was never happy with the results. I found this <a href="http://code.google.com/p/daq32datalogger11072010sohm">DAQ32datalogger project</a> online which utilized <a href="http://www.oscilloscope-lib.com/">Berstein's library</a> for real time waveform displays. The first link was for a research project testing the use of multiple accelerometers for replacing gyroscopes in real world applications. I was very impressed with his code and really recommend that you all take a look at his <a href="http://www.youtube.com/watch?v=g_C-L97l_XI">YouTube video</a> which he links to on his site. The project utilized 32 accelerometer channels and displays all of them in real time on his PC. I emailed the author a few months ago and he is happy that his code is being utilized by others. If you use this code, <u>PLEASE</u> give credit where credit is due, his and Berstein's code is amazingly useful and helpful.<br />
<br />
It is important to note that this library has much more potential and can do so much more than I use it for here. Eventually I plan on using this code for monitoring multiple bio-potential signals in real time. The image below is taken from Berstein’s <a href="http://www.oscilloscope-lib.com/">website</a>.<br />
<br />
<div>
<img height="275" src="https://lh3.googleusercontent.com/jVnrHF-LhGlEJbQfGAB6bwOUb4mI1v6GH7Za7ujJ_AmB0AG8dDw91elC2jVGaGq9QR-mRUkWHuWrBlYMxL9GQnoD30xV8m1KHu47fXWCMoeNcXT07S8" width="400" /><br />
<br />
<i>Note: I will not be discussing how this code works because this is a LaunchPad blog and not a C# blog. I am posting this code for those who already know C# or would like to change bits of the source code for their own projects. Keep in mind, this software is far from a polished program, I am using this for my own personal projects and wanted to share it with all of you. </i><br />
<br />
<b>The Code</b><br />
<b><br />
</b></div>
<div>
Also posted <a href="https://gist.github.com/753207">here</a> on github.<br />
<br /></div>
<br />
<div style="height: 1200px; overflow: scroll; width: 550px;">
<script src="https://gist.github.com/753207.js?file=gistfile1.cpp">
</script></div>
<div>
<br />
<b>Setting up the ADC and the Sample Rate</b><br />
<br />
What will look the most unfamiliar to someone who has followed my blog up till this point is the streaming ADC function Start_Stream(unsigned int chan), here I set all the necessary values for the ADC stream. There should be only two lines which are unfamiliar to you which I used in this function.<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>ADC10CTL0 = ADC10ON + ADC10SHT_3 + MSC+ ADC10IE;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>ADC10CTL1 = ADC10SSEL_3 + chan + ADC10DIV_7 + CONSEQ_2;<br />
<br />
The first line will, turn on the ADC, set the sample and hold time to 64 clock cycles (which can be thought of as yet another divider for the ADC sample rate), sets the device to do multiple samples and conversions, and finally enables the interrupt. The second line selects which clock to use (the SMCLK), sets the channel to use (which is the ‘chan’ input from the function), sets the clock divider to SMCLK/8, and finally tells the ADC to sample a single channel consecutively.<br />
<br />
As I already mentioned, it is important to make sure the sampling rate is low enough for the application UART to send every sample to the PC. Using my code the speed test on my application showed 6.21 kbps. Due to the fact that we are using an ADC that has a 10 bit vertical resolutions, we will need to send every sample as two bytes thus sending 16 bits of data per sample. So to calculate our max sample rate (which we should be a bit under just in case), we divide our data rate by our bits needing to be sent per sample, 6.21kbps / 16 bits = 397.44 Hz.<br />
<br />
<i>EDIT (01-26-2012): I would like to correct a mistake that was found in the following paragraph by one of my readers. The problem is with the calculated sample rate. Instead of the equation being SMCLK/8/64/13, it should be SMCLK/8/(64+13). This is because the sample and hold time and the conversion time add together, determining the number of clock samples needed per conversion. This gives us a sample rate of approximately 1.6kHz, a value significantly greater than it should be. That being said, the code will still function, the reasons behind this is a bit complicated and won't be discussed here. Just know that some samples are being dropped and the actual transmission rate is closer to ~450 samples per second. Expect to see a new post in the future with updated code. Sorry for the error!</i><br />
<br />
Our sample rate as set it in the Start_Stream() function is SMCLK/8/64/13. The 8 comes from the clock divider, the 64 comes from the sample and hold time, and the 13 comes from the number of clock cycles it takes to do an actual conversion. This value can be found in the datasheet on page 32 under “10-bit ADC, timing parameters -- MSP430G2x31 only”. SMCLK = 1000kHz (1MHz), so our sample rate is 1000/8/64/13 = 0.150kHz or 150Hz. This is much less than half of our maximum, so we are well within the limit of safety.</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ADC10CTL0 &= ~ENC;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ADC10CTL0 &= ~ADC10SC;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ADC10CTL0 &= ~ADC10ON;</div>
</div>
<div>
<br /></div>
<div>
These three lines of code are what make up the Stop_Stream() function. It is important to note that ENC needs to be cleared first before any of the other values in ADC10CTL0 can be written. Once that is cleared, the conversion is stopped and the ADC is turned off to save power.<br />
<br />
<b>Why Have Commands?</b><br />
<br />
Why not just make the chip constantly send out the data stream of the analog channel conversion results? All we want is an oscilloscope, so why need all of these weird command things? First, if you wanted to do that you would not use an MSP430 but rather you would use a nice and cheap ADC that has a UART out. We also have a built in temperature sensor, and internal VCC measurements which allow us to know almost exactly what voltage is being read by the ADC. Second, it is much easier to interface with a computer application when the program has control over the data flow. Without these commands the application would have a hard time making sure all the data is being received correctly and would not be able to read any of these other nice values the MSP430 can provide.<br />
<br />
<b>Improving the Design </b><br />
<br />
The biggest improvement which I’m sure everyone would like to see is an increase in sampling speed. I will not be doing a post on a faster scope design because it should be very easy to scale this code to faster speeds. If you decide to use an FTDI chip instead of the application UART you can recalculate the maximum speed the software UART can transmit at, then reconfigure the ADC to sample at a certain speed using the method I used in this post. If you would like to use an MSP430F5528 to increase speed, send me an email and I can send you the original source code this project was build from.<br />
<br />
<b>Final Thoughts</b><br />
<br />
I hope you all enjoyed this series and find the LaunchScope useful. I have been and will be very busy in the upcoming months since I am leading a “Senior Design” project for my university. The project does utilize multiple MSP430s and I will be doing my best to post more guides on topics which come up during the course of my work.<br />
<br />
Before I finish I have an unrelated question for any of my readers which might have experience with Actel FPGAs. I am thinking of using an Actel FPGA for a project and was wondering if anyone has had any experience with Actel FPGAs. I have only used Xilinx and Altera but saw that Actel has very cheap and low powered FPGAs. Any opinion on Actel chips would be greatly appreciated. Email me, <a href="mailto:webmaster@msp430launchpad.com">webmaster@msp430launchpad.com</a>.<br />
<br />
Again, sorry for the delay, but I hope the wait was worth it. When I get around to it, the next post will discuss communication between two (maybe three) LaunchPads using I2C. If you have any simple questions about the post feel free to comment and I will do my best to answer any questions. If you have a complex question or would like some help with your code check out <a href="http://43oh.com/forum">43oh.com/forum</a>, they have a great forum which I check when I can.<br />
<br /></div>
<div>
As always, comment away! Let me know what you think of the project. If you used the LaunchScope or the code from this series for anything cool, post a comment about it. Stay tuned, I will be writing more posts.</div>
</div>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com36tag:blogger.com,1999:blog-2168992611451428662.post-9993684883485952782010-09-14T10:59:00.033-04:002010-09-25T13:54:29.634-04:00A Simple ADC Example on the LaunchPadI finally have had the time to write up this post. Hopefully in a few more weeks I will have more time and can keep up a steady stream of posts like I was doing before.<br /><p class="MsoNormal"><span style="" lang="EN-US">As promised in the last post, this post will discuss the basics of the ADC10 peripheral in the G2231 which comes with the LaunchPad. The code will allow the microcomputer to accept simple ASCII commands sent over the LaunchPad's UART from a computer, and act on those commands. Four commands are implemented for this post; there will be two more in the next post which will add streaming functionality to the code.<br /><br /><b>The Functionality</b><br /><br />The first command tests the overall data throughput we can achieve with the microcomputer. I think this is very important since it allows us to see how well our device is performing, and allows us to determine how fast the ADC should sample in real time. The second command uses a built in voltage divider to measure VCC in relation to an internal reference. The third command measures the internal temperature sensor in relation to a different internal reference. The final command measures the voltage on an external pin, in this case A3 in relation to VCC. Note that this code does not continually sample the ADC channels but will only sample once per command. The next post will discuss continuous sampling of a single channel, which will allow us to build a simple (slow) oscilloscope using only the LaunchPad.<br /><br /><b>Computer Application</b><br /><br />To accompany the code on the MSP430 I have written a simple </span><span lang="EN-US"><a href="http://sites.google.com/a/msp430launchpad.com/njs-s-msp430-launchpad-blog-files/NJCADCBlogFiles.zip?attredirects=0&d=1">computer application</a></span><span style="" lang="EN-US"> using C# which will allow us to easily interface with the device so we do not have to play around with terminal programs. If any of your projects require a computer interface I highly recommend writing a custom application, I really hate fiddling around with terminal programs.</span></p><p class="MsoNormal"><i>Note: It seems that there are some problems with the installer. I have not figured out what causes the application to work on some computers and not on others. Hopefully it is just my laptop that is having trouble. I recommend having the .NET 4.0 framework installed, even though I wrote the program for 3.5.</i></p><p class="MsoNormal"><span style="" lang="EN-US">The software allows you to connect to any COM port at any baud rate. The baud rate for this post will be 9600, considering that is the maximum of the LaunchPad, but can be changed if you want to use something like an FTDI chip. Make sure that your LaunchPad is plugged in and the VCP is ready before you run the software, the program does not constantly check which ports are available.</span></p><p class="MsoNormal"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyX_0hx7S5WgVTj2AbeQnDRcXG2SL4ci-LTUbzlgH0i5ssFASaRK7NLnyJL64Bo6cIOLQvs7xXVUL_l-6ZnbFHfcKoamcs2K7-rSD-bcoSziiqSh_5g9Oc5kliYJBLbDPFSTJpVq0zT79G/s1600/Screenshot.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 213px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyX_0hx7S5WgVTj2AbeQnDRcXG2SL4ci-LTUbzlgH0i5ssFASaRK7NLnyJL64Bo6cIOLQvs7xXVUL_l-6ZnbFHfcKoamcs2K7-rSD-bcoSziiqSh_5g9Oc5kliYJBLbDPFSTJpVq0zT79G/s400/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5520104387623471378" border="0" /></a></p><p class="MsoNormal"><span style="" lang="EN-US">The GUI is pretty self explanatory; if you have any questions, bug reports, or suggestions feel free to post. There is also some additional functionality built into the program which is currently disabled; I will provide a second version of the code for the next post when we start streaming data.<br /><br /><b style="">The Code</b><br /></span></p><p class="MsoNormal"><span style="" lang="EN-US">As always the code is available as a gist at <a href="http://gist.github.com/593606">http://gist.github.com/593606</a>. If anyone knows how to force the embedded code to show a vertical scroll bar please let me know.</span></p><script src="http://gist.github.com/593606.js?file=main_ADC.c"></script><p class="MsoNormal"><span style="" lang="EN-US"><br /><b>Going Through the Code</b><br /><br />Most of this code builds off of previous posts so I will not be going over it in great detail. To read more about the UART please see <a href="http://www.msp430launchpad.com/2010/08/half-duplex-software-uart-on-launchpad.html">the previous post</a>. The code is broken down into multiple functions to increase readability. Receive(); is called when the main loop receives a new value from the software UART. This is not necessary, and might actually reduce the efficiency slightly since every function call requires an extra few assembly commands, but in my opinion it’s worth it since the code is more readable and much easier to modify.<br /><br />After initializing all the registers the device goes into its main loop. So far the ADC is not initialized, only the software UART is set up. The main loop will determine which command was sent and then calls the necessary functions; the loop will also send any converted ADC values out using the software UART. As is true with most of the code I post, the chip goes into LPM0 when there is nothing to do. Before the CPU goes into low power mode it makes sure there are no flags waiting; this keeps the CPU from missing any events. If this was not done it is possible that a second event would be missed, since the CPU was enabled while it was currently in a loop.<br /><br />The Receive() function will initiate different tasks depending on which command was sent to the computer. The first command which is handled is used to test the speed at which the UART can send data. It will send 256 values, from 0x0000 to 0x00FF, as fast as it can; this data will be received by the computer application and is tested for errors; if there are no errors the speed of the transmission is displayed. It is important to note that 512 bytes are sent total because each value is a 16 bit word. This was chosen for two reasons. First, the MSP430 is a 16 bit processor; second the ADC measurement can not fit in one byte. The next three commands measure an external analog channel (A3), the temperature, and VCC.<br /><br /><b>About the ADC</b><br /><br />I will not be going into how ADCs work, but I will provide some basic theory pertaining to the one in the G2231. The G2231 has a 10 bit ADC and a multitude of channels available to be measured. A few of these channels are internal. They provide access to an integrated temperature sensor, a zero level calibration channel, and a VCC measurement channel.<br /><br />First things first, the ADC is not some magical device that instantly determines the amplitude of a signal, the ADC conversion takes a certain number of clock cycles and has a limited sample rate determined by this number. Since we are using the LaunchPad's UART for this project, we are limited by the speed at which we can send the values to the computer and not the maximum sample rate. This post will not deal with consecutive measurements from the ADC, so speed is not a problem yet.<br /><br />The last important theoretical topic I think is important to understand when using an ADC, is the reference voltage. In the ADC world, reference voltages are done differently for different types of converters. For example, what I am about to say does not pertain to the SD16 is the ADC in the F2013. I will probably make a future post about the SD16.<br /><br />All ADCs need to have a voltage reference which the input voltage can be compared to. There not only is an upper voltage level which the signal is reference to, but also lower level voltage. For the ADC10, you can use the following as references.</span></p> <ul type="disc"><li class="MsoNormal" style="">VCC (upper)</li><li class="MsoNormal" style="">VSS (lower)</li><li class="MsoNormal" style="">VEREF- (lower)</li><li class="MsoNormal" style="">VEREF+ (upper)</li><li class="MsoNormal" style="">VREF- (lower)</li><li class="MsoNormal" style="">VREF+ (upper)</li></ul> <p class="MsoNormal"><span style="" lang="EN-US">There are two voltages which can be generated in the G2231, the 1.5V and the 2.5V reference. For this example we will use both the 1.5V and the 2.5V references, in addition to VCC, for all cases VSS will be used as the lower voltage reference.<br /><br /><b>The Two ADC Functions</b><br /><br />The most basic of the ADC measurement functions, is the Single_Measure(chan) function. This does not use any internal references and will measure the channel 'chan' only once.<br /><br />ADC10CTL0 &= ~ENC;<span style=""> </span><span style=""> </span><span style=""> </span>// Disable ADC<br />ADC10CTL0 = ADC10SHT_3 + ADC10ON + ADC10IE;<span style=""> </span><span style=""> </span>// 16 clock ticks, ADC On, enable ADC interrupt<br />ADC10CTL1 = ADC10SSEL_3 + chan;<span style=""> </span>// Set 'chan', SMCLK<br />ADC10CTL0 |= ENC + ADC10SC;<span style=""> </span><span style=""> </span>// Enable and start conversion<br /><br />The first line is important since this might not be the first time the ADC is setup. Most values in CTL0 cannot be changed until the ENC bit is cleared; this is done to prevent unintentional parameter changes. Since this starts a single conversion we do not need to worry about setting up the timing correctly; I did not want to go into too much detail about this until the next post.</span></p><p class="MsoNormal"><span style="" lang="EN-US"> The next line determines how many clock cycles there are per conversion, turns on the ADC, and enables the ADC interrupt. Turning on and off the ADC10 is very important since the ADC will draw power as long as it is turned on. It is good programming practice to turn the device off when you are not using it.<br /><br />The last two lines set the clock source, the ADC channel, and then start the ADC. This example uses the SMCLK and sets the channel to what was defined by ‘chan’. In order for the ADC to be started both the ENC and ADC10SC bits need to be set. See the Receive() function for how to call this ADC function.<br /><br />Single_Measure_REF(chan, ref) is the second ADC function in this code. Like the first function this will only read one ADC value; the difference is that this function allows us to use one of the two internal references. See the Receive() function for how this function is used.<br />Other than the delay, there is only one different line between the first and the second ADC functions. TI recommends using a small delay after turning on an internal voltage reference to allow time for the voltage to settle; thus the small delay. Note: This only needs to be done when the reference is turned on.</span></p><p class="MsoNormal"><span style="" lang="EN-US"> ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ref + ADC10IE;</span></p> <p class="MsoNormal"><span style="" lang="EN-US">This line of code does 3 things which the last function did not do. In addition to enabling the internal reference and setting whether the 2.5V or 1.5V reference is used, it specifies how the ADC uses these references. This line of code sets the ADC to use SREF_1, which uses VREF+ and VSS for upper and lower references respectively.<br /><br /><b>The Rest of the Code</b><br /><br />The only other part of the code which you might not recognize is the ADC interrupt function. This function will let the main loop know that an ADC value is ready to be transmitted. The transmission is not done directly in the interrupt because one should minimize the amount of code which is present in interrupt routines. This is important since problems can arise when a new interrupt is thrown and the last interrupt has not finished executing yet.</span></p> <p class="MsoNormal"><b style=""><span style="" lang="EN-US">Conclusion</span></b></p> <p class="MsoNormal"><span style="" lang="EN-US">I have decided to not include the source code for the application in this post, but I will be providing it for the next. For now the application is available as an installer only. See the readme provided with the application for a bit more information on how to use it and uninstall the program. If anyone knows how to release a truly standalone .exe using Visual Studio 2010, please let me know since I don’t like installers. </span></p> <p class="MsoNormal"><span style="" lang="EN-US">I hope that you find this code useful and are not too disappointed that I have not provided the code for continuous measurement just yet. The code is done, and I just need to test a few more things and write up the next post.</span></p> <p class="MsoNormal"><span style="" lang="EN-US">So if you have any questions, or feedback, please comment away. I feel as if this post is not as nicely written as my others, so if there is anything that is not clear please let me know.</span></p> <p class="MsoNormal"><span style="" lang="EN-US">Hope you enjoy the code and mini application!<br /></span></p>NJChttp://www.blogger.com/profile/05101156243681023963noreply@blogger.com58