tag:blogger.com,1999:blog-56218707909149528412024-03-14T02:32:14.320+00:00MeanderUnknownnoreply@blogger.comBlogger12125tag:blogger.com,1999:blog-5621870790914952841.post-3838392534905416152011-07-04T23:51:00.008+01:002011-07-05T01:38:55.075+01:00RTS on SparkFun's 5V FTDI Basic<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://lh4.googleusercontent.com/-eG7MRQ90Pw4/ThJVmEmdGOI/AAAAAAAABDw/60vDnsKD1Ho/s800/SF_FTDIBasic_RTS.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 144px; height: 96px;" src="https://lh4.googleusercontent.com/-eG7MRQ90Pw4/ThJVmEmdGOI/AAAAAAAABDw/60vDnsKD1Ho/s144/SF_FTDIBasic_RTS.jpg" alt="" border="0" /></a>Without a trick to help poor Arduino to restart <a href="http://www.sparkfun.com/products/10008">SparkFun's 5V FTDI Basic breakout board</a> could be more useful to me. To get hardware flow control from the board I did primitive fix: I made a bridge between pin 2 and 3 of FTDI232RL and cut off pin 2 on the board (see picture). After this kind of the Stone Age surgery connector's pin labeled as DTR actually carries RTS signal from FTDI232RL.<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-73185846071510035242010-10-01T09:32:00.020+01:002010-10-07T00:58:59.708+01:00One new trick for an old dog<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_KAAFUk0eqC4/TKWq4IGEpPI/AAAAAAAABAI/vYtSQtp4WOs/s1600/20101001-1145.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 144px;" src="http://4.bp.blogspot.com/_KAAFUk0eqC4/TKWq4IGEpPI/AAAAAAAABAI/vYtSQtp4WOs/s200/20101001-1145.jpg" alt="" id="BLOGGER_PHOTO_ID_5523008399262131442" border="0" /></a>Well... There is no much trick in <a href="http://www.keil.com/support/man/docs/ulink2/ulink2_hw_connectors.htm">the ten pin 0.05" (1.27mm) ARM JTAG/SWD connector</a>, but it is definitely new for "an old dog" - LPC2103. <br />A few weeks ago I received several small 0.85 x 1.26" (23 x 32mm) LPC210x header boards from <a href="http://batchpcb.com/">BatchPCB</a>. OpenOCD version 0.3.1 with FTDI2232 based adapter does work with LPC2103 on the board via new tiny JTAG connector. However, the OpenOCD configuration file needs minor adjustment since the connector has no TRST pin. So <a href="http://openocd.berlios.de/doc/html/Reset-Configuration.html#Reset-Configuration">the reset configuration</a> should include <code>srst_only</code> to let the OpenOCD know that TRST is not available.<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-36263997018562238942010-04-01T00:04:00.009+01:002010-04-01T00:44:33.546+01:00CMSIS 2.0 Alpha<div style="text-align: justify;">New <a href="http://www.onarm.com/download/download396.asp">Alpha version of CMSIS</a> except adding Cortex-M4 support has replaced implementation of single assembly instruction functions by making them inline and moving code to dedicated header files (<code>core_cmFunc.h</code> and <code>core_cmInstr.h</code>) in <code>CoreSupport</code> folder. Thanks ARM! Now I can utilize original CMSIS code in my projects instead of coping functions with modified names to an additional header file. Nevertheless, the definition of <code>__INLINE</code> for GCC compiler still does not enforce actual inlining of the code as I described in the <a href="http://meander.roofof.net/2010/02/using-cmsis-with-gcc.html">previous post</a>. Well. I hope it will be fixed in the final release.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-11922756424943834542010-02-01T20:05:00.006+00:002010-02-02T00:26:40.587+00:00Using CMSIS with GCC<div style="text-align: justify;">My interest in ARM Cortex-M3 based micros recently turned into some practical exercises with <a href="http://www.olimex.com/dev/stm32-h103.html">STM32-H103</a>, GCC and <a href="http://www.onarm.com/download/download395.asp">Cortex Microcontroller Software Interface Standard</a> (CMSIS) library. CMSIS is a useful set of definitions of Cortex-M0/M3 core architecture registers, data structures and interfaces to access core resources of a Cortex-M0/M3 based microcontroller. However, if you use GCC with CMSIS (v1.2.0 or v1.3.0) the definition of <code>__INLINE</code> macro provided in <code>core_cm3.h</code> and <code>core_cm0.h</code>:<br /><pre>#define __INLINE inline</pre>does not force the compiler to actually inline the body of a function defined with <code>__INLINE</code> attribute. To tell GCC to inline the define should be:<br /><pre>#define __INLINE __attribute__((always_inline)) inline</pre>Furthermore, <code>__get_xxx</code>, <code>__set_xxx</code>, <code>__LDREX</code>, <code>__STREX</code> groups of a single assembly line functions implemented as a regular functions as oppose to inline functions. Change of these functions to inline style allowed two times improvement of the performance of certain fragments of my code.<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-49403194233403552482009-06-21T17:42:00.006+01:002009-06-21T19:07:13.318+01:00My take on SST<div style="text-align: justify;">My search of some sort of OS suitable for N1's on-board computer based on <a href="http://www.olimex.com/dev/lpc-h2103.html">LPC2103</a> lead me to an article <a href="http://www.embedded.com/columns/technicalinsights/190302110?printable=true">"Build a Super Simple Tasker"</a> (SST). The article describes a "run-to-completion (RTC) prioritized, fully preemptive, deterministic real-time kernel". Although I like the simplicity of the idea I think that tight coupling between an event and its target task in SST implementation (see Listing 3) reduces flexibility of the kernel. The <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer pattern</a> is commonly utilized by event propagation frameworks including frameworks designed by Mother Nature. Additionally, an Observer pattern based design would allow to create and destroy tasks during an application run time. With these thoughts in mind, I decided to put together my own implementation of the idea. Since the coding has been completed I am using this implementation in two unrelated projects and should confirm that RTC tasks fit pretty nicely into FSM oriented designs and single event queue implementation of the Observer pattern provides nice to have extra flexibility with minimal impact on performance.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-33997258257922109862009-05-29T21:52:00.005+01:002009-05-29T22:12:55.538+01:00Number one<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_KAAFUk0eqC4/SiBN5dV-DkI/AAAAAAAAAmA/DxH88ZtY4kE/s1600-h/N1_front.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 133px;" src="http://2.bp.blogspot.com/_KAAFUk0eqC4/SiBN5dV-DkI/AAAAAAAAAmA/DxH88ZtY4kE/s200/N1_front.jpg" alt="" id="BLOGGER_PHOTO_ID_5341354807586065986" border="0" /></a>Number one (N1) is a robot which actually runs on a mobile phone. N1 has two parts: body and brain. The body consists of slightly modified chassis of N0 and tiny ARM® based computer which acts as brain spinal cord (BSC). N1 brain, located on a mobile phone and implemented as a Java ME program, connects to its BSC through Bluetooth®. There are some further technical details and photos on the <a href="http://nx.roofof.net/">robot's home page</a> as well as a <a href="http://www.youtube.com/watch?v=IB-E8FtMbIE">video</a> which shows N1 equipped with infrared distance sensor in action.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-83616968346667797112009-05-20T19:34:00.011+01:002009-05-24T17:44:14.001+01:00Shrinkning Sharp GP2D120<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_KAAFUk0eqC4/ShRjKKMRY0I/AAAAAAAAAlM/EvQTP2u6xWU/s1600-h/GP2D120_front.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 161px;" src="http://4.bp.blogspot.com/_KAAFUk0eqC4/ShRjKKMRY0I/AAAAAAAAAlM/EvQTP2u6xWU/s200/GP2D120_front.jpg" alt="" id="BLOGGER_PHOTO_ID_5338000484526547778" border="0" /></a>I needed to mount vertically Sharp GP2D120 on a micro servo. To reduce sensor's dimensions I decided to get rid of standard mounting holes and connector. Removing mounting holes is simple job while removing the connector involves cutting a part of sensor's PCB. After a bit of head scratching, <a href="http://lh4.ggpht.com/_KAAFUk0eqC4/ShRjeg39H_I/AAAAAAAAAlU/n4lERfXc98s/s800/GP2D120_back.jpg">I moved a resistor and replaced several wires routed on the PCB under connector</a>. Finally, I drilled two tiny holes on the top part of the sensor's body for <a href="http://lh6.ggpht.com/_KAAFUk0eqC4/ShRjgAuJNjI/AAAAAAAAAlY/cezhwmenm68/s800/GP2D120_mount.jpg">a wire which attaches the sensor to the servo</a>.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-36424995583437521402009-05-17T00:41:00.011+01:002009-05-17T01:30:22.800+01:00Mounting a PCB on LEGO<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_KAAFUk0eqC4/Sg9ZMs68KwI/AAAAAAAAAkc/cJ9nGEWVeFI/s1600-h/Lego-mount.png"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 147px;" src="http://4.bp.blogspot.com/_KAAFUk0eqC4/Sg9ZMs68KwI/AAAAAAAAAkc/cJ9nGEWVeFI/s200/Lego-mount.png" alt="" id="BLOGGER_PHOTO_ID_5336582158209002242" border="0" /></a>I was looking for a while for a simple way of mounting a PCB on a construction made of LEGO® parts. Through-hole mount requires precise location of holes on a PCB and limits mounting flexibility as well as consumes a lot of valuable space on the board. The best solution to date for me is a three - four slightly modified LEGO® axle pins (gray pin is original and blue pin is modified) which <a href="http://lh6.ggpht.com/_KAAFUk0eqC4/Sg9TbDI-lwI/AAAAAAAAAkQ/YggTfTqkdUQ/s640/Lego-board.png">hold edges of a PCB</a>. The modification of four axle pins took about a minute thanks to DREMEL® rotary tool armed with <a href="http://www.dremel.com/en-us/AttachmentsAndAccessories/Pages/AttachmentsDetail.aspx?pid=199">199 High Speed Cutter</a>.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-68096048055959953082008-10-30T00:42:00.015+00:002009-05-29T21:50:14.481+01:00Number zero<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_KAAFUk0eqC4/SQkD9l634II/AAAAAAAAAUQ/ca0jIOf6U_E/s1600-h/N0_front.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 133px;" src="http://1.bp.blogspot.com/_KAAFUk0eqC4/SQkD9l634II/AAAAAAAAAUQ/ca0jIOf6U_E/s200/N0_front.jpg" alt="" id="BLOGGER_PHOTO_ID_5262741996245082242" border="0" /></a>Number zero (N0) is my first attempt to build a robot. This toy tractor is built from LEGO® Technic parts. (<a href="http://2.bp.blogspot.com/_KAAFUk0eqC4/SQkMGgjgpgI/AAAAAAAAAVI/-phLaA8bDv4/s1600-h/N0_back.jpg">back view</a>) The toy is driven by Java ME™ MIDlet on a mobile phone via Bluetooth (JSR82). <a href="http://3.bp.blogspot.com/_KAAFUk0eqC4/SQkMGvx5p_I/AAAAAAAAAVQ/-4WZ8ZfRxtk/s1600-h/N0_schematic.jpg">Small board</a> on the tractor comprise of <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=582">BlueSMiRF</a> Bluetooth class 1 module and Atmel's <a href="http://www.atmel.com/dyn/products/product_card.asp?part_id=3302">ATmega88</a> controller. Two 71427 <a href="http://www.philohome.com/motors/motorcomp.htm">LEGO® 9V motors</a> are controlled by TI's <a href="http://focus.ti.com/docs/prod/folders/print/sn754410.html">SN754410</a> configured as a dual H-bridge.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-4485133835625408732008-07-12T23:25:00.002+01:002008-08-19T02:30:33.531+01:00OpenOCD and FT2232's default VID/PID<div style="text-align: justify;">I spent quite a bit of time today trying to get OpenOCD work with <a href="http://shop.embedded-projects.net/product_info.php?info=p75_OpenOCD-USB-Adaptor.html">OpenOCD-USB Adapter</a> on MacOSX (10.5). There are two hints which might save your time:</div><br /><br /><b>1)</b> Since the adapter comes with no EEPROM, FT2232D uses default VID/PID (<code>0x0403/0x6010</code>). If FTDIUSBSerialDriver (aka VCP) is installed on your machine, you will need to comment out or remove <code>FT2232C_A</code> section of driver's <code>Info.plist</code> file located at<br /><pre> /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/</pre><br />This would prevent the FTDI VCP driver from conflicts with OpenOCD on attempt to use the port A of FT2232D on the adapter board. You also might want to reload the FTDI VCP driver after modification with following commands:<pre><br />$sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext<br />kextunload: unload kext /System/Library/Extensions/FTDIUSBSerialDriver.kext succeeded<br />$sudo kextload -c /System/Library/Extensions/FTDIUSBSerialDriver.kext<br />kextload: /System/Library/Extensions/FTDIUSBSerialDriver.kext loaded successfully</pre><br /><br /><b>2)</b> Since the adapter comes with no EEPROM, you will need to use default device descriptor in OpenOCD configuration file:<br /><pre> ft2232_device_desc "Dual RS232 A"</pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5621870790914952841.post-59854416035750675542008-07-12T01:42:00.002+01:002008-08-19T02:31:37.608+01:00Missing EEPROM on OpenOCD-USB Adapter board<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_KAAFUk0eqC4/SHkuYFU4twI/AAAAAAAAASk/kh3x9p_KtjY/s1600-h/OpenOCD-other.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://bp3.blogger.com/_KAAFUk0eqC4/SHkuYFU4twI/AAAAAAAAASk/kh3x9p_KtjY/s200/OpenOCD-other.jpg" alt="" id="BLOGGER_PHOTO_ID_5222256234194319106" border="0" /></a><div style="text-align: justify;">As it turned out <a href="http://shop.embedded-projects.net/product_info.php?info=p75_OpenOCD-USB-Adaptor.html">OpenOCD-USB Adapter</a> <span style="font-weight: bold;">does not have EEPROM</span> which is on the adapter schematic (see the bottom of <a href="http://www.embedded-projects.net/index.php?page_id=256">this page</a>). The EEPROM chip (93LC46BT SOT-23-6) was removed from the board after manufacturing. It is clearly can be seen on the picture (6 pads on the right of USB connector). I guess, the EEPROM chip was removed because of an error on the adapter PCB (EEPROM's CLK and Vcc pins are swapped). The same adapter is also available form <a href="http://www.ic-board.de/product_info.php?info=p78_OpenOCD-USB-Adapter.html">www.ic-board.de</a>. So be aware of this defect.</div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-5621870790914952841.post-59684796264985510732008-07-11T01:00:00.004+01:002009-07-31T01:04:15.035+01:005V for a target from OpenOCD USB Adapter<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_KAAFUk0eqC4/SHa7my_6dBI/AAAAAAAAARc/JX25tnPmpV0/s1600-h/OpenOCD.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://bp1.blogger.com/_KAAFUk0eqC4/SHa7my_6dBI/AAAAAAAAARc/JX25tnPmpV0/s200/OpenOCD.jpg" alt="" id="BLOGGER_PHOTO_ID_5221567093181936658" border="0" /></a>I recently bought <a href="http://shop.embedded-projects.net/product_info.php?info=p75_OpenOCD-USB-Adaptor.html">OpenOCD USB Adapter</a>. The adapter arrived as a kit which comprises of the assembled adapter board, two IDC male connectors (ten and twenty pins) and one D-type 9 pin male connector.<br /></div><div style="text-align: justify;">One feature which is missing in this adapter from my point of view is an option to power up a target from USB. A USB port can provide up to 500 mA. The adapter should not consume more then 250 mA according to <a href="http://www.ftdichip.com/Documents/DataSheets/DS_FT2232D.pdf">FT2232D datasheet</a>. This would leave approximately 250 mA for a target board. For example, <a href="http://www.olimex.com/dev/lpc-h2103.html">Olimex LPC2103</a> prototype header board would consume about a hundred mA.<br /></div><div style="text-align: justify;">Fortunately, there is a place on the adapter board for four pin header right behind D-type serial connector. Two pins in the center are serial's TTL TX and RX and pins on both sides are Ground and +5V straight from USB's Vbus. (Note, there is no ferrite bead on the adapter board.) I assembled <a href="http://lh3.ggpht.com/mishaonmac/SHa-J9AB1GI/AAAAAAAAARk/u_Hw1MnqLsI/OpenOCD_mod.jpg">a little board</a> with MOSFET (<a href="http://www.fairchildsemi.com/pf/FD/FDN302P.html">FDN302P</a>) to control power output. I used schematic of "Bus Powered Circuit with Power Control" (Figure 12) from FT2232D datasheet. The most challenging for me was to solder a wire to PWREN# pin (41) of FT2232D. The chip comes in the LQFP-48 package with leads on a 0.5mm pitch. Finally, since I do not need standard serial interface and only two pins in the second row of the serial connector are utilized, I decided to put a two pin polarized header in the first row to serve as a power connector for a target.<br />Well... As it turned out when OpenOCD (<i>see update below about version 0.2.0</i>) initializes interface FT2232 pulls PWREN# pin to high level for several hundred mS. This switches power off for the target. Meanwhile, OpenOCD attempts to communicate to the powered off target. I had to add a one second delay in <code>openocd.c</code> between <code>jtag_interface_init</code> and <code>jtag_init</code> calls to make the modification work.<br /></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;"><b>UPDATE</b>: <a href="http://developer.berlios.de/project/showfiles.php?group_id=4148&release_id=16455">OpenOCD version 0.2.0</a> seems to fix the issue above. I was able to flash and debug code on <a href="http://www.olimex.com/dev/stm32-h103.html">Olimex STM32-H103 board</a> powered from the JTAG adapter. </div>Unknownnoreply@blogger.com2