niedziela, 10 lipca 2016

The environment to program AVR microcontrollers on Windows

I've tested a lot of tools which can be used to develop systems based on AVRs and finally found something ideal for me. My setup:

WinAVR is a pack of needed apps: compiler (avr-gcc) and programming tool (avrdude). We should install it first. As an IDE I use Eclipse. The advantage of Eclipse is that I can share the same project on Windows and Linux. It supports my low-cost programmer - USBasp and I can easily change fuse bits clicking in the GUI:



To intall AVR plugin follow this tutorial.
On newer versions of Windows you can met problem with avr-gcc (error 0xc0000142):



To fix this issue you have to download fixed dll and copy to (WinAVR PATH)\utils\bin.

The last step is to add programmer in Eclipse to the AVR properties. To create new AVR project click New Project > C Project > AVR Cross Target Application > Empty Project and then set your MCU type, frequency etc.

To install USBasp in Windows the driver is needed: http://zadig.akeo.ie/. You have to choose "libusb-win32" in the driver field.

niedziela, 3 lipca 2016

Android - how to communicate with PC using serial port over bluetooth

One time I needed to simulate a device which communicates with PC over bluetooth. I thought that I can use my smartphone with Android because this is faster way than creating new device using microcontroler and bluetooth module. I needed only my phone, Android Studio and a USB cable. I used code from Bluetooth Android Guide.
The most important line is:
 tmp = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME, MY_UUID);

Name parameter can be any value, but in the UUID you should pass correct value if you want to use serial port. This value is:
UUID.fromString(00001101-0000-1000-8000-00805F9B34FB)

Where base UUID is "00000000-0000-1000-8000-00805F9B34FB" and 0x1101 is the UUID of "SerialPort" service class. You can check service classes here.

After uploading application to the device and running application, you have to pair your phone with a PC. Sometimes COM port (on Windows) is binded just after pairing, but often you must do it manually. To do this you have to open bluetooth settings.



Then go to the "COM Ports" tab and click "Add". Select outgoing type and also your device from listbox. You should also see your application name below.



Click OK and you should get your COM port number.

sobota, 2 lipca 2016

Windows 10

For many years my main operating system is Linux (currently openSUSE) but I also have installed Windows because sometimes I have to run or develop some native Windows apps. Some time ago I updated my Windows 8 to newer version - Windows 10.

Update was finished without any problems and after 3-4 hours I saw my new desktop. I'm rather a user who keeps opened a lot of windows simultanusely and for me the most important new feature is the support of multiple desktops:


I was using this in my Gnome desktop for a long time and one thing what is missing for me in the Windows implementation is a possibility to move window between desktops using a shortcut (or I missed this in the shortcut list). Nevertheless, the work on Windows isn't as much painful for me finally.

I also noticed one regression in sense of usability. Developers changed power management popup (shown after click on the battery tray icon) and now it is less functional:



I often switch between balanced and high performance modes, but now I can turn on/off only power-saving mode. To run high performance mode I have to click few times more (open power settings). This is the reason why I created shortcut on my desktop switching to the high performance mode:

powercfg.exe /setactive GUID

Where GUID is one from the list:

powercfg -LIST