hadrware

MacBook External Display resolution problem

MacBook 3 monitors

Today I wasted 2 hours trying to adjust resolution on external monitor connected to my MacBook.

I work with two external Monitors (Sun 24″). One through miniDP/VGA, second: through USB/DVI.

Yesterday, I connected MacBook to 42″ TV, with miniDP/VGA port. Today I connected it with Sun Monitor as usual and…I got black screen. I tried to change resolution, but…1920×1200, which I am usually working with, was not available. Even more: when I set ‘Best for display’ I got 800×640! Maximum available was 1600×1200, but it was wrong ratio! The Sun 24″ monitor has 16:10 ratio, not 4:3!

I tried deleting preferences, reseting PRAM etc. It didn’t help. Finally I tried to use miniDP/DVI (instead of miniDP/VGA) and I got 1920×1200. Then, when I connected miniDP/VGA again, I got 1920×1200 as well.

What I did wrong? I connected it when MacBook was in sleep mode. That is most likely cause of the issue. Probably MacBook thought it is still connected to 42″ TV. Thus, changing port helped. Probably, if I connect it to another device, it would help as well.

In the past I already had issues when I was disconnecting monitors in sleep mode. Since that time, I was always connecting/disconnecting displays when MacBook was on. Except today 🙂


Replacement for Logitech UltraX: Logitech Wireless Solar Keyboard K750

Logitech UltraX Media Keyboard

Six years ago I purchased Logitech UltraX, which is still the best keyboard I have ever had. Unfortunately, as you know, keyboard cannot live for ever. Two years ago I wanted to buy the same model again, but…UltraX is no longer made. I was looking for some on amazon and ebay, and I found only Logitech Ultra X with PS/2. I bought it and it was fine, but I needed also PS/2->USB converter (my laptop doesn’t have PS/2 like most of laptops today). It works fine, but sometimes it loses connection. Only solution I found is to disconnect and insert it again into the USB port.

Logitech UltraX Premium

Recently I split a tea on the keyboard and keys are not working very well anymore. Thus I needed a new one. I wanted to buy the same model. It was still available on eBay, but I found this discussion, where one guy recommended Logitech K750. Its price is around $60 (too much), but I found refurbished for $30 (acceptable) and I bought it.

Logitech wireless solar keyboard k750

After a month, I can say that I am satisfied. It is wireless, but works smoothly (almost like wired). I didn’t have any communication issues so far. The cool thing is the fact that it doesn’t have replaceable batteries. It charges itself through solar panels. Additionally Logitech provides Solar App, which shows the battery condition and how much ‘light power’ is it getting from the light/sun. The two screenshots below shows Solar App when light is turned on (left) and turned off (right).

Logitech Solar AppLogitech Solar App - Light Off

The most important capability: keys. They are nice, low profiled, but a bit loose and loud. It doesn’t bother me though. I can say that K750 is a one class lower than Apple Keyboard, which I was using for 2 months in last summer (working on Mac). I would purchase Apple keyboard (better keys), if it would have ‘Windows’ version. For now, I am satisfied with K750.

If you are looking for UltraX-like keyboard, then K750 is definitely worth to consider!


FreeRTOS Jump Start

In this semester I am taking Real-Time Systems course. In one of the programming assignments, we had to develop program for embedded device Tiva C Series LaunchPad TM4C123G. It is a low-cost evaluation platform for ARM Cortex-based microcontrollers from Texas Instruments. It is very nice board if you want to start with embedded devices. It cost only $25 on eBay. You can connect it to your computer using USB. Finally, the board has key feature of embedded device for beginners: the LED.

Tiva LaunchPad

A typical process-control system can be divided into four types of components: the process, sensors, actuators, and controller (see Figure below). LED allows you to mock your target actuator. Majority of operations performed by embedded devices is control of the actuators. What is nice about LED: it is cheap and easy to control whether and how it is working.

safety critical loop

Code Composer Studio

As a development environment for Tiva C Series I recommend you Code Composer Studio. It is Eclipse based IDE, which makes development easy. Especially for beginners. Tutorial for installation and running first program on Tiva TM4C123G board using Code Composer Studio can be found here. I recommend to follow the “Single Download” option (download 1GB+ file). More precisely, download and install: “EK-TM4C123GXL-CCS: TivaWare for C Series and Code Composer Studio for the Tiva C Series TM4C123G LaunchPad” available on this website. I wasted a lot of time trying to install it following “Individual Downloads” instructions (download <1MB file). Installer was hanging, when it was downloading files form the Internet and never recovers. In "Single Download" most of files are already downloaded along with the installer.

FreeRTOS

FreeRTOS is one of the most popular Real Time Operating Systems (RTOS). Additionally, it is free. This is where its name comes from (free + Real Time Operating System = FreeRTOS). The System is written in C language. Thus, we write programs for it in C as well. More details can be found on freertos.org and wikipedia.

The cool thing about FreeRTOS is that it enables easy modifications of Operating System. You can modify e.g. scheduler.

Once you have Code Composer installed. You need to install TivaWare software (which includes FreeRTOS). It can be found in previously downloaded package (if you were following “Single download” option) in TivaWare/SW-EK-TM4C123GXL-1.1.exe.

Running example programs

The TivaWare software contains examples, which are ready to run. You can find them in the directory, where you installed TivaWare C Series software. In my case (default path) it is: C:\ti\TivaWare_C_Series-1.1\examples.

There is an example project freertos_demo. It makes the LED blinking and allows you to manipulate the colors using buttons (located at the bottom of the board). The project can be found in examples\boards\ek-tm4c123gxl\freertos_demo. It is ready to run. You just need to connect the board to the PC, open the project (import it) in Code Composer Studio and run it in debug mode. Code Composer Studio will automatically port the program into the board.

