<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8">
<title>STMicroelectronics LSM303DLH Accelerometer/Magenetometer - ArchWiki</title>
<meta name="generator" content="MediaWiki 1.22.7">
<meta name="robots" content="noindex,follow">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php" title="ArchWiki (en)">
<link rel="EditURI" type="application/rsd+xml" href="https://wiki.archlinux.org/api.php?action=rsd">
<link rel="copyright" href="http://www.gnu.org/copyleft/fdl.html">
<link rel="alternate" type="application/atom+xml" title="ArchWiki Atom feed" href="/index.php?title=Special:RecentChanges&amp;feed=atom">
<link rel="stylesheet" href="../../ArchWikiOffline.css">
<meta name="ResourceLoaderDynamicStyles" content="">

</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-STMicroelectronics_LSM303DLH_Accelerometer_Magenetometer skin-archlinux action-view">

<div id="globalWrapper" style="width: 100%">
<div id="column-content"><div id="content" class="mw-body-primary" role="main" style="margin: 2em; margin-bottom: 0">
	<a id="top"></a>
	
	<h1 id="firstHeading" class="firstHeading" lang="en"><span dir="auto">STMicroelectronics LSM303DLH Accelerometer/Magenetometer</span></h1>
	<div id="bodyContent" class="mw-body">
		<div id="contentSub"></div>
		<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
<div style="text-align: center; margin-bottom: 1em; overflow:hidden;">
<table class="notice noprint toc" id="translateme" style="background: {{{backgroundcolor}}}; border-color: {{{bordercolor}}}; width: 100%">
<tr>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-document-new.png" class="image"><img alt="Tango-document-new.png" src="../../File:Tango-document-new.png" width="48" height="48"></a>
</td>
<td>  <b>This article is a stub.</b> <div style="font-size: 90%">
<b>Notes:</b> <span style="color:red;">please use the first argument of the template to provide more detailed indications.</span> (<a rel="nofollow" class="external text" href="https://wiki.archlinux.org/index.php/Talk:STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer">Discuss</a>)</div>
</td>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-document-new.png" class="image"><img alt="Tango-document-new.png" src="../../File:Tango-document-new.png" width="48" height="48"></a>
</td>
</tr>
</table>
</div>
<div style="text-align: center; margin-bottom: 1em; overflow:hidden;">
<table class="notice noprint toc" id="translateme" style="background: {{{backgroundcolor}}}; border-color: {{{bordercolor}}}; width: 100%">
<tr>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
<td>  <b>This article or section needs expansion.</b> <div style="font-size: 90%">
<b>Reason:</b> <span style="color:red;">please use the first argument of the template to provide a brief explanation.</span> (<a rel="nofollow" class="external text" href="https://wiki.archlinux.org/index.php/Talk:STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer">Discuss</a>)</div>
</td>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
</tr>
</table>
</div>
<p>The LSM303DLH is a 3-axis accelerometer and magnetometer.
</p>
<div id="toc" class="toc">
<div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Driver"><span class="tocnumber">1</span> <span class="toctext">Driver</span></a></li>
<li class="toclevel-1 tocsection-2">
<a href="#Accelerometer"><span class="tocnumber">2</span> <span class="toctext">Accelerometer</span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#Instantiate_the_device"><span class="tocnumber">2.1</span> <span class="toctext">Instantiate the device</span></a></li>
<li class="toclevel-2 tocsection-4"><a href="#Enabling_the_device"><span class="tocnumber">2.2</span> <span class="toctext">Enabling the device</span></a></li>
<li class="toclevel-2 tocsection-5"><a href="#Reading_the_output_of_the_device"><span class="tocnumber">2.3</span> <span class="toctext">Reading the output of the device</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-6"><a href="#See_also"><span class="tocnumber">3</span> <span class="toctext">See also</span></a></li>
</ul>
</div>

