tag:blogger.com,1999:blog-79160309586865845292024-03-18T05:03:03.267+02:00Engineering(DIY)Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-7916030958686584529.post-74021280505996887212015-03-29T18:15:00.000+03:002019-03-04T09:49:57.837+02:00Raspberry PI 2 CarPCHi,<br />
<br />
Here are the updates I have recently worked on: <br />
- Raspberry PI 2 support <br />
- KODI 14.1<br />
- linux kernel 3.18.7-v7 with touchscreen drivers(thanks to Chris Coat)<br />
- radio backend fixed to support RDS RadioText and better RDS StationName<br />
- interrupts are coming from WiringPI C library instead of Python via sockets<br />
- new skin from <a href="mailto:idorel@gmail.com">Doru</a>(new Skin Settings page)<br />
- CarPC folder now lives in /opt/ instead of /home/pi/<br />
- <a href="https://drive.google.com/open?id=1ucP8dBdMc-h0qniNepqR70XjUn_OSQyL8IXgy6K8X_c&authuser=0">boot process schematic</a><br />
- code is moving to github(<a href="https://github.com/aistodorescu">https://github.com/aistodorescu</a>)<br />
<br />
You can install the build using one of the two tutorials:<br />
- <a href="http://www.engineering-diy.blogspot.ro/2015/01/raspberrypi-carpc-tutorial.html">advanced users guide</a><br />
- <a href="https://docs.google.com/file/d/0B__Rs5JF53-kNkZOOFVDVDBvb2s/edit">beginner users guide</a> (thanks to <a href="https://www.facebook.com/ctrlf9">Piero Longega</a>)<br />
<br />
WARNING!<br />
This installer was tested on Raspbian Jessie from February 2015. You can get the working version from here: <a href="http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/">http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/</a><br />
<br />
Please don't forget about <a href="http://engineeringdiy.freeforums.org/index.php">the forum</a> for any comments.<br />
<br />
Some screenshots:<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEIQ5fj2JOOwwV1Jxc5_PJJN0izitJmET1ro1YAXikwkk07Nz0q7nJAamINJWXrYG8YgofKuQFMoO0TNmYR6d_mxUx9p_o1_eLFzbTtxolsXSKBMCAkmzzUGnln3EcfS8kPb8CuIiOejpk/s1600/home.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEIQ5fj2JOOwwV1Jxc5_PJJN0izitJmET1ro1YAXikwkk07Nz0q7nJAamINJWXrYG8YgofKuQFMoO0TNmYR6d_mxUx9p_o1_eLFzbTtxolsXSKBMCAkmzzUGnln3EcfS8kPb8CuIiOejpk/s1600/home.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Home screen </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFOBorfx_s_Rs2BN33BDP_5XTXIu9cRPx3Vhr2A9sTho8ZJk-9CTs1MJrf-2WBSBWGt6lYswXCjNixtKIDfuFAGzkHckmxMth0bRm82ZgSfBNBhCPaiBcycUf9Iz1KhrIZL3vK6nJUgk12/s1600/fm+radio+rds+radiotext.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFOBorfx_s_Rs2BN33BDP_5XTXIu9cRPx3Vhr2A9sTho8ZJk-9CTs1MJrf-2WBSBWGt6lYswXCjNixtKIDfuFAGzkHckmxMth0bRm82ZgSfBNBhCPaiBcycUf9Iz1KhrIZL3vK6nJUgk12/s1600/fm+radio+rds+radiotext.png" width="640" /> </a> </div>
<div class="separator" style="clear: both; text-align: center;">
FM radio with RDS</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqiTbeZYkqr9SUqU0oEICZ8JmZMDjgIjZXc1xY2nP9BJqkhrjwciUOm12WTSDGYYqSSdML7pg-P-ojo44RYt9mi9CH8qzR1uwP2trIIGGzGJmiv5hHowirgopJyGR21kFZ77GmtMvACLim/s1600/settings+page.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqiTbeZYkqr9SUqU0oEICZ8JmZMDjgIjZXc1xY2nP9BJqkhrjwciUOm12WTSDGYYqSSdML7pg-P-ojo44RYt9mi9CH8qzR1uwP2trIIGGzGJmiv5hHowirgopJyGR21kFZ77GmtMvACLim/s1600/settings+page.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Kodi Settings page</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzJmp2OKL-0QfPABqcpBPJuIxzM0dkGZNKO20XDMTJZqm0xJ4z39q6wlfIdRnWnlvVRZ2i7Ct55-_tcWIW2lYvg00p3vCBk5pHvHXnPAO1IZwOJ-hAjm6qSvVOrpgLzmoYcloltnxJLvgW/s1600/skin+settings+home.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzJmp2OKL-0QfPABqcpBPJuIxzM0dkGZNKO20XDMTJZqm0xJ4z39q6wlfIdRnWnlvVRZ2i7Ct55-_tcWIW2lYvg00p3vCBk5pHvHXnPAO1IZwOJ-hAjm6qSvVOrpgLzmoYcloltnxJLvgW/s1600/skin+settings+home.png" width="640" /></a></div>
<div class="" style="clear: both; text-align: center;">
Skin Settings</div>
<div class="" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipxtprYEgWt8jKhKTSlwhXLLoANuSNcgKGBVDJa4oRRzmk0cgEwWMmqZ55tJl7BJOWuL4OLAcx9M4e7weNl0ATnLYfykuhBzOtOF-caGjPQ1iermSkgMjM-phs3pJM-leSrj_JKN8sDdxI/s1600/skin+settings+buttons.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipxtprYEgWt8jKhKTSlwhXLLoANuSNcgKGBVDJa4oRRzmk0cgEwWMmqZ55tJl7BJOWuL4OLAcx9M4e7weNl0ATnLYfykuhBzOtOF-caGjPQ1iermSkgMjM-phs3pJM-leSrj_JKN8sDdxI/s1600/skin+settings+buttons.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Skin Settings - Buttons </div>
<br />
<br />
Enjoy and keep your eyes on the road while driving!
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F4.bp.blogspot.com%2F-Oigi06f6wmw%2FVRSA-TX79-I%2FAAAAAAAAAoo%2FcwnJtRQaZVI%2Fs1600%2Fskin%252Bsettings%252Bhome.png&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzJmp2OKL-0QfPABqcpBPJuIxzM0dkGZNKO20XDMTJZqm0xJ4z39q6wlfIdRnWnlvVRZ2i7Ct55-_tcWIW2lYvg00p3vCBk5pHvHXnPAO1IZwOJ-hAjm6qSvVOrpgLzmoYcloltnxJLvgW/s1600/skin+settings+home.png" -->Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com169tag:blogger.com,1999:blog-7916030958686584529.post-10332605007557359162015-01-04T23:20:00.000+02:002015-01-05T09:44:58.206+02:00Raspberry PI CarPC January 2015 updates <div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Hi,<br />
Here are the updates I have recently worked on: <br />
- migration to KODI stable 14.0<br />
- Raspbian OS from 24 december 2013 <br />
- linux kernel 3.18.1 with touchscreen drivers<br />
- updates to Radio and Navigation addons<br />
<br />
You can install the build using <a href="http://www.engineering-diy.blogspot.ro/2015/01/raspberrypi-carpc-tutorial.html">the tutorial</a> link on the right side of the blog. Please don't forget about <a href="http://engineeringdiy.freeforums.org/index.php">the forum</a> for any comments.<br />
<br />
Enjoy the screenshots and Happy new Year!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNWI2Sm-pRFo8iN1GHgl5gDnRmFi_59oO28UOdxJ7C39InmAvZ_SHp5If7ETHfL5-YYI1zPYun2_vvEpFikbPYKrjjC6EdOTlpUXjMu-p7kNcD27J2O_cpSsjAWpr2eqM4Pl2U4tY1rHdy/s1600/home-radio.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNWI2Sm-pRFo8iN1GHgl5gDnRmFi_59oO28UOdxJ7C39InmAvZ_SHp5If7ETHfL5-YYI1zPYun2_vvEpFikbPYKrjjC6EdOTlpUXjMu-p7kNcD27J2O_cpSsjAWpr2eqM4Pl2U4tY1rHdy/s1600/home-radio.png" height="400" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRpwNyMsco4lIKu-CfmLoEIdeVNDkyVQwb2ZDBLZfl59NHjm7gURJalqaUxXtFDE991lwPoILCx4EfnP61a9MuoduPOl9zKqs5o82c83A_KNXW4tnoud_CEiw6KITBE35ddJqjYAVKDNpj/s1600/nav-day-3d-music.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRpwNyMsco4lIKu-CfmLoEIdeVNDkyVQwb2ZDBLZfl59NHjm7gURJalqaUxXtFDE991lwPoILCx4EfnP61a9MuoduPOl9zKqs5o82c83A_KNXW4tnoud_CEiw6KITBE35ddJqjYAVKDNpj/s1600/nav-day-3d-music.png" height="400" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW66osghY2ZnlTtFkdngltzo63XyvXg6JMuwfKNN1LMFupMv1UFNf3ER6Q8DsyxUTw2ZEWgAJYQv0hVcl-s-39FmB8JMKpKfivgr6YnN4aKOlB3D49kC5kBwt8Xzn8naYL_4qzxQ9FOj4P/s1600/nav-day-3d-radio.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW66osghY2ZnlTtFkdngltzo63XyvXg6JMuwfKNN1LMFupMv1UFNf3ER6Q8DsyxUTw2ZEWgAJYQv0hVcl-s-39FmB8JMKpKfivgr6YnN4aKOlB3D49kC5kBwt8Xzn8naYL_4qzxQ9FOj4P/s1600/nav-day-3d-radio.png" height="400" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTIaLx5wVPeeIL4tlw34AwFo3PIeorEMmrLMs5CDawqhyphenhyphenKvQr0jL6ZoyDvrTw_KisbBODEE8db_ZXaQN6KHRgfwKKOpcf-TjG1M04gU887kOjw_5-5vV4jcAadpRjSjPg6AQanEjlHcgWA/s1600/nav-night-3d-music.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTIaLx5wVPeeIL4tlw34AwFo3PIeorEMmrLMs5CDawqhyphenhyphenKvQr0jL6ZoyDvrTw_KisbBODEE8db_ZXaQN6KHRgfwKKOpcf-TjG1M04gU887kOjw_5-5vV4jcAadpRjSjPg6AQanEjlHcgWA/s1600/nav-night-3d-music.png" height="400" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG_ar6-Pp2erGWrBQYSoGjQI-RX97knE8pIbq-2bMvuplL4H-O9YiYN7hs4ldFPTVt1jvVQPPmGSQo1z0O3mikcX9JFhY9wmlLfoyZXEyrGrvD2zN9MsBmSFB5sy3DytetpqfYFlHxoF8c/s1600/nav-night-3d-radio.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG_ar6-Pp2erGWrBQYSoGjQI-RX97knE8pIbq-2bMvuplL4H-O9YiYN7hs4ldFPTVt1jvVQPPmGSQo1z0O3mikcX9JFhY9wmlLfoyZXEyrGrvD2zN9MsBmSFB5sy3DytetpqfYFlHxoF8c/s1600/nav-night-3d-radio.png" height="400" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNhpHWuyCF8emT7J95Ic19UbOzv4s1FZU3vGMgyu2CB6TwPL3aDLEnUsxVT9udgHTVr46HmSTvzNmELSxIMLWBQQr5PGdZFp2eFz15pBHwOICgTu4_MTJBxkXHeIpnrgxNSHx8ZEke6V2s/s1600/radio.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNhpHWuyCF8emT7J95Ic19UbOzv4s1FZU3vGMgyu2CB6TwPL3aDLEnUsxVT9udgHTVr46HmSTvzNmELSxIMLWBQQr5PGdZFp2eFz15pBHwOICgTu4_MTJBxkXHeIpnrgxNSHx8ZEke6V2s/s1600/radio.png" height="400" width="640" /></a></div>
<br />Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.comtag:blogger.com,1999:blog-7916030958686584529.post-89691752270838488182015-01-04T18:26:00.000+02:002019-03-07T16:37:24.549+02:00RaspberryPI CarPC tutorial<br />
<b><span style="color: #3d85c6;">1. Installation process(fresh install):</span></b><br />
- write a fresh image with the RaspbianOS. Latest known working version is <a href="http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/">http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-02-17/</a><br />
- copy the carpc folder in /home/pi/ on the SD card(get the latest release archive from my <a href="https://drive.google.com/drive/u/0/#folders/0B__Rs5JF53-kVk03SGQ5OWY4Z0k/0B__Rs5JF53-kOHhDODJENVFkNmM">Downloads page/updates</a>)<br />
- plug the image in RPI, connect an USB keyboard and start it<br />
--- use the auto menu to expand file system<br />
--- change user password <br />
--- enable ssh, disable overscan, disable serial messages<br />
--- change Internalisation Options -> Locale and Timezone to your country<br />
--- expand disk size to at least 4GB<br />
--- <b>enable Boot to Console(mandatory) </b><br />
- restart<br />
- type cd /home/pi/carpc/ and then ./carpc-install.sh and then wait for the system to install<br />
- after this, you should reboot(sudo reboot) and the system should start<br />
<br />
<span style="color: #3d85c6;"><b>2. Calibrate the touch screen </b></span><br />
Forget about xinput-calibrator and X11 calibration metods.<br />
If you have calibration file(/home/pi/touchscreen_axes_calib) from a previous installation you can use it(put it in /home/pi/).<br />
If
you don't, then use the touch screen calibration plugin. This plugin
works if you set correctly the Raspberry PI resolution in
/boot/config.txt. Follow the steps in <a href="https://www.youtube.com/watch?v=sySH-eDrlRc&index=1&list=UUG6RuHlaIWNhZfMQBtWlT6A">this video</a>.<br />
<br />
<span style="color: #3d85c6;"><b>3. Add a map for navigation</b></span><br />
Go to <a href="http://maps6.navit-project.org/">Navit Planet Extractor</a> and download a .bin file for your area.<br />
Copy
the .bin file in your RPI card in /home/pi/.navit/ folder. Rename the
.bin file to map1.bin.<br />
<br />
<b><span style="color: #3d85c6;">4. Setup the GPS receiver </span></b><br />
Open the file /home/pi/startup/StartCarPC and find the line <b><i>gpsd /dev/ttyAMA0</i></b><br />
Replace <b><i>/dev/ttyAMA0 </i></b>with your gps device file name. Here is how to find the file name:<br />
1.
For USB devices. After plugging the device into the usb port type <i><b>dmesg</b></i>
and you should see somewhere that a new device was mapped on
/dev/tty... Most probably the file name would be /dev/ttyACM0.<br />
2. For Serial(UART) modules, using UART TX/RX pins the device will have the file name /dev/ttyAMA0.<br />
You
can test that the device is connected to a file name by calling
cat /dev/ttyAMA0, for example and you should see some NMEA output.<br />
<br />
<b><span style="color: #3d85c6;">5. Voice configuration for Navit</span></b><br />
Each
time a road indication has to be made, Navit will execute the file
/home/pi/.navit/speech.sh with the indication text. This file will play a
sound and the speak the indication, through speakers.<br />
<span style="color: #999999;">
aplay -r 44100 /home/pi/.navit/notification3.wav & sleep 0.7
&& espeak -ven+f4 -s150 -a 150 -p 50 "$1" --stdout | aplay</span><br />
/home/pi/.navit/notification3.wav - the sound that will be played each time before an indication<br />
-ven+f4 - female voice number 4<br />
-s150 - speed 150 words per minute<br />
-a150 - amplitude<br />
-p50 - pitch<br />
You can find more settings in the <a href="http://linux.die.net/man/1/espeak">espeak manual</a><br />
If you don't want the voice guidance you can press the speaker button in Navit and it will be turned off.<br />
<br />
<b><span style="color: #3d85c6;">6. Add FM Radio module, physical buttons or physical rotary encoders</span></b><br />
Here is my hardware schematic containing:<br />
- SV1 - Raspberry PI B, B+ connector<br />
- RADIO - <a href="http://www.ebay.com/sch/i.html?_nkw=si4703%20breakout%20board&ssPageName=GSTL">SI4703 breakout board </a><br />
- RE1 and RE2 - two <a href="http://www.ebay.com/sch/i.html?_odkw=rotary+encoder&_from=R40&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xrotary+encoder+arduino&_nkw=rotary+encoder+arduino&_sacat=0">rotary encoders</a><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/AVvXsEj7BHXoj-I5UyYY7LZlLs3L1igxVZfqiTO-_R2yrEHV3KRMVRd1Ma39yB5lKp66-51-HBXLp9qxqCZ0ulULl4UVJMDS9ZKVI5hYwc8MATQHBWoYcl3eXlFKH2HtEAPLjvdidveWKfG63C6i/s1600/RPICarPC.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="357" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7BHXoj-I5UyYY7LZlLs3L1igxVZfqiTO-_R2yrEHV3KRMVRd1Ma39yB5lKp66-51-HBXLp9qxqCZ0ulULl4UVJMDS9ZKVI5hYwc8MATQHBWoYcl3eXlFKH2HtEAPLjvdidveWKfG63C6i/s1600/RPICarPC.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CarPC hardware set-up example</td><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
Each function of push buttons, rotary encoders can be configured using the Controller, like in the step below.<br />
<br />
<b><span style="color: #3d85c6;">7. Configure the Controller</span></b><br />
Modify the configuration file(/home/pi/config/gpio_description) like in <a href="http://www.engineering-diy.blogspot.ro/2014/02/opencarpc-controller-v11.html">this post.</a><br />
<br />
<span style="color: #3d85c6;"><b>8. Connect two audio sources(RPI and Radio) to one amplifier</b></span><br />
In order to correctly hook up two audio sources together for a single output you have to use a small mixer. I am using the last schematic from this document: <a href="http://www.rane.com/pdf/ranenotes/Why_Not_Wye.pdf">http://www.rane.com/pdf/ranenotes/Why_Not_Wye.pdf</a><br />
<br />
<span style="color: #3d85c6;"><b>9. Set the car logo in the Home screen</b></span><br />
Put your car logo .png image in /home/pi/config/logo.png. <br />
<br />
<b style="color: #3d85c6;">10. Skin</b><br />
Thanks to Doru we have CarPC-touch_carbon.<br />
<br />
<b style="color: #3d85c6;">11. Issues</b><br />
<a href="http://engineeringdiy.freeforums.org/">The forum</a> is available for any issues/suggestions.<br />
<br />
<br />
Have fun!<br />
AndreiAndreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.comtag:blogger.com,1999:blog-7916030958686584529.post-68167420826916372572014-11-23T21:06:00.000+02:002014-12-15T19:03:28.337+02:00Raspberry PI CarPC November 2014 updatesHi,<br />
<br />
I have made a new release of the CarPC software for Raspberry PI.<br />
Updates:<br />
- RDS radio support(new radio application)<br />
- new application for managing everything on GPIO which takes about 3% of cpu(gpio interrupts are now used instead of polling mechanism)<br />
- new FM Radio XBMC addon<br />
- kernel 3.17.0<br />
- optimised Navit and XBMC priorities to remove hang times<br />
<br />
Minor issues:<br />
[Radio FM addon]: I tried different ways to set the height of the height of an item in xbmcgui.ControlList but it seems that nothing is working(I have tried adding as a parameter and also using setItemHeight). If you have any other idea please let me know.<br />
<br />
In order to have RDS working pin22(GPIO25) from RPI should be connected to Radio(SI4703) GPIO2 pin. This is the full schematic for one SI4703 radio module and two rotary encoders:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtOpXO3dVrzmYUJZAZkwZ0vzTeaugArqrx5i1XExpi510yIT6ANG1V6nX27OdXAR0F1TH0VRiqSSE-Tozg_tchal3DquQ-EcfpkbBSNADw_ckjOYM_8knSrV76c88nSx23vourz6qbhFuJ/s1600/RPICarPC.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtOpXO3dVrzmYUJZAZkwZ0vzTeaugArqrx5i1XExpi510yIT6ANG1V6nX27OdXAR0F1TH0VRiqSSE-Tozg_tchal3DquQ-EcfpkbBSNADw_ckjOYM_8knSrV76c88nSx23vourz6qbhFuJ/s1600/RPICarPC.png" height="571" width="640" /></a></div>
<br />
Grab the latest update from <a href="https://drive.google.com/folderview?id=0B__Rs5JF53-kOHhDODJENVFkNmM&usp=sharing">here.</a> <br />
<br />
Installation instructions are in the README inside the archive. Don't forget to(sudo apt-get update & sudo apt-get upgrade).<br />
For any issues please use the <a href="http://engineeringdiy.freeforums.org/index.php">Forum</a> to avoid filling this blog with comments.<br />
<br />
<br />
Have fun and keep your eyes on the road while driving!Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com4Bucharest, Romania44.4325 26.10388899999998144.069698499999994 25.45844199999998 44.7953015 26.749335999999982tag:blogger.com,1999:blog-7916030958686584529.post-71000624395315667082014-09-28T22:48:00.002+03:002014-10-13T15:25:50.414+03:00Raspberry PI CarPC September 2014 updatesHello!<br />
<br />
I have made some progress on my CarPC project and here are the main changes:<br />
- support for Raspberry PI Model B+<br />
- update XBMC to 13.2 stable<br />
- update kernel to 3.16.0<br />
- reworked radio(rds is available but not yet enabled because of some high cpu usage - will fix this shortly)<br />
- update system available(only ~150MB for download instead of a whole image)<br />
- file system restructuring<br />
- new skin<br />
- forum released(<a href="http://engineeringdiy.freeforums.org/">Engineeryng-Diy Forum</a>)<br />
<br />
<b><span style="color: #3d85c6;">First of all the installation process(this is only for a fresh install, update coming soon):</span></b><br />
- write a fresh image with the latest Raspbian from<a href="http://www.raspberrypi.org/downloads/"> http://www.raspberrypi.org/downloads/</a><br />
- copy the carpc folder in /home/pi/ on the SD card(gt this folder from my Downloads page/updates)<br />
- plug the image in RPI and start it<br />
--- use the auto menu to expand file system<br />
--- change password to 'a'<br />
--- enable boot into desktop-> Desktop Log in as user 'pi' at the graphical desktop<br />
--- enable ssh, disable overscan, disable serial messages<br />
--- Change Internalisation Options -> Locale and Timezone to your country<br />
- connect a keyboard and open the terminal or connect using ssh<br />
- change user permissions for pi: sudo chmod -R a+rwx /home/pi <br />
- type cd /home/pi/carpc/ and then ./carpc-install.sh and then wait for the system to install<br />
Note! If you get Cannot <i>mkdir: Permission denied </i>running this script then you should type sudo chmod -R a+rwx /home/pi/carpc/ and then run the script again.<br />
- after this, you should reboot(sudo reboot)<br />
<br />
<span style="color: #3d85c6;"><b>Calibrate the touch screen </b></span><br />
Forget about xinput-calibrator and X11 calibration metods.<br />
If you have calibration file(/home/pi/touchscreen_axes_calib) from a previous installation you can use it.<br />
If you don't, then use the touch screen calibration plugin. This plugin works if you set correctly the Raspberry PI resolution in /boot/config.txt. Follow the steps in <a href="https://www.youtube.com/watch?v=sySH-eDrlRc&index=1&list=UUG6RuHlaIWNhZfMQBtWlT6A">this video</a>.<br />
<br />
<span style="color: #3d85c6;"><b>Add a map for navigation</b></span><br />
Go to <a href="http://maps6.navit-project.org/">Navit Planet Extractor</a> and download a .bin file for your area.<br />
Copy the .bin file in your RPI card in /home/pi/.navit/ folder. Rename the .bin file to map1.bin, map2.bin, map3.bin or map4.bin.<br />
<br />
<b><span style="color: #3d85c6;">Setup the GPS receiver</span></b><br />
1.
For USB devices. After plugging the device into the usb port type dmesg
and you should see somewhere that a new device was mapped on
/dev/tty... Most probably the file name would be /dev/ttyACM0.<br />
2. For Serial(UART) modules. The device will have the file name as /dev/ttyAMA0.<br />
You
can test that the device is connected to a file name by calling
cat/dev/ttyAMA0, for example and you should see some NMEA output.<br />
Now, copy this file name and put it in the file /home/pi/StartCarPC in the section:<br />
<span style="color: #999999;"># Start gpsd</span><br />
<span style="color: #999999;"> # /dev/ttyAMA0 - RPI serial port</span><br />
<span style="color: #999999;"> # /dev/ttyACM0 - usb port</span><br />
<span style="color: #999999;"> sudo killall gpsd</span><br />
<span style="color: #999999;"> gpsd /dev/ttyAMA0</span><br />
<br />
<b><span style="color: #3d85c6;">Voice configuration for Navit</span></b><br />
Each
time a road indication has to be made, Navit will execute the file
/home/pi/.navit/speech.sh with the indication text. This file will play a
sound and the speak the indication, through speakers.<br />
<span style="color: #999999;">
aplay -r 44100 /home/pi/.navit/notification3.wav & sleep 0.7
&& espeak -ven+f4 -s150 -a 150 -p 50 "$1" --stdout | aplay</span><br />
/home/pi/.navit/notification3.wav - the sound that will be played each time before an indication<br />
-ven+f4 - female voice number 4<br />
-s150 - speed 150 words per minute<br />
-a150 - amplitude<br />
-p50 - pitch<br />
You can find more settings in the <a href="http://linux.die.net/man/1/espeak">espeak manual</a><br />
If you don't want the voice guidance you can press the speaker button in Navit and it will be turned off.<br />
<br />
<b><span style="color: #3d85c6;">Configure the Controller</span></b><br />
The
controller can be easily used with Steering wheel controls or other
physical controls in your car.<br />
You can set the configuration file like in <a href="http://www.engineering-diy.blogspot.ro/2014/02/opencarpc-controller-v11.html">this post.</a><br />
<br />
<span style="color: #3d85c6;"><b>Change the car logo in the Home screen</b></span><br />
The car logo is a png file in /home/pi/config/logo.png. <br />
<br />
<b style="color: #3d85c6;">New skin</b><br />
Thanks to Doru, a new skin is available: CarPC-touch_carbon.<br />
<br />
<b style="color: #3d85c6;">Comments moving to forum</b><br />
From now on, a forum is available for any issues/suggestions(<a href="http://engineeringdiy.freeforums.org/">http://engineeringdiy.freeforums.org/</a>). Due to this, comments on this blog will be disabled.<br />
<br />
Have fun!<br />
AndreiAndreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.comtag:blogger.com,1999:blog-7916030958686584529.post-46598398782575646192014-04-13T10:23:00.001+03:002014-09-28T22:51:00.276+03:00Raspberry PI CarPC April 2014 updatesHello!<br />
<br />
I have made a lot of work on the project, with great help from Doru Ignat(idorel@gmail.com) and now the complete list of features is:<br />
<br />
<ul>
<li>latest Raspberry PI firmware(which supports new models and has fixes for analog sound - no pops any more, you can use the analog out of RPI)</li>
<li>linux kernel 3.10.30 with various touch screens support and also lirc</li>
<li>reworked XBMC CarPC skin</li>
<li>XBMC 13 Gotham beta3(1080p video support, any music and picture format, support playing from archives and <a href="http://wiki.xbmc.org/index.php?title=Features_and_supported_formats">more</a>)</li>
<li>reworked XBMC touch screen calibration algorithm</li>
<li>XBMC calibration plugin for touch screens(eGalax and others)</li>
<li>reworked FM Radio plugin</li>
<li>latest Navit build from source</li>
<li>fixed Navit to alllow using espeak for speech guidance</li>
<li>support for WIFI(Airplay, XBMC remotes)</li>
</ul>
<br />
The latest image can be downloaded from the right side of this blog, from the <a href="https://drive.google.com/folderview?id=0B__Rs5JF53-kVk03SGQ5OWY4Z0k&usp=sharing#list">Downloads page</a>.<br />
<br />
<b><span style="color: #3d85c6;">Cost of the needed hardware parts: 193$</span></b><br />
- <a href="http://www.ebay.com/itm/Raspberry-PI-Model-B-board-New-512MB-Fast-Worldwide-Shipping-w-Tracking-/181144788183?pt=LH_DefaultDomain_0&var=&hash=item2a2d121cd7">Raspberry PI model B</a>: 45$<br />
- <a href="http://www.ebay.com/sch/i.html?_odkw=reverse+7+inch+touch+screen+car&_sop=15&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.XHDMI%2BVGA%2B2AV%2BReversing+driver+board&_nkw=HDMI%2BVGA%2B2AV%2BReversing+driver+board&_sacat=0">7 inch display with touch screen for car reverse</a>: 80$<br />
- <a href="http://www.ebay.com/sch/i.html?_odkw=hdmi+male+to+hdmi+male&LH_BIN=1&_sop=15&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR3.TRC1.A0.H0.Xhdmi+male+to+hdmi+male+1.5&_nkw=hdmi+male+to+hdmi+male+1.5&_sacat=0">HDMI male to HDMI male golden plated cable</a>: 5$<br />
- <a href="http://www.ebay.com/sch/i.html?_sacat=0&_sop=15&_nkw=8gb+sdhc+class+10&_frs=1">8GB SDHC card</a>: 6$<br />
- <a href="http://www.ebay.com/sch/i.html?_sop=15&_sacat=0&_from=R40&_nkw=micro+usb+car+charger+2A&rt=nc&LH_BIN=1">5V(2A) micro USB charger</a>: 3$<br />
- <a href="http://www.ebay.com/sch/i.html?_odkw=micro+usb+car+charger+2A&LH_BIN=1&_sop=15&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xcolumbus+v800&_nkw=columbus+v800&_sacat=0">Columbus V800 GPS module(or any other)</a>: 37$<br />
- <a href="http://www.ebay.com/sch/i.html?_odkw=si4703&LH_BIN=1&_sop=15&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR2.TRC1.A0.H0.Xsi4703+breakout&_nkw=si4703+breakout&_sacat=0">SI4703 FM Radio breakout board</a>: 13$<br />
- <a href="http://www.ebay.com/sch/i.html?_sacat=0&_from=R40&LH_BIN=1&_nkw=Rotary+Encoder+Module+KY-040&_sop=15">2 rotary encoders</a>: 4$<br />
<br />
After installing the image on an sd card, you have to configure the system for your needs.<br />
<br />
<span style="color: #3d85c6;"><b>Calibrate the touch screen</b></span><br />
The touch screen calibration involves two steps and you need a keyboard connected:<br />
1. Calibrating the touch screen for X11 applications(like Navit). Open the terminal from Desktop and type xinput_calibrator and follow the indications. After the calibration is completed you have to put the output in a file to make this permanent:<br />
<span style="color: #999999;">sudo nano /usr/share/X11/xorg.conf.d/01-input.conf</span><br />
Put here the output of xinput_calibrator. It will be something like:<br />
<span style="color: #999999;"> Section "InputClass"</span><br />
<span style="color: #999999;"> Identifier "calibration"</span><br />
<span style="color: #999999;"> MatchProduct "eGalax Inc. USB TouchController"</span><br />
<span style="color: #999999;"> Option "Calibration" "121 1917 317 1741"</span><br />
<span style="color: #999999;"> Option "SwapAxes" "1"</span><br />
<span style="color: #999999;"> EndSection</span><br />
2. Calibrating the touch screen for XBMC. In XBMC use the keyboard to go to Programs/Touch Screen Calibration and follow the informations on screen.<br />
Note, that in order to make a better calibration you can move the finger on screen towards the point, before pressing enter(as can be seen on minute 0:52 in the video).<br />
Touch each point and then press enter to go to the next one. At the end, you have to unplug the touch from usb and then plug it back(works on XBMC Gotham).<br />
After this, he calibration is stored permanently in the file /home/pi/touchscreen_axes_calib. You can edit this file to fine tune the position of the cursor if the calibration isn't perfect.<br />
<span style="color: #999999;"> calib_x_d and calib_y_d</span> - control the cursor displacement up/down/left/right<br />
<span style="color: #999999;"> calib_x_fact and calib_y_fact</span> - some factors obtained in the calibration process(don't edit them)<br />
<span style="color: #999999;"> click_confines</span> - defines the area that will be used for click(if the touch moves outside of this area then a drag action will occur) - this area is measured from the first touched point<br />
<span style="color: #999999;"> touch_mouse - </span>if you want to use a mouse you have to set this to 0, but some touch screens behave as mouses and you have to set this to 1 in order for them to work(with single click). For the most of the touches this can be 0 if you want to also use a mouse, but if you don't want to use a mouse it doesn't mater, let it be 1.<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/sySH-eDrlRc?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
<span style="color: #3d85c6;"><b>Change the resolution</b></span><br />
[XBMC] Using ssh you have to edit the file /home/pi/.xbmc/userdata/advancedsettings.xml and set your resolution. After this restart the whole system and XBMC should run with your new resolution.<br />
[LXDE] Connect with ssh and type<br />
tvservice -mDMT && tvservice -mCEA<br />
and get the desired resolution mode<br />
Edit /boot/config.txt and modify according to your preference, for example:<br />
hdmi_group=2<br />
hdmi_mode=27<br />
CEA group is 1 and DMT 2.<br />
<br />
<span style="color: #3d85c6;"><b>Add a new map for Navit</b></span><br />
1. Go to <a href="http://maps6.navit-project.org/">Navit Planet Extractor</a> and download a .bin file for your area.<br />
2. Copy the .bin file in your RPI card in /home/pi/.navit/ folder<br />
3. Edit the file /home/pi/navit_src/build/navit/navit.xml and search for the entry:<br />
<span style="color: #999999;"> <mapset enabled="yes"></span><br />
<span style="color: #999999;"> <map type="binfile" enabled="yes" data="/home/pi/.navit/Romania.bin"/></span><br />
<span style="color: #999999;"> </mapset></span><br />
4. Add your map name here like this:<br />
<span style="color: #999999;"><mapset enabled="yes"></span><br />
<span style="color: #999999;"> <map type="binfile" enabled="yes" data="/home/pi/.navit/Romania.bin"/></span><br />
<span style="color: #999999;"> <map type="binfile" enabled="yes" data="/home/pi/.navit/new_map.bin"/></span><br />
<span style="color: #999999;"> </mapset></span><br />
<br />
<b><span style="color: #3d85c6;">Setup the GPS receiver</span></b><br />
1. For USB devices. After plugging the device into the usb port type dmesg and you should see somewhere that a new device was mapped on /dev/tty... Most probably the file name would be /dev/ttyACM0.<br />
2. For Serial(UART) modules. The device will have the file name as /dev/ttyAMA0.<br />
You can test that the device is connected to a file name by calling cat/dev/ttyAMA0, for example and you should see some NMEA output.<br />
Now, copy this file name and put it in the file /home/pi/StartCarPC in the section:<br />
<span style="color: #999999;"># Start gpsd</span><br />
<span style="color: #999999;"> # /dev/ttyAMA0 - RPI serial port</span><br />
<span style="color: #999999;"> # /dev/ttyACM0 - usb port</span><br />
<span style="color: #999999;"> sudo killall gpsd</span><br />
<span style="color: #999999;"> gpsd /dev/ttyAMA0</span><br />
<br />
<b><span style="color: #3d85c6;">Voice configuration for Navit</span></b><br />
Each time a road indication has to be made, Navit will execute the file /home/pi/.navit/speech.sh with the indication text. This file will play a sound and the speak the indication, through speakers.<br />
<span style="color: #999999;"> aplay -r 44100 /home/pi/.navit/notification3.wav & sleep 0.7 && espeak -ven+f4 -s150 -a 150 -p 50 "$1" --stdout | aplay</span><br />
/home/pi/.navit/notification3.wav - the sound that will be played each time before an indication<br />
-ven+f4 - female voice number 4<br />
-s150 - speed 150 words per minute<br />
-a150 - amplitude<br />
-p50 - pitch<br />
You can find more settings in the <a href="http://linux.die.net/man/1/espeak">espeak manual</a><br />
If you don't want the voice guidance you can press the speaker button in Navit and it will be turned off.<br />
<br />
<b><span style="color: #3d85c6;">Configure the Controller</span></b><br />
The controller can be easily used with Steering wheel controls or other physical controls in your car. To enable this controller, you have to edit the file /home/pi/StartCarPC and search for the entry:<br />
<span style="color: #999999;"> # Start the GPIO Remote</span><br />
<span style="color: #999999;"> #sudo opencarpc-controller /home/pi/gpio_description &</span><br />
You have to change it to:<br />
<span style="color: #999999;"> # Start the GPIO Remote</span><br />
<span style="color: #999999;"> sudo opencarpc-controller /home/pi/gpio_description &</span><br />
Now, you can set the configuration file like in <a href="http://www.engineering-diy.blogspot.ro/2014/02/opencarpc-controller-v11.html">this post</a><br />
<br />
<span style="color: #3d85c6;"><b>Change the car logo in the Home screen</b></span><br />
If you want to put another car logo you have to edit the file /home/pi/.xmc/addons/skin.CarPC-touch/16x9/Home.xml and find the entry:<br />
<span style="color: #999999;"> <posx>580</posx><br /> <posy>205</posy><br /> <width>550</width><br /> <height>550</height><br /> <texture>bmw_logo.png</texture></span><br />
Here, you can set your new image instead of bmw_logo.png you can put a complete path of the new image.<br />
<br />
<span style="color: #3d85c6;"><b>Set up a WIFI connection</b></span><br />
If you want to have internet connection, or airplay or control the whole system using the XBMC remotes, you have to setup a wifi hotspot with your phone and then use an USB WIFI dongle(I am using EDIMAX EW-7811UN dongle).<br />
The system is configured to automatically connect to a wifi hotspot with the following settings:<br />
<span style="color: #999999;"> wpa-ssid "opencarpc"<br /> wpa-psk "opencarpc123"</span><br />
You can find these settings in the file /etc/network/interfaces.<br />
<br />
Some pictures with my setup:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBanvg1mjDnMdAQWdrrSpqD-MNapgmIsHOOfCbun-nPgE75v83tMMC9AFiAzYlmlMfHENIYHIQstZlIps5h3BgeasLiB0fFudWYqED9B6663H300hRmdvZwLjQR8Peua5-jsDyl1o8yf0k/s1600/CarPC.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBanvg1mjDnMdAQWdrrSpqD-MNapgmIsHOOfCbun-nPgE75v83tMMC9AFiAzYlmlMfHENIYHIQstZlIps5h3BgeasLiB0fFudWYqED9B6663H300hRmdvZwLjQR8Peua5-jsDyl1o8yf0k/s1600/CarPC.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8UpXM3tKHCbZBsLeH8UYswwfqitPKnl4w_Sjb82Az-bSf-tz55NVhvVt2XnQP9t8qIGwJMXSu2gzt88_ZFcZS1pkWJIPUUFvi95s65e6F4QCiik1oRRWKRuPg9Y2fDLy98uPX9i8F3Mkr/s1600/inCar.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8UpXM3tKHCbZBsLeH8UYswwfqitPKnl4w_Sjb82Az-bSf-tz55NVhvVt2XnQP9t8qIGwJMXSu2gzt88_ZFcZS1pkWJIPUUFvi95s65e6F4QCiik1oRRWKRuPg9Y2fDLy98uPX9i8F3Mkr/s1600/inCar.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzChHqTasC6smLfQ_7OG0qitBjMCRmhjIRZ5RGP980qD5dT_gVt0Z2S4u-I60pwqWC8qvpxp5uk3X8oC_SYDLpPmNkdrhwlcYxD4zER5cI1JBsmjybzRHGmx24mfnVUtDLbIF2WAr4_YGM/s1600/Spectrum+analyzer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzChHqTasC6smLfQ_7OG0qitBjMCRmhjIRZ5RGP980qD5dT_gVt0Z2S4u-I60pwqWC8qvpxp5uk3X8oC_SYDLpPmNkdrhwlcYxD4zER5cI1JBsmjybzRHGmx24mfnVUtDLbIF2WAr4_YGM/s1600/Spectrum+analyzer.jpg" height="240" width="320" /></a></div>
<br />
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-lOP_PrVIfu4%2FU0o99nc8pWI%2FAAAAAAAAAZE%2FUvp6apQRdZ8%2Fs1600%2FCarPC.JPG&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBanvg1mjDnMdAQWdrrSpqD-MNapgmIsHOOfCbun-nPgE75v83tMMC9AFiAzYlmlMfHENIYHIQstZlIps5h3BgeasLiB0fFudWYqED9B6663H300hRmdvZwLjQR8Peua5-jsDyl1o8yf0k/s1600/CarPC.JPG" -->Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com220tag:blogger.com,1999:blog-7916030958686584529.post-26735828980674337022014-02-26T23:25:00.002+02:002014-02-27T10:11:15.475+02:00openCarPC controller v1.1Hi!<br />
<br />
In a <a href="http://www.engineering-diy.blogspot.ro/2013/11/control-xbmc-from-raspberry-pi-gpios.html">previous post</a> I have explained how I have interfaced Raspberry PI GPIOs with XBMC, using buttons and rotary encoders.<br />
I have reworked the application which controls this and now there are more features available.<br />
You can use this post to set up the hardware connections between Raspberry PI GPIO connector and as many buttons and rotary encoders as you like(or you have room for on the RPI GPIO pins).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/9R1ZvdZQKhU?feature=player_embedded' frameborder='0'></iframe></div>
<br />
At this moment my setup has 2 rotary encoders, each of them having also a push button.<br />
You can use this tutorial to set up your car steering wheel controls to control this system.<br />
<br />
<b><span style="color: #3d85c6;">XBMC builtin functions are now supported.</span></b><br />
For a list of available XBMC builtin functions have a look at <a href="http://wiki.xbmc.org/index.php?title=List_of_built-in_functions">this link</a>.<br />
<br />
<span style="color: #3d85c6;"><b>Groups of commands are supported.</b></span><br />
Commands should be separated by the '+' character. For example:<br />
<span style="color: #999999;">xbmcbuiltin_PlayerControl(previous)+KB_minus</span><br />
will execute both commandsa t once when the corresponding button is pressed, or when the rotary encoder is turned in the correct direction.<br />
<br />
<span style="color: #3d85c6;"><b>Multiple groups of commands are supported.</b></span><br />
Groups of commands should be separated by the '>' character.<br />
When the action is triggered(button pressed or rotary encoder rotated in the correct direction) the commands are executed consecutively.<br />
For example:<br />
<span style="color: #999999;">xbmcbuiltin_ActivateWindow(Music)>xbmcbuiltin_ActivateWindow(Videos)</span><br />
When you press the button for the first time XBMC will switch to Music window. When you press it the second time XBMC will switch to Videos window and when pressed again, XBMC will switch back to Music window.<br />
<br />
<span style="color: #ffd966;">Note: </span><br />
<span style="color: #ffd966;">The groups of commands were designed to support multiple
programs control. At this moment I am working on external radio support
so you can set the volume of radio and volume in XBMC at the same time.
This will be available in a future post.</span><br />
<span style="color: #ffd966;">This doesn't mean that you can use multiple XBMC commands at once. </span><br />
<br />
To download the latest version, please checkout the Downloads link from the right of the blog, in the openCarPC tools folder. The current version is 1.1.<br />
<br />
Have fun!Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com5tag:blogger.com,1999:blog-7916030958686584529.post-35954890472481161252014-02-08T15:56:00.000+02:002014-02-26T19:54:09.259+02:00OpenCarPCHi!<br />
<br />
I have worked on some new features for my CarPC. Here are the changes: <br />
First, some videos:<br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://i1.ytimg.com/s_vi/AKm_ya-6rXs/default.jpg?sqp=CMzN2JcF&rs=AOn4CLD0l3jZjq5rrQglFp36eLP51ow4qQ" height="266" width="320"><param name="movie" value="https://www.youtube.com/v/AKm_ya-6rXs?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://www.youtube.com/v/AKm_ya-6rXs?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object><object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://i1.ytimg.com/s_vi/AOe9U4qMGvw/default.jpg?sqp=CMzN2JcF&rs=AOn4CLCFe1rkmkW93KpA5bns5AywitTAsA" height="266" width="320"><param name="movie" value="https://www.youtube.com/v/AOe9U4qMGvw?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://www.youtube.com/v/AOe9U4qMGvw?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object><object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://i1.ytimg.com/s_vi/9R1ZvdZQKhU/default.jpg?sqp=CMzN2JcF&rs=AOn4CLCMx2gDArb1LdjY3kqarcWxot3ENA" height="266" width="320"><param name="movie" value="https://www.youtube.com/v/9R1ZvdZQKhU?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://www.youtube.com/v/9R1ZvdZQKhU?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object><object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://i1.ytimg.com/s_vi/TtjHUkhVB4U/default.jpg?sqp=CMzN2JcF&rs=AOn4CLAZezoIdXJy6KkaEAhMm4KB8roSPg" height="266" width="320"><param name="movie" value="https://www.youtube.com/v/TtjHUkhVB4U?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://www.youtube.com/v/TtjHUkhVB4U?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />
The latest image can be downloaded from the Downloads link on the right of this blog(username:pi, password:a).<br />
<span style="color: yellow;">Note!</span><br />
<span style="color: yellow;">If you do not have any rotary encoder connected or any buttons with a resistor you need to disable the carpc-controller application. You can do this by editing the file /home/pi/StartCarPC and commenting the line which contains carpc-controller.</span><br />
<br />
<span style="color: #3d85c6;"><b>Hardware updates:</b></span><br />
- added ViewHd HDMI to HDMI+audio board<br />
- added SI4703 FM Radio module<br />
- created an expansion board with fm radio module and three connectors(one for GPS receiver and two for rotary encoders)<br />
- added a very cheap board to mix two output channels(RPI and radio) into a single output(which goes to the amplifier, in my case AUX input of the car player)<br />
<br />
<span style="color: #3d85c6;"><b>Software updates:</b></span><br />
- added loading movie(created by Doru Ignat)<br />
- added a python server responsible for controlling the radio module via i2c<br />
- added new XBMC plugin for controlling the FM Radio(including storing up to 5 radio stations in a file)<br />
- improved carpc-controller to support sending multiple commands for a single button press or encoder turn(e.g. turning right one rotary encoder can increase the volume in XBMC and the volume of radio at the same time)<br />
- improved the speed in Navit clicking<br />
- improved the Navit OSD for both day and night setup(Navit switches automatically teh setup based on the time of the system).<br />
- added time synchronization mechanism based on GPS readings(RPI does not have a real time clock)<br />
<br />
<b><span style="color: #3d85c6;">The expansion board.</span></b><br />
<br />
<div class="drive-viewer-image drive-viewer-image-transition" style="height: 448px; left: 357px; top: 135px; width: 455px;" tabindex="0">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn_R4Tiw0W-kk1qiTSlRMy73Hies9ze0nBe6NRcu4HtHFy1oypxW3NboMNM8PC5cFVICP4kGBIqkolLeSVgEHLNIzoI7Awzj_NhancrkRDj-VM3442OFHxzqLB4xc35zZezsd3RoEkkgPd/s1600/Board.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn_R4Tiw0W-kk1qiTSlRMy73Hies9ze0nBe6NRcu4HtHFy1oypxW3NboMNM8PC5cFVICP4kGBIqkolLeSVgEHLNIzoI7Awzj_NhancrkRDj-VM3442OFHxzqLB4xc35zZezsd3RoEkkgPd/s1600/Board.png" height="392" width="400" /></a></div>
</div>
RE1 and RE2 are rotary encoders.<br />
<br />
<span style="color: #3d85c6;"><b>The FM Radio driver and Python server.</b></span><br />
The FM Radio module is connected using i2c communication interface(GPIO0-SDA and GPIO1-SCL of the PI).<br />
The radio driver is contained in the si4703 python class. The Radio server is implemented in the file radio_server.py(which is automatically started at boot time). This server simply opens a socket and waits for data. After any data is received, a couple of if-else statements different radio functions are called base on the incoming data.<br />
The available commands are:<br />
<blockquote class="tr_bq">
<span style="color: yellow;">seek_right</span> - search for a new station in the right of the current frequency<br />
<span style="color: yellow;">seek_left</span> - search for a new station in the left of the current frequency<br />
<span style="color: yellow;">tune_xx.x</span> - set the current frequency to xx.x MHz<br />
<span style="color: yellow;">volume_xx</span> - set the volume of the radio module to xx. xx should be between 0 and 15<br />
<span style="color: yellow;">toggle_mute</span> - toggle mute<br />
<span style="color: yellow;">get_frequency</span> - get the current frequency</blockquote>
The server reply with the current frequency for each command.<br />
<br />
Simple test.<br />
To understand how this radio server-client works you can make the folowing experiment:<br />
1. Plug the gpio expansion board(or wire the radio module to the PI as in the above schematic)<br />
2. [Server] Connect using one ssh window(I use Putty) to the PI and enter the folowing commands:<br />
cd radio<br />
sudo python radio_server.py<br />
The radio server should initialize the radio module and start the server.<br />
3. [Client] go to the radio folder and use radio_client.py to send commands o the radio server, like in the folowing picture:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGCVS4goa-XmS8J5kEKxfffG9ZDXtq62xQ4J5UPBVKRRSgrOsbBNatl9k5tCzubX3qQnhG-6x3l80hjb25sZaiBPSeCzI6J32slxAxEPKPBz2zl2SiF8iFCGqfFgHbMLPgWJ7hTrQgC7k4/s1600/radio-server-client.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGCVS4goa-XmS8J5kEKxfffG9ZDXtq62xQ4J5UPBVKRRSgrOsbBNatl9k5tCzubX3qQnhG-6x3l80hjb25sZaiBPSeCzI6J32slxAxEPKPBz2zl2SiF8iFCGqfFgHbMLPgWJ7hTrQgC7k4/s1600/radio-server-client.png" height="118" width="640" /></a></div>
The file radio_client.py simply opens an UDP socket, puts an '_' character between arguments and send the obtained string to the server socket.<br />
<br />
<span style="color: #3d85c6;"><b>The radioFM XBMC plugin.</b></span><br />
In order to simplify user interaction I have created a new XBMC plugin(radioFM). Its purpose is to allow interacting with the Radio Server(and with the Radio Module) using the touch screen. In order to be able to use this plugin you need to have the radio_server.py started and the FM module plugged in.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8htQcLLfGiEpOmJKmkX-uyvIeuN6DltgtDIMuptxw9GJLCWSCK_kNpuK8qRGIgMdZHyf4KXI7TledEWvwmiCRElFO9sxZUmPIWoYJTIPmx1_x9K0H1wLAWVGV_TbdpJZv77Kn1-FUWc5E/s1600/radioFM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8htQcLLfGiEpOmJKmkX-uyvIeuN6DltgtDIMuptxw9GJLCWSCK_kNpuK8qRGIgMdZHyf4KXI7TledEWvwmiCRElFO9sxZUmPIWoYJTIPmx1_x9K0H1wLAWVGV_TbdpJZv77Kn1-FUWc5E/s1600/radioFM.png" height="183" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Features:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>The current frequency is displayed at the top.</li>
<li>The left and right arrow buttons are for seeking to the next channel(left or right).</li>
<li>The bottom 5 buttons are preset channels(these are kept in a file so they are available after reboot).</li>
<li>The Set/Tune Channels button is used for changing the mode in which the bottom buttons are operating. By default they are in the 'Tune' mode, so if you presss them the radio will tune to that frequency. If you press the Set/Tune Channels button once you will enter the Set mode, which will allow you to store the current channel in which preset button you like(or in all of them... if you want) by pressing it once. You will see that the frequency will be changed.</li>
</ul>
<span style="color: #3d85c6;"><b>Connecting two audio sources(RPI and Radio) to one amplifier.</b></span><br />
<span style="font-family: inherit;">In order to correctly hook up two audio sources together(putting them in parallel) for a single output you have to use one schematic from <a href="http://www.rane.com/pdf/ranenotes/Why_Not_Wye.pdf">this</a> document. I have used the last schematic. Don't forget to use at least 1% tolerance for the resistors.</span><br />
<span style="color: #3d85c6;"><br /></span>
<span style="color: #3d85c6;"><b>The new GPIO controller.</b></span><br />
<span style="font-family: inherit;">The GPIO controller is now using the official XBMC client code from xbmcclient.h.</span><br />
<span style="font-family: inherit;">Now, you can call a lot more XBMC functions for any button pressed or encoder movement.</span><br />
<br />
<b><span style="color: #3d85c6;">TODO List</span><span style="color: #3d85c6;">: </span></b><br />
- update to the latest Raspberry PI firmware(today it is possible but then Navit won't be visible)<br />
- remove the calibration file for XBMC(/usr/share/eGalax/touchscreen_axes_calib) and use the values from the Debian calibration file(/usr/share/X11/xorg.conf.d/01-input.conf)<br />
- create an XBMC addon to allow calibrating the touch screen for both XBMC and X11 windows and also for calibrating the external encoders and button<br />
- create a configuration page(XBMC addon) for the carpc-controller settings <br />
- create a better audio mixer unit<br />
- create a new page for launching different X11 applications Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com59tag:blogger.com,1999:blog-7916030958686584529.post-44686424334134356782013-11-10T19:07:00.000+02:002013-11-17T00:30:03.411+02:00Control XBMC from the Raspberry PI GPIO'sI have recently worked on adding external controls for my Raspberry PI CarPC project because while driving it is better to have some physical controls to rely on, rather than looking at the touch screen to find the buttons.<br />
This post provide information on how to set up buttons or rotary encoders to control XBMC from Raspberry PI.<br />
<br />
<b><span style="color: #3d85c6;">Rotary encoder</span></b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2yJ_5GvnV2NWvTg4jn5d568qN4Zk-2Ab4H4nnl-jbFxlgwXItFPJ4S-ju0lglTLyl6DrCNyyhtAK2w642fdfBt35pRjLWPTv0vqBk9PtIaCUWL4RuhgYwhdbmIxHDjPlSMfvyJuQuh0ti/s1600/IMG_20131110_115830.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2yJ_5GvnV2NWvTg4jn5d568qN4Zk-2Ab4H4nnl-jbFxlgwXItFPJ4S-ju0lglTLyl6DrCNyyhtAK2w642fdfBt35pRjLWPTv0vqBk9PtIaCUWL4RuhgYwhdbmIxHDjPlSMfvyJuQuh0ti/s1600/IMG_20131110_115830.jpg" height="240" width="320" /></a></div>
Rotary encoders are very cheap and very nice controls(<a href="http://www.ebay.com/itm/321217001286?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649">eBay link</a>). You can find them in car stereos for volume control. You can also use them to browse through menu items or to skip to next song etc.<br />
They are looking very similar to a potentiometer, but there are major differences: they can be turned in both directions with infinite steps(you know just the direction of the spin), they provide digital output, a full rotation have a number of steps and they have push button also.<br />
Connections for Raspberry PI should be done as follows:<br />
+ pin to 3.3V<br />
GND pin to Raspberry PI GND<br />
SW to one GPIO <br />
CLK and DT to two GPIOs <br />
When the push button is pressed the pin labelled SW is connected to GND. This can be set up as any push button(see below).<br />
<br />
<span style="color: #3d85c6;"><b>Push button</b></span><br />
<div style="text-align: left;">
A push button can have two states on or off. There are two ways to hook up a button to a logical circuit(e.g Raspberry PI GPIO's):</div>
<div style="text-align: center;">
<img alt="" height="240" src="data:;base64,iVBORw0KGgoAAAANSUhEUgAAAbcAAAFLCAIAAADapVXeAAAAA3NCSVQICAjb4U/gA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6UUgcHB0JTjccclVKlUslt0z2fU6lULMtyWnbra63PvpX76YEevYXcDXPuHfF69v596BfcX9Ib7HEDgISUBAAJ10sCOEcwGDQMw+9enCMYDHr8jaSkF4aHh/3uAnA5P3/+9LsLvaJHD9DeBj17dBz94lrP3sDFcUkAkJCSACAhJQFAQkoCgISUBAAJKQkAElISACSkJABISEk/GR2LxWJ+rwRww/EXin7iTx2A3sdcEgAkpCQASEhJAJCQkgAgISUBQEJKAoCElPQCj97GdXAeutAt3j8poV9wd2IvGDxpFv5hpHWIuSQASEhJAJCQkgAgISUBQEJKAoCElPTN8PCw310AcDEuEfACl2LARwy/DjGXBAAJKQkAElISACSkJABISEkAkJCSACAhJQFAQkoCgISUBAAJKQkAElISACSkJABISEkAkJCSACAhJQFAQkoCgISU7EgsFmvnefBKqQvrxGIxv9cGfaaLw48RKOAmxgAgYS4JABJSEgAkpCQASEjJrmnzUDrHy3EdGH7Xh7M3ACBhLgkAElISACSkJABISEkAkJCS1+Xcc46cVYQ3GH5dxDluAJAwlwQACSkJABJSEgAkpCQASEhJAJCQkgAgISUBQEJKAoCElAQACSkJABJSEgAkpCQASEhJAJCQkgAgISUBQEJKAoCElAQACSkJABJSEgAkpCQASEhJAJCQkgAgISUBQEJKAoCElAQACSkJABJSEgAkpCQASEhJAJCQkgAgISUBQEJKAoCElAQAyf8DIvPI0y/JALMAAAAASUVORK5CYII=" width="320" /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
We have to use the first setup(with pull up resistor) for the tool to work properly. So, for the push button of the rotary encoder above, we have to cable it like this:<br />
<div style="text-align: center;">
<img alt="" height="200" src="data:;base64,iVBORw0KGgoAAAANSUhEUgAAAMUAAAEsCAIAAAD8ZuBZAAAAA3NCSVQICAjb4U/gAAAAGXRFWHRTb2Z0d2FyZQBnbm9tZS1zY3JlZW5zaG907wO/PgAADf1JREFUeJzt3T9oG9cDB/B3v3YIGCovFQaDSTsoZChCGdyaDkKiEGp4txnSQCmB2pyGQosztHDCg0O6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X2pzczOfz6dSqUePHkkpg8GguikgugZDX3/99eHhoT3NppRyaWlJLQSDwa+++sqezpUuysNPWVyr51VImZD+jq4J5omQPDx+4vx01xCHAhfG8ZML9neExDwREvNESMwTITFPb0UikUG+KywGmIpuav/8x0sVQmL7REjMEyExT4TEPPU24NicY/AOHI8TEtsnQmKeCIl5IiTmiZCYp4H0vNzjBV03Xt8REtsnQmKeCIl5IiTmiZCYJ0JingiJeSIk5omQmCdCYp4IiXkiJOaJkJgnQmKeCIl5IiTmiZCYJ0Jingjpv9RhmCcsEthaAAAAAElFTkSuQmCC" width="131" /> </div>
<b><span style="color: #3d85c6;">The tool</span></b><br />
I have created a tool to allow you interface rotary encoders(and also push buttons) with Raspberry PI GPIO's. Also you can set an XBMC command to be executed for click, left rotation and right rotation.<br />
The tool can be otbained from my Google Code project(<a href="https://code.google.com/p/andrei-development/source/browse/#svn%2Fbranches%2Fdev%2FCarPc%2FRPI_XBMC_Controller%253Fstate%253Dclosed">link to page</a>).<br />
It is very easy to use it. You just have to accomplish two steps:<br />
- copy rpi-xbmc-remote in a place where it can be accessed from anywhere(e.g. /usr/bin)<br />
- call it using sudo <i>rpi-xbmc-remote /path/to/configuration/file</i><br />
<br />
<b><span style="color: #3d85c6;">The configuration file</span></b><br />
<span style="font-family: inherit;">Example:</span><br />
<blockquote class="tr_bq">
<span style="color: #999999;">
</span>
<br />
<div style="margin-bottom: 0in;">
<span style="color: #999999;"><span style="font-family: Inherit;">ip:localhost</span></span></div>
<span style="color: #999999;">
</span>
<br />
<div style="margin-bottom: 0in;">
<span style="color: #999999;"><span style="font-family: Inherit;">button:7:KB:return</span></span></div>
<span style="color: #999999;">
</span>
<br />
<div style="margin-bottom: 0in;">
<span style="color: #999999;"><span style="font-family: Inherit;">encoder:clk:23:KB:up:dt:24:KB:down</span></span></div>
<div style="margin-bottom: 0in;">
</div>
</blockquote>
<div style="margin-bottom: 0in;">
<style type="text/css">P { margin-bottom: 0.08in; }</style>
</div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"><span style="font-size: small;">The
configuration file can reside anywhere on the disk. It provides a way
to define two kind of inputs for XBMC: regular button and rotary
encoder.</span> <span style="font-size: small;">Lines should be less than 100 characters
in length. Lines starting with # are comments and are not being
processed.</span></span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Times New Roman, serif;"><span style="font-size: small;"> </span></span><span style="font-family: Times, Times New Roman, serif;">
</span></div>
<style type="text/css">P { margin-bottom: 0.08in; }</style>
<br />
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;">Example of regular button definition:</span><i><span style="font-family: Inherit;"> </span></i></div>
<blockquote class="tr_bq">
<div style="margin-bottom: 0in;">
<span style="color: #999999;"><i><span style="font-family: Inherit;">button:7:KB:return</span></i></span></div>
</blockquote>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'button' means
it is a regular button</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - '7' means use
GPIO7 for this button</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'KB' means XBMC
device map</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> "KB" -
Standard keyboard map</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> "XG" -
Xbox Gamepad</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> "R1" -
Xbox Remote</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> "R2" -
Xbox Universal Remote</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> "LI:devicename"
- valid LIRC device map where 'devicename' is the actual </span>
</div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;">name of the LIRC
device</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'return' means
XBMC button name to be called(see XBMC keymaps)</span></div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;">Example of rotary
encoder definition:</span></div>
<span style="color: #999999;">
</span>
<br />
<blockquote class="tr_bq">
<div style="margin-bottom: 0in;">
<span style="color: #999999;"><i><span style="font-family: Inherit;">encoder:clk:23:KB:up:dt:24:KB:down</span></i></span></div>
</blockquote>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'encoder' means
it is a rotary encoder</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - '23' means use
GPIO23 for rotary encoder CLK</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'KB' means XBMC
device map for rotary encoder left turn(same as above)</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'up' means XBMC
button name to be sent for left turn of the rotary encoder</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - '24' means use
GPIO24 for rotary encoder DT</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'KB' means XBMC
device map for rotary encoder right turn(same as above)</span></div>
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;"> - 'return' means
XBMC button name to be called(see XBMC keymaps)</span></div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<span style="color: yellow;"><b><span style="font-family: inherit;">Keep in mind!</span></b></span></div>
<span style="font-family: Inherit;">You have to put a pull up resistor for every push button you define in the configuration file. If you don't do this then the state of the button will be variable when not pressed(it will oscillate between 0 and 1) and it will behave like it is pressed randomly.</span><br />
<span style="font-family: Inherit;"><br /></span>
<br />
<div style="margin-bottom: 0in;">
<span style="font-family: Inherit;">Have fun!</span><span style="font-family: inherit;"><span style="font-family: Times, Times New Roman, serif;"><br /></span></span></div>
Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com27tag:blogger.com,1999:blog-7916030958686584529.post-25631472583592974722013-10-06T13:39:00.000+03:002013-10-11T16:22:55.413+03:00Keep your linux clock synchronized with gps timeA big problem for a CarPC is that you need a real time clock to synchronize your system with.<br />
For my CarPC, I don't have any RTC module on Raspberry PI, but I do have a gps always connected, which provide accurate date and UTC time.<br />
I have found some tutorials on how I can set up ntp to update the system clock based on gpsd but they didn't worked with any of my gps devices:<br />
<a href="http://www.mr-lee-catcam.de/pe_cc_i6.htm" target="_blank">ST22 SkyTraq GPS receiver</a><br />
<a href="http://www.columbus-gps.de/produkte/columbus-v-800-plus/">Columbus V-800</a><br />
I have followed some links with no luck. I got:<br />
"gpsd:WARN: can't use GGA time until after ZDA or RMC has supplied a year."<br />
or<br />
"gps data is no good" <br />
or<br />
"unrecognized ... sentence"<br />
<br />
I have decided to make my own time synchronization based on parsing raw gps data.<br />
You can download an archive containing the scripts from <a href="http://code.google.com/p/andrei-development/downloads/detail?name=gps_time_generic.tar.gz">here</a>.<br />
<br />
<b><span style="color: #3d85c6;">How does it work?</span></b><br />
First connect your gps module:<br />
gpsd /dev/ttyAMA0 <br />
Then, to get the raw data I used:<br />
gpspipe -R -n10<br />
This command will get the first 10 lines from gps raw data. I got this:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">pi@raspberrypi ~ $ gpspipe -R -n10<br />{"class":"VERSION","release":"3.6","rev":"3.6","proto_major":3,"proto_minor":7}<br />{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyAMA0","activated":"2013-10-06T09:42:18.793Z","flags":1,"driver":"Generic NMEA","native":0,"bps":9600,"parity":"N","stopbits":1,"cycle":1.00}]}<br />{"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false}<br />$GPGGA,094220.784,4425.1141,N,02602.8254,E,1,05,1.6,96.1,M,37.0,M,,0000*6D<br />$GPGSA,A,3,25,05,29,31,21,,,,,,,,3.1,1.6,2.7*3A<br />$GPGSV,3,1,09,29,61,061,29,21,58,214,37,25,41,146,38,31,33,245,35*72<br />$GPGSV,3,2,09,05,25,056,30,16,14,314,,18,09,170,19,12,04,138,20*76<br />$GPGSV,3,3,09,06,02,278,*49<br />$GPRMC,094220.784,A,4425.1141,N,02602.8254,E,000.0,191.5,061013,,,A*6E<br />$GPVTG,191.5,T,,M,000.0,N,000.0,K,A*01</span></blockquote>
<b><span style="color: #3d85c6;">The Shell part. </span></b><br />
To set UTC time for our unix system we have to issue a command like this:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">date -u -s "2013/10/05 12:48:00"</span></blockquote>
From the raw gps output, we see that GPRMC gives all the needed information about the date and time(see <a href="http://aprs.gids.nl/nmea/#rmc">here</a> what the fields mean).<br />
My idea was to capture just GPRMC data from this output and send it as a parameter to a C program which will parse the string and create a new string as needed to set time.<br />
To get the GPRMC string from the raw gps output I have did the following bash command:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">gpspipe -R -n10 | sed -n "/GPRMC/,/*/p"</span></blockquote>
Decomposition of the command:<br />
gpspipe -R -n10 - this outputs the first 10 lines from the gps raw output.<br />
sed -n "/GPRMC/,/*/p" - extracts the line starting with the string GPRMC<br />
I have used unix pipes(| character) to pass the output from gpspipe -R -n10 to the sed command.<br />
The output from this command will be like this:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">pi@raspberrypi ~ $ gpspipe -R -n10 | sed -n "/GPRMC/,/*/p"<br />$GPRMC,100201.786,A,4425.1179,N,02602.8192,E,000.0,191.5,061013,,,A*61<br />$GPVTG,191.5,T,,M,000.0,N,000.0,K,A*01</span></blockquote>
Now, to pass this as program arguments(assuming the program's name is set_date) we have to do the following:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">./set_date 21 $(gpspipe -R -n10 | sed -n "/GPRMC/,/*/p")</span></blockquote>
<b><span style="color: #3d85c6;">The C program part. </span></b><br />
In this example, argc will be 4 and argv will be as follows:<br />
argv[0] - "./set_date"<br />
argv[1] - "21" <br />
argv[2] - "$GPRMC,<span style="color: #f1c232;">100201.786</span>,A,4425.1179,N,02602.8192,E,000.0,191.5,<span style="color: #f1c232;">061013</span>,,,A*61"<br />
argv[3] - "$GPVTG,191.5,T,,M,000.0,N,000.0,K,A*01"<br />
<br />
The GPRMC output gives 100201 for time and 061013 for date<span style="color: red;"><span style="color: black;">. This means:</span></span><br />
<span style="color: red;"><span style="color: black;">UTC time is 10:02:01 and date is 06 October 2013. GPRMC does not provide the full year, so we have to provide the century as an argument to the C program to compute the correct date.</span></span><br />
<span style="color: red;"><span style="color: black;"><br /></span></span>
We are only interested in argv[1] and argv[2], so, in the C program we will convert argv[1] to int using atoi(argv[1]) and we will have the century and after this we have to parse argv[2] using sscanf to get the two numbers for time: 100201 and for date 061013. Let's assume we got these numbers in two uint32_t variables:<br />
rawDate = 61013<br />
rawTime = 100201<br />
To get useful data from here we have to do this:<br />
<blockquote class="tr_bq">
<span style="color: #999999;">hour = timeRaw / 10000;</span><br />
<span style="color: #999999;">minute = (timeRaw % 10000) / 100;<br />second = (timeRaw % 10000) % 100;<br /><br />century = atoi(argv[1]);<br />day = dateRaw / 10000;<br />month = (dateRaw % 10000) / 100;<br />year = (century - 1) * 100 + (dateRaw % 10000) % 100; </span></blockquote>
After this, to create the command we can use sprintf to put everything in an outputBuffer and then call system(outputBuffer) to execute the command.<br />
<br />Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com5tag:blogger.com,1999:blog-7916030958686584529.post-74790800401618190642013-08-31T19:15:00.000+03:002014-09-02T09:23:18.527+03:00OpenElec with support for eGalax touch screenHi!<br />
<br />
Lately I have tested OpenElec for Raspberry PI and found out that it is very very fast, very very small and also it has some great addons(wifi, bluetooth and more).<br />
Speed/size features on an 512MB RaspberryPI:<br />
- a complete boot is less than 25 seconds<br />
- cpu is around 30% load<br />
- memory used is 32%<br />
- total system size is less than 300MB<br />
<br />
<span style="color: #f1c232;">Edit</span><span style="color: #b45f06;">.</span> You can download my build from <a href="https://code.google.com/p/andrei-development/downloads/detail?name=OpenElecRPIeGalax.tar.gz">here</a>(contains eGalax module and XBMC patches).<br />
Username is root and password is openelec. The touch screen calibration file should be put in /storage/touchscreen_axes_calib.<br />
<br />
Next, I will guide you through the instructions for building(cross compile) latest OpenElec for Raspberry PI with touch screen support.<br />
For this tutorial let's assume that you have a Linux machine where you will work.<br />
<br />
<span style="color: #3d85c6;"><b>1. Get the latest OpenElec.</b></span><br />
git clone git://github.com/OpenELEC/OpenELEC.tv.git<br />
<br />
<span style="color: #3d85c6;"><b>2. Add kernel touch screen module support.</b></span><br />
Open the file OpenELEC.tv/projects/RPI/linux/linux.arm.conf and search for "CONFIG_INPUT_TOUCHSCREEN". Replace the whole text line with the following lines:<br />
CONFIG_INPUT_TOUCHSCREEN=y<br />
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y<br />
CONFIG_TOUCHSCREEN_USB_EGALAX=y<br />
<span style="color: #3d85c6;"><b><strike>3. Fix ppl version in OpenElec.</strike></b></span><br />
<strike>Open the file OpenELEC.tv/packages/toolchain/math/ppl/meta and change PKG_VERSION from "1.1pre9" to "1.1pre10"</strike><br />
<br />
<strike><b><span style="color: #3d85c6;">4. Put touch screen calibration file into the system.</span></b></strike><br />
<strike>Navigate to folder OpenELEC.tv/projects/RPI/ and create the file usr/share/eGalaxCalibration/touchscreen_axes_calib. This file should have the following contents:</strike><br />
<strike>calib_x_d=-21;calib_x_fact=0.658097686;calib_y_d=-50;calib_y_fact=0.408626561;swap_axes=0;click_confines=8 </strike><br />
<strike>To set up these values please visit <a href="http://www.engineering-diy.blogspot.ro/2013/02/raspberry-pi-raspbian-xbmc-and-egalax-7.html">this post</a>(at section 4).</strike><br />
This step is not needed any more, because you can use the calibration addon to calibrate your screen.<br />
Get the calibration addon from my <a href="https://drive.google.com/?tab=wo&authuser=0#folders/0B__Rs5JF53-kanQxTk40V0p3Ums">Downloads </a>folder and put it in /storage/.xbmc/addons/<br />
<br />
<span style="color: #3d85c6;"><b>5. Put XBMC 12.3 patch.</b></span><br />
Get my latest patches from <a href="https://drive.google.com/?tab=wo&authuser=0#folders/0B__Rs5JF53-kSkplM1ZOdTFMVU0">here</a> and put them in the folder OpenELEC.tv/packages/mediacenter/xbmc/patches/<br />
<br />
<span style="color: #3d85c6;"><b>6. Build OpenElec.</b></span><br />
Navigate to OpenElec folder and type:<br />
PROJECT=RPi ARCH=arm make -j3<br />
-j3 option is to use parallel build(if you have more than one cpu's set this number as nb_cpus+1). This option will speed up the build process.<br />
<span style="color: #f1c232;">The build process will take couple of hours, but you have to come back once(in the first 10 minutes) and press ENTER for the kernel touch screen modifications to be approved.</span><br />
<br />
<span style="color: #3d85c6;"><b>7. Install or Update your OpenElec card.</b></span><br />
Go to <a href="http://wiki.openelec.tv/index.php?title=Building_and_Installing_OpenELEC_for_Raspberry_Pi">OpenElec build instructions page for RPI</a> and follow the "Install instructions" chapter.<br />
<br />
Have fun!Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com90Tudor Vladimirescu, Bucharest, Romania44.419191418308195 26.04744672775268644.417773918308193 26.044925227752685 44.4206089183082 26.049968227752686tag:blogger.com,1999:blog-7916030958686584529.post-13567047958141748382013-08-06T22:51:00.002+03:002014-09-28T22:51:16.422+03:00Car PC project(August 2013 update)This is an update for my CarPC project.<br />
You can download the latest image from the link on the top right corner of this blog(username:'pi', password:'a').<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/dKXmXAaai8A?feature=player_embedded' frameborder='0'></iframe></div>
The main features are:<br />
<b><span style="color: #3d85c6;">Hardware:</span></b><br />
<ul>
<li>Raspberry PI model B(256MB ram): ~35$</li>
<li><a href="http://www.ebay.com/itm/261122525622?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649">7 inch display with touchscreen for car rear view camera, from eBay(touchscreen is connected to one USB port)</a>: 80$</li>
<li>HDMI male to HDMI male cable(golden plated):20$</li>
<li>8GB SDHC class 6 card: 20$</li>
<li>12V(500mA) AC to DC adapter for powering the display</li>
<li>5V(1A) microUSB AC to DC converter for powering the PI</li>
<li><a href="http://www.mr-lee-catcam.de/pe_cc_i6.htm">ST22 SkyTraq GPS Receiver Module</a>: 25$</li>
<li><a href="http://www.ebay.com/itm/Car-Rear-View-CAMERA-for-BMW-1-3-5-6-Series-X3-X5-X6-E53-E82-E88-E90N-M3-E46-CSL-/260852691073?pt=AU_Car_Parts_Accessories&hash=item3cbc083081&vxp=mtr">Reverse Camera</a>: 15$</li>
</ul>
<b><span style="color: #3d85c6;">Software:</span></b><br />
[Operating System]<br />
- Raspbian Wheezy 9.February.2013<br />
- Custom kernel 3.6.11<br />
- eGalax touch screen module<br />
- si470x usb radio module<br />
- snd-usb-audio module <br />
<br />
[Media Center]<br />
- omxplayer<br />
- XBMC 12.2 Frodo<br />
- media formats supported: <a href="http://wiki.xbmc.org/index.php?title=Features_and_supported_formats#Audio.2C_video.2C_and_pictures_playback_and_handling">listed here</a><br />
- sources with objects build on 27.July.2013<br />
- skin: CarPC-touch(<a href="http://code.google.com/p/andrei-development/downloads/list">download current version</a>)<br />
- system shutdown button(safely stop xbmc and safely halt)<br />
- reload skin button<br />
- switch to camera view button<br />
- modified spectrum analyzer(OpenGL with no rotation)<br />
- eGalax touch screen calibrated<br />
- eGalax touch screen click&drag fix<br />
- black rectangle behind XBMC removed<br />
- patch to add getMousePosition feature to xbmcgui module(used to redirect clicks from the Navigation skin page to X11 using xdotool)<br />
<br />
[Navigation]<br />
- Navit build from source<br />
- Zoom In, Zoom Out buttons<br />
- Click sent from XBMC to X11 (Navit Window)<br />
<br />
<b><span style="color: #3d85c6;">GPS Setup</span></b><br />
1. Connect GPS module to UART TX, UART RX, GND and 3.3V or on a usb port.<br />
2. If you are using an UART GPS module, as I did, use <a href="https://sites.google.com/site/semilleroadt/raspberry-pi-tutorials/gpio">this tutorial</a> or any other to setup UART communication.<br />
3. Connect GPS to gpsd: <br />
sudo apt-get install gpsd<br />
gpsd /dev/ttyAMA0<br />
<b><br /></b>
<b><span style="color: #3d85c6;">Adding maps to Navit</span></b><br />
In order to add new maps to Navit, there is a simple process. First, go to <a href="http://maps6.navit-project.org/">Navit Planet Extractor</a> and download your desired area file(this will be a .bin file).<br />
After this, transfer the file to your Raspberry PI in the folder /home/pi/navit_export/build/navit/maps/. Here, you should also update the existing .xml file and add another entry for your new map. My .xml file is looking like this:<br />
<blockquote class="tr_bq">
<map type="binfile" data="$NAVIT_SHAREDIR/maps/osm_bbox_11.3,47.9,11.7,48.2.bin" /><br />
<map type="binfile" data="$NAVIT_SHAREDIR/maps/osm_bbox_20.3,43.5,29.9,48.4.bin" /></blockquote>
You can rename your .bin files for easier management<br />
<br />
<b><span style="color: #3d85c6;">Car Modding</span></b><br />
I had to relocate my original Radio/CD player in the trunk and keep it set on aux input source. This included buying about 60m of wires and also harness:<br />
<span style="font-size: small;"><span style="font-weight: normal;">1. </span></span><a href="http://www.ebay.com/itm/Metra-71-9003-Bmw-Mini-Factory-Radio-OEM-Wire-Harness-/330529294873?pt=Car_Audio_Video&hash=item4cf514ca19"><span style="font-size: small;"><span style="font-weight: normal;">Metra 71-9003 Bmw Mini Factory Radio OEM Wire Harness</span></span></a><br />
2.<span style="font-size: small;"><span style="font-weight: normal;"> <a href="http://www.ebay.com/itm/Scosche-VW03B-2002-Vw-Audi-BMW-Radio-Stereo-Harness-/220788821300?pt=Car_Audio_Video&hash=item33680a0d34">Scosche VW03B 2002+ Vw Audi BMW Radio Stereo Harness</a></span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4s1svaumV1Td_Q602JfVxKOs1GnryGEwUieQoHVQp3x9wT2t-MONYJ3uQj30g6JlfjORheILWsM1zdAwqYhGnzV8wBByP00AfC7iU4j767x8Zkoovwh26CGneS99c82MDvHbH_CIrr2-Q/s1600/DSC00298.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4s1svaumV1Td_Q602JfVxKOs1GnryGEwUieQoHVQp3x9wT2t-MONYJ3uQj30g6JlfjORheILWsM1zdAwqYhGnzV8wBByP00AfC7iU4j767x8Zkoovwh26CGneS99c82MDvHbH_CIrr2-Q/s1600/DSC00298.JPG" height="240" width="320" /></a></div>
<div style="text-align: center;">
front without OEM Radio/CD player</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2VoNbM5fxIXF6Oa9K8v4PEPzdfvvLphsvjmL2dBe5nNyQqvMgh__bqVdoYjrpX3-CEN9LdjeNq3fkXUaypIAxrjg09Bx4oQzSLFr5S2IOETrL_1eVkhyphenhyphenfP5PU2p8Mhn7lkix-ZneBlj8E/s1600/DSC00324.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2VoNbM5fxIXF6Oa9K8v4PEPzdfvvLphsvjmL2dBe5nNyQqvMgh__bqVdoYjrpX3-CEN9LdjeNq3fkXUaypIAxrjg09Bx4oQzSLFr5S2IOETrL_1eVkhyphenhyphenfP5PU2p8Mhn7lkix-ZneBlj8E/s1600/DSC00324.JPG" height="240" width="320" /></a></div>
<div style="text-align: center;">
trunk with relocated OEM Radio/CD player<b> </b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6PRBBGsJAJ8i5hid9qxbFwnNCX2g04mkzqBtrPDP58_NYLK_zA7Nro6XnQaYsx6Xrg_avjOEykgpMHId8jlbUawOwNJFZn0bKZulkvIQI6wGWtYo4AKkkiGzcht6ik_-hcWLCiQt2dabA/s1600/RPI_mount.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6PRBBGsJAJ8i5hid9qxbFwnNCX2g04mkzqBtrPDP58_NYLK_zA7Nro6XnQaYsx6Xrg_avjOEykgpMHId8jlbUawOwNJFZn0bKZulkvIQI6wGWtYo4AKkkiGzcht6ik_-hcWLCiQt2dabA/s1600/RPI_mount.JPG" height="172" width="320" /></a></div>
<div style="text-align: center;">
Mounted Raspberry PI<b> </b>in the armrest<b><br /></b></div>
<b><span style="color: #3d85c6;">Safety:</span></b><br />
- The wires are 2mm in diameter with good insulation, resistant at temperature variations<br />
- I have added fuses(1.5A for the radio, 1A for Raspberry PI, 1A for display, 0.1A for reverse camera trigger, 0.1A for reverse camera video signal)<br />
<br />
<b><span style="color: #3d85c6;">Bugs:</span></b><br />
<b> </b> - sound pops(will soon disappear by using <a href="http://www.ebay.com/itm/281035186817?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649">this</a> hdmi to hdmi and audio splitter) <br />
- Navigation is behind Video Player -> Navigation isn't visible while playing videos(this isn't a big issue)Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com241tag:blogger.com,1999:blog-7916030958686584529.post-14780586492662726012013-07-12T22:43:00.001+03:002014-03-21T22:31:21.873+02:00CarPC first buildHi!<br />
<br />
After working a lot at my CarPC project I have decided to take a break and post about it.<br />
<br />
A short preview is here:<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/d7uRCweGXP0?feature=player_embedded' frameborder='0'></iframe></div>
<br />
You can download the latest image from my Downloads page in the top right corner of this blog.<br />
If you want to build it by yourself please follow <a href="http://www.engineering-diy.blogspot.ro/2013/02/raspberry-pi-raspbian-xbmc-and-egalax-7.html">my previous tutorials</a> but replace the three patches with the single patch from <a href="http://code.google.com/p/andrei-development/downloads/detail?name=eGalaxPatch.diff&can=2&q=#makechanges">here</a>, which is for XBMC12.2. Also read my previous post to find how to calibrate the screen axes.<br />
<br />
Features:<br />
<ul>
<li>auto start XBMC </li>
<li>eGalax touch screen support with configurable greater area for touch event(8 pixels)</li>
<li>improved skin with larger buttons and smooth transitions(<a href="http://code.google.com/p/andrei-development/downloads/detail?name=skin.CarPC-touch-v1.zip">link for the skin</a>)</li>
<li>System Power OFF button</li>
<li>usbmount enabled(so usb MSD's are plug and play)</li>
</ul>
The new calibration file contains one more entry: click_confines which defines the area for XBMC to distinguish between click and drag actions(touch moves less than 8 pixels before release than action is click, else the action is drag). <br />
<br />
Have fun!<br />
AndreiAndreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com15Tudor Vladimirescu, Bucharest, Romania44.418838921754208 26.04761838912963944.417421421754206 26.045096889129638 44.42025642175421 26.050139889129639tag:blogger.com,1999:blog-7916030958686584529.post-71132528442471163232013-02-26T10:04:00.000+02:002015-02-10T12:36:28.872+02:00Raspberry PI, Raspbian, XBMC and eGalax 7 inch touchscreenHello!<br />
<br />
I have spent some time lately trying to find a solution to get my 7 inch eGalax touchscreen to work with Raspbian(Debian Wheezy) in XBMC 12 Frodo and finally got it working as I wanted.<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/AVvXsEjrqrdAab5-OVlHr6h4-5e_QUEpzvQaok1BT8hnOBxEHk3YL5iroo82OuyCLl90wEKv5yjfptgYW9u9h4B6AuTvJ-zyMOgV-XP7my-4vteNBPaVd3yIoaIKCSMdccSZltN6H_9o0kJcy7Wi/s1600/RaspberryPI_display_eGalax.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrqrdAab5-OVlHr6h4-5e_QUEpzvQaok1BT8hnOBxEHk3YL5iroo82OuyCLl90wEKv5yjfptgYW9u9h4B6AuTvJ-zyMOgV-XP7my-4vteNBPaVd3yIoaIKCSMdccSZltN6H_9o0kJcy7Wi/s1600/RaspberryPI_display_eGalax.JPG" height="640" width="465" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">My Setup</td></tr>
</tbody></table>
<ul>
<li>Raspberry PI model B: ~30$</li>
<li>7 inch display with touchscreen for car rear view camera, from eBay(touchscreen is connected to one USB port): 80$</li>
<li>HDMI male to HDMI male connector(from eBay): <2$</li>
<li>4GB SDHC class 4 card</li>
<li>12V(500mA) AC to DC adapter for powering the display</li>
<li>5V(1A) microUSB AC to DC converter for powering the PI</li>
<li>USB keyboard</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/WbxRf8BejnY?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<span style="color: #e69138;">Edit:</span> Download the latest image from the top right corner of this blog(username: pi, password: a). <br />
<br />
Here is what you need to do in order to have a system with Raspberry PI, Raspbian OS and XBMC 12 Frodo stable with eGalax touchscreen working correctly(which means axes calibrated and click working with just one tap&release action):<br />
<br />
<br />
<b><span style="color: #3d85c6;">1. Get latest Raspbian</span></b> image from <a href="http://www.raspberrypi.org/downloads">here</a> and flash it to an SD card.<br />
<br />
<b><span style="color: #3d85c6;">2. Build your own kernel</span></b> with eGalax touchscreen support, like in <a href="http://www.engineering-diy.blogspot.ro/2013/01/adding-7inch-display-with-touchscreen.html">this</a> post(you will only need to replace kernel.img file and /lib/modules and /lib/firmware folders on the SD card).<br />
<br />
<b><span style="color: #3d85c6;">3. Build XBMC 12</span></b> on Raspberry PI using <a href="http://www.engineering-diy.blogspot.ro/2013/02/build-xbmc-frodo-from-source-in.html">this</a> tutorial.<br />
Note: After downloading XBMC archive, get <a href="http://code.google.com/p/andrei-development/downloads/detail?name=eGalax_patch_for_XBMC_12.tar.gz">this</a> archive and unpack it anywhere.<br />
Apply patches to xbmc files:<br />
<blockquote class="tr_bq">
cd <patches_folder><br />
patch -p1 <path_to_xbmc>/xbmc/input/linux/LinuxInputDevices.cpp < LinuxInputDevices_cpp.patch<br />
patch -p1 <path_to_xbmc>/xbmc/input/MouseStat.cpp < MouseStat_cpp.patch<br />
patch -p1 <path_to_xbmc>/xbmc/input/MouseStat.h < MouseStat_h.patch</blockquote>
<span style="color: #3d85c6;"><b>4. Touchscreen calibration</b>.</span><br />
Create a new file /home/pi/touchscreen_axes_calib on Raspberry PI. It will contain four values for the axes calibration and one value for swapping axes.<br />
The simplest way to swap axes is to switch the four wires cable plug's orientation which comes from the touchscreen to the touch controller.<br />
<br />
Here is how the calibration was done.<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/AVvXsEg_EjgXI_d1QQBP3ldPuD-zRHhrIbVhDRdnbSNujFaFJxxzYnNYkemElPP8mzvC_8u-RHV1dMhikdr9sA3NT_xHOxW6DBsBzhHup-fRPeESG9w-2KB61a7z3t5bH-whGL4la8r5QbJ8XQAo/s1600/sch.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_EjgXI_d1QQBP3ldPuD-zRHhrIbVhDRdnbSNujFaFJxxzYnNYkemElPP8mzvC_8u-RHV1dMhikdr9sA3NT_xHOxW6DBsBzhHup-fRPeESG9w-2KB61a7z3t5bH-whGL4la8r5QbJ8XQAo/s1600/sch.png" height="222" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">the original behavior(no calibration)</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="text-align: start;">In the picture above, we see that </span><span style="color: #bf9000; text-align: start;">"touch panel values frame"</span><span style="text-align: start;"> differs from </span><span style="color: #38761d; text-align: start;">"touch panel physical size frame"</span><span style="text-align: start;">. When we are pressing the touch we are moving in the </span><span style="color: #38761d;">"touch panel physical size frame" </span>but when the touch screen is not calibrated the arrow from XBMC is in another place.</div>
<ul>
<li><span style="color: #38761d;">"touch panel physical size frame"</span> is the screen starting from (0,0) on the left top corner and going to (width, height) in the right bottom corner.</li>
<li><span style="color: #bf9000;">"touch panel values frame"</span> is the frame which contains all the number the touch controller is giving.</li>
</ul>
We see that these frames differs a lot. Our main scope is to overlap the <span style="color: #bf9000;">"touch panel values frame"</span> to the <span style="color: #38761d;">"touch panel physical size frame"</span>.<br />
<br />
In order to do this we need to do three steps(the third one is done in software):<br />
<b>a. Scale</b> the value read from the touch driver x and y) in order to fit 0->width range and respectively 0->height range of the <span style="color: #38761d;">"touch panel physical size frame" </span>the scale value for x axis is:<br />
<span style="color: #38761d;">"touch panel physical size frame"</span> width<br />
calib_x_fact = -------------------------------------------------<br />
<span style="color: #bf9000;">"touch panel values frame"</span> width<br />
<br />
<br />
<span style="color: #38761d;">"touch panel physical size frame"</span> height<br />
calib_y_fact = -------------------------------------------------<br />
<span style="color: #bf9000;">"touch panel values frame"</span> height<br />
<br />
<span style="color: #bf9000;">"touch panel values frame"</span> width and height are coming from your XBMC resolution(I have width=1280 and height=720).<br />
<span style="color: #38761d;">"touch panel physical size frame"</span> width and height are a little more trickier to find but nothing hard. In step 2 above, you have calibrated the touchscreen in XFCE. You got some values returned by xinput_calibrator, something like:<br />
<blockquote class="tr_bq">
Section "InputClass"<br />
Identifier "calibration"<br />
MatchProduct "eGalax Inc. USB TouchController"<br />
Option "Calibration" "1977 32 1893 131"<br />
EndSection</blockquote>
<div>
<div>
<div>
In my case,<br />
<span style="color: #38761d;">"touch panel physical size frame"</span> width is 1977 - 32 = 1945<br />
<span style="color: #38761d;">"touch panel physical size frame"</span> height is 1893 - 131 = 1762<br />
Now, compute the values and put them in /home/pi/touchscreen_axes_calib file<br />
<br />
<b>b. Translate</b> the <span style="color: #bf9000;">"touch panel values frame"</span> to the left and up, to match <span style="color: #38761d;">"touch panel physical size frame"</span>.<br />
I didn't find a logical method to do this, because we don't know exactly "where is" the <span style="color: #bf9000;">"touch panel values frame"</span>, so, in order to find calib_x_d and calib_y_d you have to first set them both to zero and then start XBMC. Now, put some sharp pointer on the screen and observe the distances between the cursor on the screen and your pointer's position. Try to approximate these x and y deviations(measured in pixels) and put them in the /home/pi/touchscreen_axes_calib file.<br />
<br />
<b>c. Revert direction of axes</b>. This is done in the software(from patches).<br />
<br />
<b><span style="color: #3d85c6;">5. Math behind.</span></b><br />
To accomplish these transformations the following formula was implemented in the file<br />
xbmc/input/linux/LinuxInputDevices.cpp<br />
pointer.x = value_read.x * calib_x_fact + calib_x_d;<br />
pointer.y = value_read.y * calib_y_fact + calib_y_d;<br />
<br />
After I have successfully calibrated the touchscreen I have discovered that single click was not possible from the touchscreen, just double click. After digging through the code, I have found that this was caused by drag action which was triggered because the previous values of the touch were far(more than 5 pixels) from a new press. For example, at the start of the program, cursor is set at 0,0 coordinates; if user is trying to press a button, let's say at 100, 300, the program(XBMC) will calculate the distance between these two points and will find out that this is greater than 5.<br />
Pythagorean theory: <br />
(100-0)x(100-0) + (300 - 0)x(300-0) is greater than 5x5 XBMC will treat this as a drag event.<br />
This drag issue is not caused when you double click, because the previous point in the second click action is very close to the second click point. This also works for mouses, because the previous value of the pointer is always very close to the new value of the pointer(because mouse's pointer drags on the screen and it doesn't jump - so each new value is very close to the previous one).<br />
<br />
I have developed an algorithm to avoid this issue:<br />
When the user is pressing the screen(x,y), the touch values are being set to (screen_width+1, screen_height+1 -> outside of the visible screen) just at the first event read(which is BTN_TOUCH PRESS).<br />
After this event, the program will receive multiple X and Y absolute values events. The first two events, one for X and one for Y are used to set the previous X value, respectively previous Y value to the current X respective current Y values. And from now on distance is measured and this is preventing no unwanted drag action.<br />
The user's finger/pointer will not stay at a single point, because the touchscreen's lack of precision, so it will move around 5-6 pixels in x and y directions.<br />
I have also set the click distance to 7. You can change this by changing click_confines value in xbmc/input/MouseStat.h. Originally it was set to 5, but this is not very good for touch screens(I had to click with a sharp pointer and with my nail always, but with a value of 7 I can click with my finger with a slight touch -> really nice).<br />
<br />
Enjoy!<br />
<br /></div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39602279-1']);
_gaq.push(['_setDomainName', 'engineering-diy.blogspot.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com201Bucharest, Romania44.418501749148831 26.04607343673706144.417084249148829 26.04355193673706 44.419919249148833 26.048594936737061tag:blogger.com,1999:blog-7916030958686584529.post-65303695674020294792013-02-22T03:00:00.000+02:002013-10-03T19:55:21.013+03:00Build XBMC Frodo from source in Raspbian on Raspberry PIHi!<br />
<br />
After struggling couple of days in finding the best way to build XBMC on Raspberry PI I have finally got a working solution(haven't discovered how I can cross-compile it, which would be the best choice).<br />
This takes about 15 hours, on my Raspberry PI model B, but the good news is that 'make' takes about 12 hours, so you don't need to watch it, just come from time to time to see if it is working. Besides the build messages displayed on screen you have the whole logs for rbp_depends, configure, make and make install steps. If anything goes wrong you can investigate these files(the last one reached) and search for the first error<br />
<blockquote class="tr_bq">
log_1_rbp_depends.log<br />
log_2_configure.log<br />
log_3_make.log<br />
log_4_make_install.log</blockquote>
This tutorial is for Linux Host Machine but it can be easily adapted to any other OS.<br />
Let's get this started!<br />
<br />
<b><span style="color: #3d85c6;">1. Get the latest Raspbian Wheezy image</span></b> from <a href="http://www.raspberrypi.org/downloads">http://www.raspberrypi.org/downloads</a> and put it on an SD card:<br />
You have couple of possibilities to do this. In Linux you can use:<br />
<blockquote class="tr_bq">
sudo dd bs=1M if=raspbian_wheezy_image_path of=/dev/sd_card_path</blockquote>
<span style="color: #3d85c6;"><b>2.</b> <b>Get XBMC 12 source code</b></span> from <a href="http://xbmc.org/download/">http://xbmc.org/download/</a>. On the Source Code section, download the zip file from where it says: "Stable release sources are available <a href="http://mirrors.xbmc.org/releases/source/xbmc-12.0.tar.gz">here</a>".<br />
If you get the code from git it will probably get an unstable version, which is the latest code. When I have build from source I have got XBMC 13 alpha 1 which worked, but no addon was working.<br />
Transfer xbmc folder to your /home/pi/ directory or wherever you like.<br />
Now you can plug the card in Raspberry PI and follow the next steps.<br />
<br />
Note. The easiest way to do this is via ssh(first, enable it using sudo raspi-config menu), from a computer. Just connect in Terminal using:<br />
<blockquote class="tr_bq">
ssh pi@x.x.x.x</blockquote>
where x.x.x.x is the ip address of your device. You can get the ip address by typing ifconfig. Then you just copy/paste the commands into Terminal.<br />
<br />
<div>
<b><span style="color: #3d85c6;">3. Set minimum amount of video memory and create a swap partition</span></b>:</div>
<div>
<blockquote class="tr_bq">
sudo raspi-config</blockquote>
</div>
<div>
Here you should expand_rootfs, disable overscan, configure_keyboard, change_pass, change_timezone and enable ssh. Select memory_split and enter 16 then restart.</div>
<div>
Now, to create a swap partition, use the following:</div>
<div>
<blockquote class="tr_bq">
dd if=/dev/zero of=/home/pi/swapfile1 bs=1024 count=204800<br />
sudo mkswap /home/pi/swapfile1<br />
sudo chown root:root /home/pi/swapfile1<br />
sudo chmod 0600 /home/pi/swapfile1<br />
sudo swapon /home/pi/swapfile1</blockquote>
</div>
<div>
The swap file is needed as extra memory for the compiler. This will prevent you from getting errors like:</div>
<div>
gcc: internal compiler error: Killed (program cc1)</div>
<div>
<br /></div>
<b><span style="color: #3d85c6;">4. Update the system and install some dependencies</span></b>:<br />
<blockquote class="tr_bq">
sudo apt-get update<br />
sudo apt-get upgrade<br />
sudo apt-get install autotools-dev comerr-dev dpkg-dev libalsaplayer-dev libapt-pkg-dev:armhf libasound2-dev libass-dev:armhf libatk1.0-dev libavahi-client-dev libavahi-common-dev libavcodec-dev libavformat-dev libavutil-dev libbison-dev:armhf libbluray-dev:armhf libboost1.49-dev \<br />
libbz2-dev:armhf libc-dev-bin libc6-dev:armhf libcaca-dev libcairo2-dev libcdio-dev libclalsadrv-dev libcrypto++-dev libcups2-dev libcurl3-gnutls-dev \<br />
libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev libdrm-dev libegl1-mesa-dev libelf-dev libenca-dev libept-dev libevent-dev libexpat1-dev libflac-dev:armhf \<br />
libfontconfig1-dev libfreetype6-dev libfribidi-dev libgconf2-dev libgcrypt11-dev libgdk-pixbuf2.0-dev libgl1-mesa-dev libgles2-mesa-dev \<br />
libglew-dev:armhf libglewmx-dev:armhf libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgnutls-dev libgpg-error-dev libgtk2.0-dev libhal-dev \<br />
libhunspell-dev:armhf libice-dev:armhf libicu-dev libidn11-dev libiso9660-dev libjasper-dev libjbig-dev:armhf libjconv-dev libjpeg8-dev:armhf libkrb5-dev \<br />
libldap2-dev:armhf libltdl-dev:armhf liblzo2-dev libmad0-dev libmicrohttpd-dev libmodplug-dev libmp3lame-dev:armhf libmpeg2-4-dev libmysqlclient-dev \<br />
libncurses5-dev libnspr4-dev libnss3-dev libogg-dev:armhf libopenal-dev:armhf libp11-kit-dev libpam0g-dev:armhf libpango1.0-dev libpcre++-dev libpcre3-dev \<br />
libpixman-1-dev libpng12-dev libprotobuf-dev libpthread-stubs0-dev:armhf libpulse-dev:armhf librtmp-dev libsamplerate0-dev:armhf \<br />
libsdl-image1.2-dev:armhf libsdl1.2-dev libslang2-dev:armhf libsm-dev:armhf libsmbclient-dev:armhf libspeex-dev:armhf \<br />
libsqlite3-dev libssh-dev libssh2-1-dev libssl-dev libstdc++6-4.6-dev libtagcoll2-dev libtasn1-3-dev libtiff4-dev libtinfo-dev:armhf libtinyxml-dev \<br />
libts-dev:armhf libudev-dev libv8-dev libva-dev:armhf libvdpau-dev:armhf libvorbis-dev:armhf libvpx-dev:armhf libwebp-dev:armhf libwibble-dev \<br />
libx11-dev:armhf libx11-xcb-dev libxapian-dev libxau-dev:armhf libxcb-glx0-dev:armhf libxcb-render0-dev:armhf libxcb-shm0-dev:armhf \<br />
libxcb1-dev:armhf libxcomposite-dev libxcursor-dev:armhf libxdamage-dev libxdmcp-dev:armhf libxext-dev:armhf libxfixes-dev libxft-dev libxi-dev \<br />
libxinerama-dev:armhf libxml2-dev:armhf libxmu-dev:armhf libxrandr-dev libxrender-dev:armhf libxslt1-dev libxss-dev:armhf libxt-dev:armhf \<br />
libxtst-dev:armhf libxxf86vm-dev libyajl-dev libzip-dev linux-libc-dev:armhf lzma-dev mesa-common-dev python-dev python2.7-dev x11proto-composite-dev \<br />
x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev \<br />
x11proto-record-dev x11proto-render-dev x11proto-scrnsaver-dev x11proto-xext-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev xtrans-dev \<br />
libnfs-dev libplist-dev avahi-daemon zlib1g-dev:armhf swig java-package libafpclient-dev liblockdev1-dev autoconf automake libtool gcc udev openjdk-6-jre \<br />
cmake g++ libudev-dev build-essential autoconf ccache gawk gperf mesa-utils zip unzip curl</blockquote>
This will take some time depending on your internet speed.<br />
<br />
<span style="color: #3d85c6;"><b>5. Copy libraries headers and create some symlinks for libraries</b>:</span><br />
<blockquote class="tr_bq">
sudo cp -R /opt/vc/include/* /usr/include<br />
sudo cp /opt/vc/include/interface/vcos/pthreads/* /usr/include/interface/vcos<br />
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/libEGL.so<br />
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so<br />
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1<br />
sudo ln -fs /opt/vc/lib/libEGL_static.a /usr/lib/libEGL_static.a<br />
sudo ln -fs /opt/vc/lib/libEGL_static.a /usr/lib/arm-linux-gnueabihf/libEGL_static.a<br />
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/libGLESv2.so<br />
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so<br />
sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2<br />
sudo ln -fs /opt/vc/lib/libGLESv2_static.a /usr/lib/libGLESv2_static.a<br />
sudo ln -fs /opt/vc/lib/libGLESv2_static.a /usr/lib/arm-linux-gnueabihf/libGLESv2_static.a<br />
sudo ln -fs /opt/vc/lib/libbcm_host.so /usr/lib/libbcm_host.so<br />
sudo ln -fs /opt/vc/lib/libbcm_host.so /usr/lib/arm-linux-gnueabihf/libbcm_host.so<br />
sudo ln -fs /opt/vc/lib/libvchiq_arm.a /usr/lib/libvchiq_arm.a<br />
sudo ln -fs /opt/vc/lib/libvchiq_arm.a /usr/lib/arm-linux-gnueabihf/libvchiq_arm.a<br />
sudo ln -fs /opt/vc/lib/libvchiq_arm.so /usr/lib/libvchiq_arm.so<br />
sudo ln -fs /opt/vc/lib/libvchiq_arm.so /usr/lib/arm-linux-gnueabihf/libvchiq_arm.so<br />
sudo ln -fs /opt/vc/lib/libvcos.a /usr/lib/libvcos.a<br />
sudo ln -fs /opt/vc/lib/libvcos.a /usr/lib/arm-linux-gnueabihf/libvcos.a<br />
sudo ln -fs /opt/vc/lib/libvcos.so /usr/lib/libvcos.so<br />
sudo ln -fs /opt/vc/lib/libvcos.so /usr/lib/arm-linux-gnueabihf/libvcos.so</blockquote>
There is a problem when compiling, with the file /usr/include/interface/vmcs_host/vcgencmd.h which includes the wrong vchost_config.h, so I have created a command to put the right inclusion:<br />
<blockquote class="tr_bq">
sudo sed -i 's/#include "vchost_config.h"/#include "linux\/vchost_config.h"/' /usr/include/interface/vmcs_host/vcgencmd.h</blockquote>
<b><span style="color: #3d85c6;">6. Install taglib, libcec and libshairport.</span></b><br />
<blockquote class="tr_bq">
cd <pah_to_xbmc_dir><br />
make -C lib/taglib<br />
sudo make -C lib/taglib install<br />
cd <any_directory><br />
git clone --depth 5 https://github.com/Pulse-Eight/libcec.git<br />
cd libcec<br />
./bootstrap<br />
./configure --prefix=/usr/local<br />
make<br />
sudo make install<br />
cd <path_to_xbmc_dir><br />
make -C lib/libshairport<br />
sudo make -C lib/libshairport install</blockquote>
<b><span style="color: #3d85c6;">7. Configure and compile XBMC</span></b><br />
<blockquote class="tr_bq">
cd <path_to_xbmc_dir><br />
export TARGET_SUBARCH="armv6zk"<br />
export TARGET_CPU="arm1176jzf-s"<br />
export TARGET_FLOAT="hard"<br />
export TARGET_FPU="vfp"<br />
export TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU"<br />
export TARGET_EXTRA_FLAGS="-Wno-psabi -Wa,-mno-warn-deprecated"<br />
export TARGET_COPT="-Wall -pipe -fomit-frame-pointer -O3 -fexcess-precision=fast -ffast-math -fgnu89-inline"<br />
export TARGET_LOPT="-s -Wl,--as-needed"<br />
export CFLAGS="-march=$TARGET_SUBARCH -mcpu=$TARGET_CPU $TARGET_FPU_FLAGS -mabi=aapcs-linux $TARGET_COPT $TARGET_EXTRA_FLAGS"<br />
export CXXFLAGS="$CFLAGS"<br />
export LDFLAGS="-march=$TARGET_SUBARCH -mtune=$TARGET_CPU $TARGET_LOPT"</blockquote>
Fix some errors:<br />
<blockquote class="tr_bq">
sed -i 's/USE_BUILDROOT=1/USE_BUILDROOT=0/' tools/rbp/setup-sdk.sh<br />
sed -i 's/TOOLCHAIN=\/usr\/local\/bcm-gcc/TOOLCHAIN=\/usr/' tools/rbp/setup-sdk.sh</blockquote>
Run:<br />
<blockquote class="tr_bq">
sudo sh tools/rbp/setup-sdk.sh</blockquote>
Fix other errors:<br />
<blockquote class="tr_bq">
sed -i 's/cd $(SOURCE); $(CONFIGURE)/#cd $(SOURCE); $(CONFIGURE)/' tools/rbp/depends/xbmc/Makefile</blockquote>
Run:<br />
<blockquote class="tr_bq">
make -C tools/rbp/depends/xbmc/ 2>&1 | tee log_1_rbp_depends.log</blockquote>
Configure:<br />
<blockquote class="tr_bq">
./configure --prefix=/usr/local --build=arm-linux-gnueabihf \<br />
--host=arm-linux-gnueabihf --localstatedir=/var/lib \<br />
--with-platform=raspberry-pi --disable-gl --enable-gles \<br />
--disable-x11 --disable-sdl --enable-ccache --enable-optimizations \<br />
--disable-external-libraries --disable-goom --disable-hal \<br />
--disable-pulse --disable-vaapi --disable-vdpau --disable-xrandr \<br />
--enable-airplay --disable-alsa --enable-avahi --enable-libbluray \<br />
--enable-dvdcss --disable-debug --disable-joystick --disable-mid \<br />
--enable-nfs --disable-profiling --disable-projectm --enable-rsxs \<br />
--enable-rtmp --disable-vaapi --disable-vdadecoder \<br />
--disable-external-ffmpeg --enable-optical-drive \<br />
--enable-player=omxplayer 2>&1 | tee log_2_configure.log</blockquote>
After configuration completes, please run he following command:<br />
<blockquote class="tr_bq">
sed -i 's/ifeq (1,1)/ifeq (0,1)/' tools/TexturePacker/Makefile</blockquote>
Compile(this will take about 12 hours):<br />
<blockquote class="tr_bq">
make 2>&1 | tee log_3_make.log</blockquote>
<b><span style="color: #3d85c6;">8. Install XBMC 12 in Raspbian.</span></b><br />
<blockquote class="tr_bq">
sudo make install 2>&1 | tee log_4_make_install.log</blockquote>
After this step you have to run raspi-config again and to set video memory to 128 and then restart. Now you should be able to run XBMC using<br />
<blockquote class="tr_bq">
/usr/local/lib/xbmc/xbmc.bin</blockquote>
Note: If you are running via xbmc command, or from XFCE menu->Multimedia->XBMC it will not start. The same command can be used to run XBMC from terminal or from XFCE interface.<br />
In addition you can also install PVR Addons and XVDR addon(but this is not necessary):<br />
<blockquote class="tr_bq">
cd <any_directory><br />
git clone --depth 5 git://github.com/opdenkamp/xbmc-pvr-addons.git<br />
cd xbmc-pvr-addons/<br />
./bootstrap<br />
./configure --prefix=/usr/local --enable-addons-with-dependencies<br />
sudo make install<br />
cd <any_directory><br />
git clone git://github.com/pipelka/xbmc-addon-xvdr.git<br />
cd xbmc-addon-xvdr<br />
sh autogen.sh<br />
./configure --prefix=/usr/local<br />
sudo make install</blockquote>
<span style="color: #e69138;"><b>Note</b></span><br />
If you want to modify sources after the compilation is completed, you just have to modify them and then run make again, which will build only the affected parts(couple of minutes), but remember to keep the video memory at maximum 32MB when you are building, and also keep the swap partition.<br />
<br />
Many thanks to:<br />
<ul>
<li>XBIAN forums </li>
<li>http://www.raspbian.org/RaspbianXBMC (mpthompson)</li>
</ul>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39602279-1']);
_gaq.push(['_setDomainName', 'engineering-diy.blogspot.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com41Tudor Vladimirescu, Bucharest, Romania44.418639683631476 26.0470739473266844.417222183631473 26.04455244732668 44.420057183631478 26.049595447326681tag:blogger.com,1999:blog-7916030958686584529.post-25790875200672377002013-01-19T21:59:00.003+02:002013-12-24T20:43:55.721+02:00Adding 7inch display with touchscreen to Raspberry PIHi!<br />
<br />
First thing I got in mind when seeing Raspberry PI was "car PC project".<br />
The targeted display was 7 inch with touchscreen. I have found a lot of displays on Ebay.<br />
<br />
I have got myself one for 85 dollars with free shipping(<a href="http://www.ebay.com/itm/261122525622?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649">this</a>; if it is not available any more you can search "reversing driver board hdmi" on ebay and you will find others). The display driver board has hdmi input and an on board resistive touchpanel with usb controller board.<br />
<br />
It took less than a month to receive it(in Romania). After unpack, it worked out of the box with Ubuntu 12.10(display + touchpanel) and with Windows, but for Windows I had to install some drivers also received in the package.<br />
<br />
I have installed latest Raspbian image on a SD_Card and tried it on my Raspberry PI model B, but the touchpanel didn't show any input. After searching a lot I have decided that I have to recompile the raspbian kernel and add support for touchpanel. This sounded very new to me but it seemed to be an easy task.<br />
<br />
First thing, I have run lsusb to see the touch controller type(on RaspberryPI):<br />
<blockquote class="tr_bq">
<i>pi@raspberrypi ~ $ lsusb</i><br />
<i>Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. </i><br />
<i>Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub</i><br />
<i>Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. </i><br />
<i>Bus 001 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory</i><br />
<i>Bus 001 Device 005: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen</i></blockquote>
Last device is the touch controller, from eGalax.<br />
<br />
<span style="color: yellow;">Edit</span>: If you don't want to build the kernel by yourself, you can download mine from <a href="http://code.google.com/p/andrei-development/downloads/detail?name=kernel_3_6_11_eGalax_feb_2013.tar.gz">here</a>. After his, you have to replace file /boot/kernel.img and /lib/firmware and /lib/modules/ on the SD card.<br />
<br />
<span style="color: #3d85c6;"><b>Building a new kernel(in UBUNTU 12.10).</b></span><br />
<i>Get kernel sources.</i><br />
<blockquote class="tr_bq">
<i><i>wget https://github.com/raspberrypi/linux/archive/rpi-3.6.y.tar.gz</i></i><br />
<i><i><i>tar -zxvf rpi-3.6.y.tar.gz</i></i> </i></blockquote>
Install some dependencies.<br />
<blockquote class="tr_bq">
<i>sudo apt-get install git libncurses5 libncurses5-dev qt4-dev-tools build-essential</i></blockquote>
Install toolchain.<br />
The best way to do the kernel compilation is on a Desktop/Laptop machine, which will be much more fast than on the Raspberry PI. I have did this in Ubuntu 12.10:<br />
<blockquote class="tr_bq">
<i>sudo apt-get install gcc-arm-linux-gnueabi </i></blockquote>
After download of the kernel archive has finished unpack it and then navigate with terminal to the extracted folder.<br />
Be sure thaat the sources objects are cleaned. Type:<br />
<blockquote class="tr_bq">
<i>make mrproper</i></blockquote>
Create a folder for the generated kernel:<br />
<blockquote class="tr_bq">
<i>mkdir ../kernel</i></blockquote>
Generate the .config file:<br />
<blockquote class="tr_bq">
<i>make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- bcmrpi_cutdown_defconfig</i></blockquote>
Configure the kernel:<br />
<blockquote class="tr_bq">
<i>make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- xconfig</i></blockquote>
In the opened window press the | button to collapse all items. Then, navigate to Device Drivers->Input Device Support->TouchScreens and select it. Here, be sure to check also your touch screen controller if it is other than eGalax, or if it is not selected. Now press save.<br />
<br />
With the changes being made you can now <i>compile the kernel</i>:<br />
<blockquote class="tr_bq">
<i>make O=../kernel/ ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j3</i></blockquote>
Note: -j3 option from the end means to enable parallel build. The number should be number of cpu cores + 1(I have dual core cpu).<br />
<br />
The build took about 20 minutes on my PC. After the build completes, you will have the new kernel in ../kernel folder, created above.<br />
<br />
Create the kernel image:<br />
<blockquote class="tr_bq">
<i>cd ../</i><br />
<i>git clone git://github.com/raspberrypi/tools.git</i></blockquote>
Note: You need to have git installed.<br />
<br />
Navigate to tools/mkimage and then run:<br />
<blockquote class="tr_bq">
<i>./imagetool-uncompressed.py ../../kernel/arch/arm/boot/Image </i></blockquote>
This command will generate the kernel image(kernel.img file).<br />
<br />
Build modules:<br />
Go back to the ../kernel/ folder.<br />
<blockquote class="tr_bq">
<i>mkdir ../modules/</i><br />
<i>make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/</i></blockquote>
<br />
Replace the kernel:<br />
Get latest firmware: <br />
<blockquote class="tr_bq">
<i>wget https://github.com/raspberrypi/firmware/archive/next.tar.gz</i><br />
<i>tar -zxvf </i>next.tar.gz </blockquote>
In the small partition(/boot) do:<br />
<ul>
<li>replace /boot/bootcode.bin with firmware-next/boot/bootcode.bin</li>
<li>replace /boot/kernel.img with the previously created kernel image</li>
<li>replace /boot/start.elf with firmware-next/boot/start.elf</li>
</ul>
In the big partition(/root) do:<br />
<ul>
<li>replace /lib/firmware with <modules_builded_above_folder>/lib/firmware</li>
<li>replace /lib/modules with <modules_builded_above_folder>/lib/modules</li>
<li>replace /opt/vc with firmware-next/hardfp/opt/vc/</li>
</ul>
Now your card should contain the new image. Safely eject your SD card and then unplug it from the card reader and then put the card in Raspberry PI and start X(startx). Plug the touch controller in one usb and check if you can move the cursor(or you can start with he touch already plugged in).<br />
<br />
After I have started X, my touch input was working but the axes were switched and also not calibrated.<br />
<br />
<span style="color: #3d85c6;"><b>Calibration for the touchscreen(in Raspberry PI). </b></span><br />
Note: <i>The next steps are performed in the Raspberry PI's Debian Wheezy. This is a method for calibrating the touchscreen which will work just for Xserver and Xserver based applications.</i><br />
<br />
Install xinput_calibrator.<br />
Install some dependencies:<br />
<blockquote class="tr_bq">
<i>sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev</i></blockquote>
Download xinput_calibrator somewhere in the Raspberry PI's folder structure.<br />
<blockquote class="tr_bq">
<i>wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz</i></blockquote>
Unpack it and then navigate to the unpacked folder and then install it using:<br />
<blockquote class="tr_bq">
<i>./configure</i><br />
<i>make</i><br />
<i>sudo make install</i></blockquote>
After this step you should run xinput_calibrator(from Xserver terminal console: first startx then open console and then run it).<br />
<blockquote class="tr_bq">
<i>xinput_calibrator </i></blockquote>
Follow the on screen instructions(touching some points on screen) and after calibration is complete you will receive a message like this:<br />
<blockquote class="tr_bq">
<i>Calibrating EVDEV driver for "eGalax Inc. USB TouchController" id=8</i><br />
<i> current calibration values (from XInput): min_x=1938, max_x=114 and min_y=1745, max_y=341</i><br />
<i><br /></i>
<i>Doing dynamic recalibration:</i><br />
<i> Setting new calibration data: 121, 1917, 317, 1741</i><br />
<i><br /></i>
<i><br /></i>
<i>--> Making the calibration permanent <--</i><br />
<i> copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'</i><br />
<i>Section "InputClass"</i><br />
<i> Identifier "calibration"</i><br />
<i> MatchProduct "eGalax Inc. USB TouchController"</i><br />
<i> Option "Calibration" "121 1917 317 1741"</i><br />
<i> Option "SwapAxes" "1"<code></code></i><br />
<i>EndSection</i></blockquote>
<br />
For Raspbian you have to create a file:<br />
<blockquote class="tr_bq">
sudo nano /usr/share/X11/xorg.conf.d/01-input.conf</blockquote>
Add in this file the content above(starting with <i>Section "InputClass"</i> line) and then save it(ctrl+O).<br />
<br />
<span style="color: yellow;">Note:</span><br />
Please make sure that you don't have sections like<br />
<i>MatchProduct "eGalax Inc. USB TouchController"</i><br />
in other<i> </i>files from /usr/share/X11/xorg.conf.d/ folder(highest number files are processed last, thanks to Jasmin).<br />
<br />
Now touchscreen should be calibrated and after reboot it will keep the settings.<br />
Once, I had to run xinput_calibration again in order to have the pointer to the desired points. You can update the numbers given by the xinput_calibration utility in the<br />
usr/share/X11/xorg.conf.d/01-input.conf file in order to have the best calibration at boot.<br />
<br />
Soon I will add some pictures.<br />
<br />
Andrei
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39602279-1']);
_gaq.push(['_setDomainName', 'engineering-diy.blogspot.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com209Romania44.425934421453128 26.10351562543.700671921453129 24.812622125 45.151196921453128 27.394409125tag:blogger.com,1999:blog-7916030958686584529.post-54914451142389730692012-11-28T20:11:00.000+02:002013-03-26T11:34:48.380+02:00STM32F3-Discovery Usart with printfHi,<br />
<br />
The next step after setting up the Development Environment for STM32F3-Discovery was to communicate with computer via serial port.<br />
I have added usart support to my board using USART2 module, which had TX connected to PA2 pin and RX to PA3 pin(both with alternate function set to 7).<br />
<br />
The next step was to connect the pins to PC serial port. I have used a MAX3232 module(note that you need a chip with 3.3V support).<br />
<br />
After using printf function I have noticed that linker asks for some functions like _write which are used internally. I have added a file newlib_subs.c to implement these function.<br />
<br />
You can download the example project from <a href="http://code.google.com/p/andrei-development/downloads/detail?name=STM32F3-Discovery_USART_printf_sensors.tar.gz&can=2&q=" target="_blank">here</a>.<br />
The settings for usart communication are:<br />
baudrate: 115200<br />
parity: none<br />
data bits: 8<br />
stop bits: 1<br />
flow control: none<br />
<br />
If you want to use interrupts to read from USART you can use the code from <a href="http://code.google.com/p/andrei-development/source/browse/branches/dev/stm32f3-discovery/Navigation/src/usart.c" target="_blank">here</a>.<br />
<br />
You can check<tt> </tt>my project via svn from my repository using:<br />
<tt id="checkoutcmd">svn checkout <b><i>http</i></b>://andrei-development.googlecode.com/svn/branches/dev/</tt><tt id="checkoutcmd"><span class=" selected">stm32f3-discovery</span></tt><br />
<br />
<br />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39602279-1']);
_gaq.push(['_setDomainName', 'engineering-diy.blogspot.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com15tag:blogger.com,1999:blog-7916030958686584529.post-69191735345324362412012-11-21T23:14:00.001+02:002012-12-16T21:45:54.325+02:00Free ARM toolchain with floating point unit supportHi,<br />
<br />
The previous post(<a href="http://www.engineering-diy.blogspot.ro/2012/11/stm32f3-discovery-eclipse-openocd.html">STM32F3 Discovery + Eclipse + OpenOCD</a>) was based on the CodeSourcery Lite toolchain, which doesn't support floating point unit.<br />
I have found an alternative: <a href="https://launchpad.net/gcc-arm-embedded">gcc-arm-embedded</a><br />
<br />
You just have to download the Linux installation tarball and unpack it somewhere. After this, you have to edit the file Makefile from the project from <a href="http://www.engineering-diy.blogspot.ro/2012/11/stm32f3-discovery-eclipse-openocd.html" target="_blank">this</a> or <a href="http://www.engineering-diy.blogspot.ro/2012/11/stm32f3-discovery-usart-with-printf.html" target="_blank">this</a> post and set TC variable to the new toolchain.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA1MxWet_v6SEfRntjaQNI6m6EzM8VdKOsbAQEwZDd4ag0iLP_RILxruQcWgwanFierDsJaIvIpfWu1WoW-LEBlGPcYDaF3bAld-EyzBUt-SmM0ir0tgfbcJ1A0SN8W7PY-CrN3GIg1uMz/s1600/Makefile.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA1MxWet_v6SEfRntjaQNI6m6EzM8VdKOsbAQEwZDd4ag0iLP_RILxruQcWgwanFierDsJaIvIpfWu1WoW-LEBlGPcYDaF3bAld-EyzBUt-SmM0ir0tgfbcJ1A0SN8W7PY-CrN3GIg1uMz/s1600/Makefile.png" height="170" width="320" /></a></div>
You have to set it like this:<br />
<blockquote class="tr_bq">
TC = /path_to_toolchain/gcc-arm-none-eabi-x_x-xxxxqx/bin/arm-none-eabi</blockquote>
There is another way, like I did. Enter in Terminal:<br />
<blockquote class="tr_bq">
gedit ~/.bashrc</blockquote>
add the line at the end of the file:<br />
<blockquote class="tr_bq">
PATH=$PATH:/path_to_toolchain/gcc-arm-none-eabi-x_x-xxxxqx/bin/</blockquote>
then save and close the file and then enter in Terminal:<br />
<blockquote class="tr_bq">
source ~/.bashrc</blockquote>
Now you can run arm-none-eabi-gcc in every folder you like. For this case, you should set the TC just like in the picture above. <br />
<br />
Then, you have to scroll down and find FPU variable<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrpWM1DvC_qAAu11tEUy-MVKd34MH-Ye-u5WtjPvCYsI3A8vZ0BR3gwnTnzbwYPIxTBotwjngab0BA6xo7OCephxFNb5C0DQXx4aFunsysOtFAMyka33tZqPawVtnjvgJYCxOdTP4QgR8Z/s1600/FPU+setup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrpWM1DvC_qAAu11tEUy-MVKd34MH-Ye-u5WtjPvCYsI3A8vZ0BR3gwnTnzbwYPIxTBotwjngab0BA6xo7OCephxFNb5C0DQXx4aFunsysOtFAMyka33tZqPawVtnjvgJYCxOdTP4QgR8Z/s1600/FPU+setup.png" height="57" width="320" /></a></div>
and set it like this:<br />
FPU<span class="Apple-tab-span" style="white-space: pre;"> </span>= -mfpu=fpv4-sp-d16 -mfloat-abi=hard<br />
<br />
Now you are ready to develop great things.<br />
<br />
Happy coding!Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com9tag:blogger.com,1999:blog-7916030958686584529.post-4664610015116709122012-11-17T12:47:00.002+02:002015-05-08T16:48:26.949+03:00STM32F3 Discovery + Eclipse + OpenOCD<div style="text-align: justify;">
Hi,</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
ST launched in September a very interesting development board(<a href="http://www.st.com/internet/evalboard/product/254044.jsp" target="_blank">STM32F3-Discovery</a>). It is a very cheap one(I have got myself one for ~10$). It has a debugger integrated(STLINK) and also some great sensors:</div>
<div style="text-align: justify;">
- ST MEMS LSM303DLHC, which contains 3 axis accelerometer(to measure acceleration intensity on each axis) and 3 axis magnetometer(to measure angles to a fixed point - the Earth's magnetic North)</div>
<div style="text-align: justify;">
- ST MEMS L3GD20, which has 3 axis gyrometer(to measure rotation speed)</div>
<div style="text-align: justify;">
This board is very good for automated pilot controller projects.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
After unpacking the board I have found that it was supported just by commercial software and tools. As I am an opensource kind of guy I have struggled myself some time to get this working with Eclipse, OpenOCD and a free toolchain, on Linux.</div>
<div style="text-align: justify;">
I have used Ubuntu, but I think the process is the same on every distribution. Also, with little adjustments it can work on Windows.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Here are some steps, that you have to follow to get the led blinking example to work:</div>
<div style="text-align: justify;">
<b>1. Install <span style="color: #76a5af;">Java Runtime Environment</span></b>. Here are some steps for Ubuntu:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
sudo add-apt-repository ppa:webupd8team/java<br />
sudo apt-get update<br />
sudo apt-get install oracle-java8-installer </blockquote>
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>2. Install <span style="color: #76a5af;">Eclipse</span></b>. Get Eclipse IDE from <a href="http://www.eclipse.org/downloads/" target="_blank">here</a> (grab the Eclipse IDE for C/C++ Developers) and unpack it somewhere</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>3. Install <span style="color: #76a5af;">GDB Hardware Debugging</span></b>. Open Eclipse go to Help->Install New Software and then search for GDB Hardware Debugging and install it.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZtpVfLmz5nIuMWIYXS5B-tajLeNHnlIA1A57rJ4lC8mgzqIPc41VV9aIdYG-uP9Z2OTbBxwvB4cGDYmEajhUTkPrnYmnq3MBDkQO063pDnOXvPN80nKNETwLNwXMft9YOiQfQ70XVyMMO/s1600/GDB+HW+debugging.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZtpVfLmz5nIuMWIYXS5B-tajLeNHnlIA1A57rJ4lC8mgzqIPc41VV9aIdYG-uP9Z2OTbBxwvB4cGDYmEajhUTkPrnYmnq3MBDkQO063pDnOXvPN80nKNETwLNwXMft9YOiQfQ70XVyMMO/s1600/GDB+HW+debugging.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<b> Install <span style="color: #76a5af;">GNU ARM Eclipse plugin</span></b>. Get it from <a href="http://sourceforge.net/projects/gnuarmeclipse/">here</a> and install it from Help->Install New Software->Add->Archive and select the downloaded .zip file.</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<b>4. Install some dependencies</b>. Paste following text in Terminal:</div>
<blockquote class="tr_bq">
<i>sudo apt-get install git zlib1g-dev libtool flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential libftdi-dev libusb-1.0.0-dev</i></blockquote>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>5. Install <span style="color: #76a5af;">OpenOCD</span></b>(version>0.6.1). Get it from <a href="http://openocd.sourceforge.net/" target="_blank">here</a> and unpack it. Then, navigate to the extracted folder and type in Terminal:<i><br /></i></div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>./configure --enable-maintainer-mode --enable-stlink</i> </blockquote>
<blockquote class="tr_bq">
<i>make</i> </blockquote>
<blockquote class="tr_bq">
<i>sudo make install</i></blockquote>
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>6. Add rule for Stlink to be accessed without sudo</b>. Type in Terminal:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>sudo gedit /etc/udev/rules.d/99-stlink.rules</i></blockquote>
</div>
<div style="text-align: justify;">
Paste the following text:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="0666"</i></blockquote>
</div>
<div style="text-align: justify;">
Type in Terminal:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
sudo udevadm control --reload-rules</blockquote>
</div>
<div style="text-align: justify;">
Now, with the board connected to PC you can enter in Terminal:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>openocd -f /usr/local/share/openocd/scripts/board/stm32f3discovery.cfg</i></blockquote>
</div>
<div style="text-align: justify;">
The following text should appear:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
Open On-Chip Debugger 0.6.1 (2012-10-29-22:02)<br />
Licensed under GNU GPL v2<br />
For bug reports, read<br />
http://openocd.sourceforge.net/doc/doxygen/bugs.html<br />
adapter speed: 1000 kHz<br />
srst_only separate srst_nogate srst_open_drain<br />
Info : clock speed 1000 kHz<br />
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints</blockquote>
</div>
<div style="text-align: justify;">
You can close the Terminal now. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>7. Install toolchain. </b>You can use <span style="color: #76a5af;"><b>Codesourcery</b></span> toolchain, like described in this step, or you can use <b><span style="color: #76a5af;">GCC Arm Embedded</span> </b>toolchain(from<b> </b><a href="http://www.engineering-diy.blogspot.ro/2012/11/free-arm-toolchain-with-floating-point.html" target="_blank">here</a>) which has support for hardware floating point unit and which is free and it is easier to install.<br />
For Codesourcery follow the next steps:<br />
Go to <a href="https://sourcery.mentor.com/GNUToolchain/release2322" target="_blank">Codesourcery</a> and download IA32 GNU/Linux Installer. To install it open the Terminal and navigate to the folder where it is downloaded. Type:</div>
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>chmod a+x arm-2012.03-56-arm-none-eabi.bin</i> </blockquote>
<blockquote class="tr_bq">
<i>./arm-2012.03-56-arm-none-eabi.bin</i></blockquote>
</div>
<div style="text-align: justify;">
Then select next at every step. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>8. Download sample project </b><a href="https://drive.google.com/drive/u/0/folders/0B__Rs5JF53-kfjVPd2l2U0ZVaUtEZG1GcW1NZ0VZRWcyMUl1WXV2ZFFzQkF3aWw0NG9IVDQ">stm32f3.tar.gz</a> file and unpack it.</div>
<div style="text-align: justify;">
<span id="goog_646405636"></span><span id="goog_646405637"></span> </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>9. Open the project in Eclipse.</b> Open Eclipse and go to Workbench. Click File->Import and then select General->Existing Projects into Workspace. Select the downloaded project and click finish.</div>
<div style="text-align: justify;">
This is a makefile project, so you have to edit makefile if you want to change some project settings. The frst thing you should do is open the Makefile file and check at the very beginning if the toolchain path is correct. This should be like:</div>
<div style="text-align: justify;">
TC = <path_to_toolchain>/arm-none-eabi</div>
<div style="text-align: justify;">
Now you can build. right click on project name and select build. The correct output is in the Console tab from Eclipse(ignore the warnings and errors from Problems tab).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>10. Debugging.</b> After the project was builded correctly select Run->External Tools->External Tools Configuration. Select <b><span style="color: #76a5af;">OpenOCD(restart)</span></b> in the left tab and click run.</div>
<div style="text-align: justify;">
Now, right click project and select Debug as->Debug Configuration and then </div>
<div style="text-align: justify;">
select in the left <span style="color: #76a5af;"><b>stm32f3-debug</b></span> and then click Debug.</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: justify;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE76RZMcaiUUa1DgFLwXraXps8kI6G-jSqCM8dsA2P8Zj5pJJ8B8yhdJiil6yrV-6mHngYnf_XVdJHGGwg6YM6SgiOkhllA0B1O3DLywa88aVfrw-tPLLvuBNBXEJphuccg3NmpBWybkkD/s1600/debug.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE76RZMcaiUUa1DgFLwXraXps8kI6G-jSqCM8dsA2P8Zj5pJJ8B8yhdJiil6yrV-6mHngYnf_XVdJHGGwg6YM6SgiOkhllA0B1O3DLywa88aVfrw-tPLLvuBNBXEJphuccg3NmpBWybkkD/s1600/debug.png" width="320" /></a></div>
<div style="text-align: justify;">
<b>Note: </b>If you want to add more source files you can add them in the src folder. New headers should be added into hdr folder. If you want to add another folder you have to specify it like the LIB_SRCS in the Makefile and also create LIB_OBJS like variable in the Makefile.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Happy free coding and debugging! :-)<span style="background-color: #bf9000;"><span style="background-color: white;"></span></span></div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39602279-1']);
_gaq.push(['_setDomainName', 'engineering-diy.blogspot.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>Andreihttp://www.blogger.com/profile/14524528139355253286noreply@blogger.com88