You can modify the code, and make the LED blinking faster or slower. Colors manipulation is also easy.

Queues and semaphores

FreeRTOS supports multitasking. In the Real-Time systems, communication between different tasks are usually implemented using queues and semaphores. It is also the case in freertos_demo program. Buttons send messages to the LED using queues. Semaphores are use to guard concurrent access to UART.

This tutorial is very good point to start with FreeRTOS. It describes basics, queues, semaphores and more.

Summary

Developing code for embedded devices is usually, more complex than for Web or Desktop. Running, even very simple application is more complex, because it requires more steps. You need to configure connection between your computer/OS and specific device. Then you need to setup many settings, which varies almost among every device. The communication with ports is also different and every device has different set of them.

There are no universal installers etc. Every single device require slightly different setup. Sometimes, you need to spend hours to run simple “Hello, World!” application. On the other hand, it is fun to create some system, which do stuff outside of your PC.

If you are interested in embedded devices, check out my other post: BeagleBoard – your personal computer smaller than your wallet.

To get started with FreeRTOS and Tiva C Series: check this tutorial to run first program and FreeRTOS Tutorial to get more details. You can buy Tiva C Series LaunchPad on eBay.


BeagleBoard – your personal computer smaller than your wallet

BeagleBoard XM

It is amazing how big progress was made in embedded systems recently. I remember when I had microcontrollers class at Wroclaw University of Technology (about 3 years ago) and we were programming in Assembly. When I heard (3 years ago) that the main language for programming microcontrollers is C++ I was so excited. It would be so much easier than in Assembly. Now (3 years later), I started working on my Master Thesis at Kansas State University. The ultimate goal is to create prototype of medical device using embedded computer BeagleBoard XM.

This board has 1GHz ARM processor (Cortex-A8), 512MB RAM, 4 USB ports and even HDMI output. Moreover, it has MicroSD slot which allows you to run Linux or Android Operating system!

shocked

There is also Ethernet port, which allows to update the Operating System without any external PC. The key part of the device is set of PWM pins, which will allow me to control the medical device engine.

I will use Ada programming language with cross-compiler from AdaCore. However you can install Java VM and run Java programs if you want! It blows my mind! Programming microcontrollers in Java (the very high-level programming language) instead of doing it in Assembly.

The cost of this Board is $149, which is another advantage of this device.

More info about the board can be found here.
It usually comes along with MicroSD card and Angstrom Linux on it. Additionally, you can find Angstrom images here. To update existing installation (of Angstrom) just do

opkg update
opkg upgrade

More info about OPKG Package Manager (Angstrom’s Package Manager) can be found here.


.NET Developer on Mac

I am PC person. I have never used Mac until I start my work as Research Assistant in SAnToS lab (Kansas State University). Now I am using it almost half year and I would like to summarize my experience.

I am using MacBook Pro (i5 2.4GHz, 8GB RAM and 128GB SSD) with Mac OS X 10.8 Mountain Lion.

MacBook Pro

First of all, I noticed missing features (which are available on PC/Windows):

  • Click on app icon in dock (dock is equivalent to taskbar in Windows) does not hide application. It can only move the app to the top. The only way to hide the app is to click minimize button.
  • Lack of good alternative for Total Commander, which is not available on Mac. There is muCommander (no tabs) and double commander (less functional), but both are way behind TC.
  • No Shift-Delete to permanently remove files. You need to move them to trash first, and then empty the trash.
  • No ‘cut’ in context menu (after right click). To have this luxury you need to install e.g. Total Finder (beyond the ‘cut’ option it also provides the possibility to have tabs and some other useful features).

Now, a few differences between Mac OS and Windows:

  • The default file manager is called Finder instead of Explorer.
  • In general, when you would use CTRL+KEY in Windows, then in MacOS you need to use CMD+KEY.
  • To change file name you need to click RETURN(ENTER) instead of F2(in Windows).
  • To open the file you need to click CMD+O, instead of ENTER (in Windows).
  • DELETE key is working like PC’s RETURN (delete character on the left side of the cursor).
  • Instead of HOME key you have CMD+LEFT_ARROW, and instead of END key – CMD+RIGHT_ARROW.

I use OneNote a lot. One of my favorite features is WIN+S, which allows me to make a screenshot of selected area in desktop. On Mac OS this feature is provided along with the operating system. CMD+SHIFT+4 saves the photo into Desktop, and CMD+OPTION+SHIFT+4 saves it into clipboard. Very useful feature. However I think Apple should consider to create some two-key shortcut like CMD+4 or CMD+F4, because clicking 4 keys in the same time is quite a challenging.

Another nice feature is possibility to use country specific letters like ę, ń, ś, ć, ä, ö even when you have english version of the system. You just need to hold the key and then there is small tooltip showing possible special letters. You can choose the letter with mouse or using keyboard (by picking the number).

MacBook special letters

The last thing I would like to mention is my favorite: the trackpad (touchpad). It is just awesome! Maybe it is not strict part of operating system, but the gestures are implemented in it. You can see the demo of the gestures here. The MacBook Pro trackpad is also well made. Much better than touchpad in all notebooks I have used before.

When you are working on Mac, you use Terminal a lot (when you are developer). In that case it will be nice to have ‘Open Terminal here’ option in finder, which open the Terminal in directory you have clicked on. That is just my wish to Apple 🙂

I think it took me about a month to become comfortable with using Mac.

EDIT: There is one more nice feature I just find out: you can past text without formatting by clicking CMD+ALT+SHIFT+V. And again…4 keys in the same time. But in this case I can’t push them all with one hand 🙂 Maybe CMD+SHIFT+V would be more user friendly?