<h2><span class="mw-headline" id="Driver">Driver</span></h2>
<p>The official driver available is available at a <a rel="nofollow" class="external text" href="http://webcache.googleusercontent.com/search?q=cache:iJTcx9sEDbUJ:www.st.com/jp/analog/product/250145.jsp+&amp;cd=2&amp;hl=en&amp;ct=clnk">cached version of the manufacturer's website</a>. The driver is open source an it was released under the <a rel="nofollow" class="external text" href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License (v2)</a>. It compiles fine, and the accelerometer module can be loaded without problems:
</p>
<pre style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">dmesg</pre>
<pre style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">...
[  124.908804] lsm303dlh_acc_sysfs accelerometer driver: init
[  124.908876] i2c-core: driver [lsm303dlh_acc_sysfs] using legacy suspend method
[  124.908885] i2c-core: driver [lsm303dlh_acc_sysfs] using legacy resume method</pre>
<p>The following error occurs when loading the magnetometer module:
</p>
<pre style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">dmesg</pre>
<pre style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">...
[ 2546.530196] lsm303dlh_mag_sysfs: Unknown symbol input_allocate_polled_device (err 0)
[ 2546.530271] lsm303dlh_mag_sysfs: Unknown symbol input_free_polled_device (err 0)
[ 2546.530425] lsm303dlh_mag_sysfs: Unknown symbol input_register_polled_device (err 0)
[ 2546.530550] lsm303dlh_mag_sysfs: Unknown symbol input_unregister_polled_device (err 0)</pre>
<h2><span class="mw-headline" id="Accelerometer">Accelerometer</span></h2>
<h3><span class="mw-headline" id="Instantiate_the_device">Instantiate the device</span></h3>
<p>Run the following command to instantiate the device:
</p>
<pre># echo lsm303dlh_acc_sysfs 25 &gt; /sys/bus/i2c/devices/i2c-2/new_device
</pre>
<p>Although, it seems to be a problem with the driver.
</p>
<pre style="margin-bottom: 0; border-bottom:none; padding-bottom:0.8em;">demesg</pre>
<pre style="margin-top: 0; border-top-style:dashed; padding-top: 0.8em;">...
[  833.274769] lsm303dlh_acc_sysfs: probe start.
[  833.274781] lsm303dlh_acc_sysfs 2-0019: platform data is NULL. exiting.
<b>[  833.274790] lsm303dlh_acc_sysfs: Driver Init failed</b>
[  833.274813] i2c i2c-2: new_device: Instantiated device lsm303dlh_acc_sysfs at 0x19</pre>
<h3><span class="mw-headline" id="Enabling_the_device">Enabling the device</span></h3>
<div style="text-align: center; margin-bottom: 1em; overflow:hidden;">
<table class="notice noprint toc" id="translateme" style="background: {{{backgroundcolor}}}; border-color: {{{bordercolor}}}; width: 100%">
<tr>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
<td>  <b>This article or section needs expansion.</b> <div style="font-size: 90%">
<b>Reason:</b> <span style="color:red;">please use the first argument of the template to provide a brief explanation.</span> (<a rel="nofollow" class="external text" href="https://wiki.archlinux.org/index.php/Talk:STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer">Discuss</a>)</div>
</td>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
</tr>
</table>
</div>
<h3><span class="mw-headline" id="Reading_the_output_of_the_device">Reading the output of the device</span></h3>
<div style="text-align: center; margin-bottom: 1em; overflow:hidden;">
<table class="notice noprint toc" id="translateme" style="background: {{{backgroundcolor}}}; border-color: {{{bordercolor}}}; width: 100%">
<tr>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
<td>  <b>This article or section needs expansion.</b> <div style="font-size: 90%">
<b>Reason:</b> <span style="color:red;">please use the first argument of the template to provide a brief explanation.</span> (<a rel="nofollow" class="external text" href="https://wiki.archlinux.org/index.php/Talk:STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer">Discuss</a>)</div>
</td>
<td style="background-color: {{{signalcolor}}}; width: 100px"> <a href="../../File:Tango-view-fullscreen.png" class="image"><img alt="Tango-view-fullscreen.png" src="../../File:Tango-view-fullscreen.png" width="48" height="48"></a>
</td>
</tr>
</table>
</div>
<h2><span class="mw-headline" id="See_also">See also</span></h2>
<ul>
<li> Older version of the driver at <a rel="nofollow" class="external text" href="https://lkml.org/lkml/2010/12/1/3">lklm.org</a>.
</li>
<li> <a rel="nofollow" class="external text" href="http://lukeross.name/dell/">Luke Ross' website</a>.
</li>
</ul>

</div>
<div id="catlinks" class="catlinks"><div id="mw-normal-catlinks" class="mw-normal-catlinks">
<a href="../../Special:Categories.html" title="Special:Categories">Category</a>: <ul><li><a href="../../en/Category:Other_hardware.html" title="Category:Other hardware">Other hardware</a></li></ul>
</div></div>		<div class="visualClear"></div>
	</div>
</div></div>
<div class="visualClear"></div>
<div id="footer" role="contentinfo">
	<ul id="f-list" style="margin: 0 2em">
		<li>
Retrieved from "<a href="https://wiki.archlinux.org/index.php?title=STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer&amp;oldid=207249">https://wiki.archlinux.org/index.php?title=STMicroelectronics_LSM303DLH_Accelerometer/Magenetometer&amp;oldid=207249</a>"</li>
		<li id="lastmod"> This page was last modified on 13 June 2012, at 15:54.</li>
		<li id="copyright">Content is available under <a class="external" rel="nofollow" href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License 1.3 or later</a> unless otherwise noted.</li>
		<br><li id="privacy"><a href="../../en/ArchWiki:General_disclaimer.html" title="ArchWiki:Privacy policy">Privacy policy</a></li>
		<li id="about"><a href="../../en/ArchWiki:About.html" title="ArchWiki:About">About ArchWiki</a></li>
		<li id="disclaimer"><a href="../../en/ArchWiki:General_disclaimer.html" title="ArchWiki:General disclaimer">Disclaimers</a></li>
	</ul>
</div>
</div>
</body>
</html>
