I am working in a book with a crazy schedule. It means this blog will receive a very minor update.. at least will be a great book
This is a short and very simple post but I decided to write it because I am pretty sure will be useful for some developers
Intel Galileo board has a GPIO explander called CY8C9540A that operates in 5V and is responsible for the PWM.
If you see the Servo library API, the methods implemented are the same methods implemented for Atmel micro-controllers except the fact we have two methods added that allow us to decide if the Servo trains will be 48Hz or 188Hz.
How the Servo library does that ? The Servo communicated with the CY8C9540A using I2C. The I2C communication can be done using the Wire API. Continue reading
Believe or not, I worked in a project with hardware and software created in 8 weeks only. I am talking about Intel Galileo ! The first intel board compatible with Arduino API plus some new and cool features.
Before to talk about how to create a very affordable moisture sensor system, let me explain what is Intel Galileo.
If you have a simple project and you need to develop a prototype quickly, I really like the OPEN solution offered by Arduino. It is open source, open hardware, free compiler, the language is close to C (easy.. easy…), it is very affordable and we can count to thousands of different examples how to use arduino to communicate with sensors, control IO’s, displays, gsm modules, etc.
OK.. let’s talk about my problem…
Why 5 Hz ? Imagine you need to send an ASCII sequence of bit using a GPIO and the purpose of this sequence is to simulate a serial keyboard with debounce of 200ms. Inverting this debounce we have 5 Hz and arduino Uno operating on 16Mhz you will conclude the analogWrite() is not able to provide this frequency.
Then you make some research and you discover it is possible to change the timers registers(TCCRnA and TCCRnB) on atmega but the best case you can reach is close to 31 khz (timer2) and to make your life a little worst, you realize also changes these registers the delay() function is impacted and some correction factor must be considered. This link has a nice reference that explain this.
If you are a developer you need a good source code navigator. I have used cscope to navigate and edit code directly from my terminal dismissing any graphical user interface but some people like to use the sourcenav or net beans ecosystem. However both are graphically nice but are “heavy” apps and also, if you want to share a way with your co-workers how to browser your code you will need to install the apps in different desktops.
But what about to have a fast way to navigate in your code, have fast crossed references and share your source code with your co-workers dismissing the installation of source navigators on different desktops using your web browser ?
If you need something like this or if you wants a fast and easy installation of a good source navigation, I recommend OpenGrok. To be honest, even if I do not need to share my code with anyone, I use in my machine only for my personal code browsing.
OpenGrok runs as a webapp that means you and your co-workers can use your favorite browser navigator. Chrome, Firefox, Internet Explorer, whatever! you only need your preferable one to enjoy the code.
I am personally using tomcat 7 in my ubuntu 13.04. Let’s see the 3 basic steps:
I am really sorry if this post is so shot and newbie but I will use these instructions on my next posts.
#> sudo -i
#> cd /usr/src
#> apt-get source linux-image-$(uname -r)
If fails complaining about dpkg-source, you need the debian package development tools.
Install it doing:
#> apt-get install dpkg-dev
and try to download the source again.
You can get using git. If you prefer this method check this page.
I am using root (sudo -i) on this example because next post I will compile some code that requires the right permission to run the example codes.
I really like to work with several components in a system including linux kernel or keep my emotions on userspace.
If you work with android and your are a real engineer, it is very difficult to resist the native support using Android NDK. If your software requires performance using graphic API like in OpenGL or if you need to access some specific information provided by some native library, the NDK fits for you.
However, bugs in native side sometimes takes time and usually it is not an easy and fast task. If you have the device and an easy way to reproduce the issue, it is ok but suppose you need to collect logs from remote users and the scenario is very difficult to reproduce. Some cases the users even see the crash visually but the system contains the logs blocking the approval of your software that must be completed to some costumer.. at this point the program/project managers team are “talking” in your ears… “fix it!”.
Working with Android, every time a process that runs on native side crashes, we have some small pieces of your stack in files called tombstones.
The tombstones are located at /data/tombstones as isolated files (one files represents one crash) or you can see them in your logcat Take a look in the adb shell:
root@android:/ # find . |grep tombs ./data/tombstones ./data/tombstones/tombstone_00 ./data/tombstones/tombstone_01 root@android:/ #
The tombstone inform you about:
- Build fingerprint
- Crashed process and PIDs
- Terminated signal and fault address
- CPU registers
- Call stack
- Stack content of each call
I will not post a full tombstone here. Check the /data on your device and you will observe the 7 sessions mentioned above . Let’s go straight to the point.. how to debug the stack in tombstones files!
Last month a lot things happened.. I lost my dad, moved to another location .. thus, this blog was not the priority but was not forgotten.
This post is related to some issues I have observed in some Dalvik implementation and some recommendations is you want to create a service that must remains running all the time even after a device power on/off or reset.
Suppose you need to create a “light” service that must be:
1) starts when every time your devices boots.
2) contains very nice parcelable objects using aidl syntax sharing them thru IPC
3) is used to monitor something every X minutes but cannot impact the current drain.
4) the service must use the “uptime”, I mean, must reports “how long” is running
5) must be able to receive interruptions and reports them
A good application of this service could be an alarm central unit for your car. You could create this project using your old Android phone and transforming your old phone and hidden it in your car. You can also connect this old phone disassembling a 12V charging and connecting in some spot using the terminals of your battery.
So, let’s go to some mistakes.. see the list below:
During a long time we were “blessed” with computers that had only single CPU. The single CPU usually had a mediocre single core and thread. All software developed on that time executed sequential processing.
However, multi-cores and multi-threads processors were introduced in the market but if you do not develop your software trying to explore the hardware advantages your software might have the same performance if running in a single cpu machine.
You need to think also if you software will run in a computer isolated or if your software will be able to run in multiple computers sharing a common network and organize different tasks to resolve a common problem.
Today, I will write this post for my own reference using the POSIX threads and how to have the best usage of joins and mutex implementation. I am running in a ubuntu 10.04 but if you are running Windows you can use these examples installing the POSIX win32 compatibility module or installing Cygwin to simulate a linux shell.
All codes on this post were compiled using gcc and invoking the POSIX libraries thru command like under ubuntu 10.04. For example you can use:
gcc -pthread <my source code.c>
The first code is related to a model where we do not share the same memory space and there is no policy regarding the thread priorities or resources access management (although the threads runs in the same process sharing the same memory space this first example to resource are conflicted).
It is a simple code that creates 3 threads, passes arguments to them using strings and integers and then they are terminated.
Take a look in the code below:
I am kind of person – or alien as they call me in USA even being from Brazil not Mars , that usually try different ways to improve how I study or work. I am using a new search engine and I am really loving it! Click in DuckDuckGo.com and try yourself.
Why DuckDuckGo ?
The quality of results and how you can filter are much more better than google search engine. Google already recognized them as a real competitor and looks like Mr Larry Page not dared to say “really bad job” as he did with new facebook graphic search.
Done based in github, perl5 and other open softwares, I will tell you why this search really rocks!
What they do ?
- do not track you !! it means privacy! Your personal information is safe!
- do not use bubble-filter !! Oh yeah this really makes different because I can have different type of results not based what the system “think” compatible with my profile
- They have a feature called !bang. Bangs are very cool.. if you wanna have all searches in a specific site you only add “!” following the site.. for example if you type in the search box “stamps!ebay” the search goes directly to ebay showing the search you did!!! The same can be done with facebook, amazon, and multiples sites.. some sites you have option to use bang with few words, for example, you can use “asus!a” to search in amazon.
- When you make a search if have a list with results and in front of each link there is a icon related to the site you searched. If you click in the icon instead the link, the engine re-searches and give you more results related to that site!
- There is not “NEXT PAGE”.. Only scroll and the new searches will be automatically loaded