Setting up Tytera TYT-MD380 or MD390 GPS on Mac OS

In this article I share how you can upgrade the firmware and also upload a codeplug to the Tytera MD380/MD390 on Mac OS (or Linux) with VirtualBox.

This guide should work with the following radios with or without GPS:

  • Tytera/TYT MD380
  • Tytera/TYT MD390
  • Retevis RT3
  • Retevis RT8

Although the focus is on Mac OS, thanks to VirtualBox it should also work on Linux. Please note that this guide is based on my personal tests with the TYT MD390 GPS and comes with absolutely no warranty.

The challenge: Tytera data cable and USB driver problems

I recently received my Tytera MD390 in the mail straight from Shenzhen, China. I am using a Macbook with Mac OS and that makes it challenging to get Tyteras programming software CPS to run, which is a Windows application.

At first I thought I could simply install Windows 10 on a virtual machine on my Macbook and just upgrade the firmware and upload the codeplug from there. However, I never got it to work.

Therefore had to find a workaround solution:

  1. We will be using Tytera’s original CPS software to program the codeplug and setup the channels, contacts and all settings for the radio.
  2. Then we will upload this codeplug via a Linux virtual machine.
  3. In addition, we will upgrade the firmware of the MD380 or MD390 GPS.

Do you have the right USB cable?

When I first wrote in several web forums telling about my problems with the data cable and USB drivers, I got a reply that my Tytera MD 390 probably came with the wrong cable. Reportedly, a batch of the radios had been shipped with the wrong cable a month earlier.

To find out whether you got the right cable do the following:

  1. Unplug the cable from the radio (i.e. the radio is NOT connected to the cable) and plug the USB cable into your Macbook.
  2. Go to Applications -> Utilities -> System Information. Under “Hardware” find the “USB” menu. If you now see any USB device related to your radio, you have the wrong cable.

Why is that so? The right cable is a purely passive cable, the logic is in the radio. That means when the radio is not connected, it should not show up in the hardware list (or device manager on Windows). You have the right cable when a USB device shows up and the radio is switched on.

In my case, I had the right cable. When I turned the radio on, it showed up as “AnyRoad Technology Digital Radio in USB mode” in the hardware list.

I installed Windows 10 on a virtual machine, installed the driver from Tytera and the device showed up as “STM device in DFU mode” in the Windows device manager. I also installed Tyteras CPS application.

Still, I could not get it to work. The Tytera CPS application would not “read” or “write” from the radio. I tried many different things, uninstalled and reinstalled the driver, but could not get it to work. If you have any idea, please comment on this post.

Therefore I needed to find a workaround: I created my codeplug on the Windows virtual machine with the original Tytera software. Then I would upload the codeplug via Linux (also on a virtual machine) to my Tytera MD390 GPS.

Here’s the step-by-step guide:

Part 1: Upgrading the TYT MD380 / MD390 firmware

In this part, we will upgrade the firmware with a customized version specially made for amateur radio use. This firmware is called md380tools and has, compared to the original TYT firmware, some additional features that are handy for ham radio use.

The md380 tools run natively on Linux, which can be a bit tricky and time consuming to set up. That’s why Warren Merkel, KD4Z, created a ready-made VirtualBox image called md380tools-vm.

To upgrade the firmware, follow these steps:

  1. Follow the instructions for md380tools-vm that is given in the PDF up to and including “Step 5: Import the virtual appliance image file“. Do not start with step 6 just yet.
    The PDF with installation instructions can be found on the projects website. Scroll down to after the file list, the PDF is the second link: https://github.com/KD4Z/md380tools-vm 
  2. Connect your radio to the Macbook and switch it on.
  3. After you installed Oracle VirtualBox and imported the appliance with the md380tools-vm, right click on the “tyt” image and select “Settings”. In the settings dialogue, go to “Ports” and the “USB”. In the lower part, click on the USB stick icon with the “+”-sign. Your radio should now show up as “Digital Radio in USB mode” (after you upgraded the firmware it will show up as “Patched MD380” like on the screenshot below).Select it, it will be added to the USB filter list. This filter list makes sure your USB device gets passed on to the virtual machine. Click “ok” to exit the dialogue.
  4. Now you have to put your radio into a special mode so that the firmware upgrade can be written. To do this, switch it off first. Wait 5 seconds. When you switch it on, hold the PTT-button and the upper button pressed. The radio will boot up, but you will only see the LED light flashing red and green. Your radio is now ready to get the new firmware.
  5. Start the “tyt” virtual machine.
  6. Follow now the instructions from “Step 6 – Start the VM” and “Step 7: Verify networking is working” from the PDF.
  7. Once all looks good, we can start the flashing of the firmware. Depending on your type of radio (it comes either with or without GPS) you have to use different commands.
    For the TYT MD390 GPS (with GPS) do the following (for other models see the PDF):
  8. Enter “glv” and press enter. That will download and compile the latest version of the firmware. Check whether everything runs smoothly.
  9. Once it is finished, run “flashgps“. This command will actually write the firmware onto your radio. Ensure that you don’t touch you radio during this process. After about a minute or two, it should be finished. Wait until it is completed, and the turn your radio off.
  10. Wait 5 seconds. Turn your radio on again. This time, it should boot with the new firmware and should start into normal mode. Now run “flashdb” which will write an updated user database onto your radio. This process takes about 3 minutes. After it is completed, switch off your radio and you can follow the instructions under “Fun Times” in the PDF if you like (not necessary though).

Now part 1 is finished, your data cable is working and you have upgraded the firmware on your Tytera radio! The tool should also be able to write the original firmware back if needed, however this I haven’t tried yet)

Part 2: Setting up a Windows image on VirtualBox

In the second part, we will set up a Windows installation in VirtualBox and install Tytera’s CPS software. With this software, we will be able configure the MD380 / MD390 and set up channels and contacts.

Prerequisite: You need a Windows installation image in ISO format that you can get from Microsoft and a valid product key.

I will only describe the most important steps, let me know if something is unclear.

  1. Start VirtualBox, click “New“. Enter a name, like “Windows 10“, select the right type and version of Windows and click “continue“.
  2. Adjust the RAM memory, 4 GB would be good if you have it. Click “continue“.
  3. Select “Create a virtual hard disk now“. Click “continue“.
  4. Select “VDI“, click “continue“. Then select “Dynamically allocated“. Select a file location. Then click “create“.
  5. Now, the new virtual machine shows up in the list. Right click on it, and select “Settings“. Go to “Storage” and click on the CD-ROM icon that says “empty” on the left side. Then, on the right side, click on the CD icon and select “Choose virtual optical disk file“. Now select a Windows installation ISO file that you can get from Microsoft. Then click “ok“.
  6. In the main window, select your Windows image and click “start“. Follow the regular Windows installation process. 
  7. Once Windows is installed, and running in the VirtualBox window, click in the top menu (on Mac OS) on “Devices” and select “Insert Guest Additions CD image“. Then install the guest additions on Windows. They will improve the graphics and overall functioning of your system. Windows should be working normally now.
  8. Download and install the Tytera CPS software from the download section of the Tytera website. Make sure you download the right version for your model (with or without GPS). There are also other websites that offer the Tytera software to download.

You should now have a working Windows image running on VirtualBox with the Tytera software installed.

Part 3: Creating and uploading a codeplug to your Tytera TYT MD380 / MD 390

Now you can open Tytera’s CPS software on the Windows image and create your own codeplug or use an existing one as a basis. Here is a good guide for this. Skip down to “Program in DMR ID” on the page.

Once your codeplug is ready, we can start to upload it to the radio. In my case, it did not work via Windows. (Though, you can try to connect your radio to the Windows virtual machine. If it works for you, please let me know.)

As a workaround, we can upload the codeplug via the Linux image used in Part 1. Here are the steps:

  1. Save the codeplug on a USB stick that is formatted with FAT32 and call it codeplug1.rdt Once done, remove the USB stick.
  2. Shutdown the Windows virtual machine.
  3. Start the tyt virtual machine with the md380 tools on it and wait until it booted up.
  4. Plug in the USB stick. You should now get an “error message” on Linux, which is actually good because it tells you the name of the USB stick in Linux.
    It says something like “[sdb] No caching mode page found.” (see screenshot below)
    sdb is the location of the USB stick, memorize it for a later step.
    (If your USB stick does not show up, click on the USB icon beneath the window and select the USB stick. Alternatively, set up a filter for the USB stick similar to the filter for the radio in part 1).
  5. Switch to root. Root is the administrator under Linux. Do this by entering “su“. Enter the password which is “tyt“.
  6. Now mount the USB stick, which will make it accessible on Linux. First create a directory for the USB stick. Run “mkdir /media/usb“. Then run the following command: “mount -t vfat /dev/sdb /media/usb“. Use the sdb from step 4. It could also be sdc or sdd and so on.
  7. Now the contents of the USB stick are located under /media/usb and you can copy the codeplug to the home folder. Do this by running “cp /media/usb/codeplug1.rdt /home/tyt“.
  8. Switch to the md380tools directory by running “cd /home/tyt/md380tools“.
  9. Run “umount /media/usb” to unmount the USB stick. Remove it afterwards.
  10. Now, connect the radio to the virtual machine and switch it on in normal mode. Check by clicking on the USB icon whether the radio has the “checkmark”. That means it can be seen by the virtual machine.
  11. Now we write the codeplug on to the radio. That is done by the command “./md380-dfu write /home/tyt/codeplug1.rdt“. After a few seconds, the codeplug is on your radio. Switch off the radio. Done!

Wrapping up

You should now have a working radio with the latest custom firmware and the codeplug of your choice. If you make changes to your codeplug, just rerun the steps from part 3.

If you need help, comment on the post below or check the following resources:

Good luck and 73!

How to install WordPress on a CentOS 7 / RHEL 7 server

This how-to explains the necessary steps to install WordPress, the popular blogging platform, on your own CentOS 7 server. Hosting WordPress yourself can have several advantages: It gives you full control over your setup, your learn something and in my case it also led to significant improvements in speed and responsiveness of my page.

When I tried to install WordPress on a CentOS 7 server myself, I discovered that many of the how-tos available on the Internet were either outdated or led to configuration issues. Some tutorials were also outright insecure. Therefore I decided to write a blog entry that sums it all up and leads to a reasonably secure and also performant web server for WordPress.

Overview: Install and configure Nginx, PHP, MySQL/MariaDB and SELinux on CentOS 7 to run WordPress

This guide will cover the following topics, which is basically setting up a LEMP-stack (=Linux, Nginx, MySQL, PHP) plus WordPress. In the end some thoughts on performance tuning and security will be given.

Overview and links to the different parts of this blog entry:
Prerequisites
How to install Nginx, the webserver
How to install MariaDB, a MySQL database
How to create a database in MySQL/MariaDB for WordPress
How to install PHP
How to configure Nginx for WordPress
How to install WordPress
How to configure SELinux to make it work with WordPress
How to install phpMyAdmin and secure it to manage the database
Performance and security tweaks for your setup

This guide is for CentOS 7, but it should also work wit Redhat Enterprise Linux RHEL 7. In addition, Fedora Linux should be similar as well.

In the future I will also include how to set up SSL for your server. That being said, this guide comes with no warranty. Feel free to comment below if you have feedback.

Prerequisites

The prerequisites are that you have a server with CentOS 7 installed. The initial server setup is explained very well in this guide.

Installation of NGINX

To install Nginx, you have to activate the Centos 7 EPEL repository:
sudo yum install epel-release

Continue reading

Asian Adventure: Jakarta – A Capital With Heart and Traffic

The second destination of the South-East Asia tour after Singapore was Jakarta, the capital of Indonesia.

Thunderstorms, Tropical Rain and White Light

The flight from Singapore to Jakarta takes about 2 hours. I flew with AirAsia in one of their brandnew Airbus A319/320. The space on the plane was similarly to Ryanair quite tight, however, you could buy a variety of warm food on the flight.

Street vendor selling fruit in Jakarta, Indonesia

Street vendor selling fruit in Jakarta, Indonesia

The Indonesian capital greeted me with thunderstorm and heavy, tropical rain. It was as if you put the shower on. The humidity was at 100%. Another thing I noticed from the car when leaving the airport: The lights you see are different from Europe. Mostly fluorescent neon lights are used that put everything into a cold, white/blueish light.

Not A Tourist City, Yet Much To Experience

Jakarta is not a tourist city. During the entire stay of about a week, I saw only a handful of visitors in some shopping malls. Jakarta is huge. More than 10 Million people live in this metropolis. What is interesting though, is that the Jakarta is divided into “cities within the city”. In European cities, you often have to go to the other end of the town to get something done. In Jakarta, everything you need is availably within your immediate area.

Flooded highway on the way from the airport into Jakarta

Flooded highway on the way from the airport into Jakarta

The huge amount of people also means that there is a lot of traffic. There is no subway system, hence everybody is using their car or a motorcycle to get from A to B. There is also an express bus system where the buses have their own lanes. Cars and motorcycles must not use the bus lanes, however, nobody seems to care and not even physical barriers seem to hinder cars driving there.

In addition to the sheer amount of cars, the traffic is also very dense. I was very suprised that I did not see any accident, especially since the motorcycles constantly overtake the cars. Timewise, it is quite usual to be 30 minutes in a traffic jam to drive 7 kilometers of road.

Everything Under 30 degrees Is Cold

In contrast to Singapore, many buildings in Jakarta are not fully air conditioned. The installed air conditioning vents make it just “less hot”. It also seems to me that Indonesians have a different sense of temperature: Everything below 30 degrees Celsius is perceived as “cold”.

Traffic in Jakarta - Bus express lane on the right

Traffic in Jakarta – Bus express lane on the right

Many things are less organized (or not organized at all) than in European cities. For example, there is a constant smell of fire in the air because there is always somebody burning something somewhere. Add to that the exhaust from the cars, the chemicals against the Dengue mosquitoes and the humidity and it feels “as if you are breathing cloth” as somebody said. However, I found the air to be not that bad, I had more problems with the heat.

City of Contrasts

Jakarta is also a city of contrasts. While on the one side you can see big luxorious villas with expensive cars parking there, you see on the other side also slums where people live in small hats by a river that carries the sewage water. On some highway entry roads, you also see day laborers waiting to get work for the day.

In other areas, Jakarta can easily match up with other big capitals. There are many restaurants and an extremely well-organized take away service. You can just call and after about 30 minutes someone comes and brings you the food right to your doorstep. Jakarta has also numerous shopping malls and they are top-notch, just like in Singapore or in the US. Prices for luxury goods are of course cheaper than in other cities, but still they cost money.

Another good point: I bought a 3G SIM card for my iPad to surf on the Internet. 3G was often faster than the Wifi offered in restaurants or domestic connections. I could even use it to call home with Skype.

Asian Adventure: Efficient Singapore

It finally happened. I went to a place, I never thought I would travel to. Too far away, too crowded, “out of area”. Or actually not: I travelled to South-East Asia. Singapore, Jakarta, Ubud.

This blog post is about the first destination: Singapore.

Marina Bay Sands Hotel in Singapore

Marina Bay Sands Hotel in Singapore

The Flying Sofa

The route went from Oslo to Copenhagen to Singapore. Singapore Airlines was the carrier of choice, and that choice was a good one: In Economy class on the Boeing 777-200 the seats were wide and the service superb.

Before takeoff, the flight attendands who are dressed in traditional Singaporean clothing handed out a menu. Showing like in a restaurant what would be served during the flight, food and drinks could be ordered anytime during the flight. Only the hot meals were served at fixed times.

The time during the 12 hour flight passed by quickly, partly thanks to the excellent choice of movies and music from the entertainment system. I have never flown a more comfortable airline than Singapore Airlines: The service was friendly, the food was excellent, and I could sleep on standard Economy seats. Hence, I called it the flying sofa.

Cheap, Humid and Crowded

I always thought “Asia is cheap, humid and crowded”. After landing in Singapore, I figured out it is actually true. Only that it is not that cheap. Prices in Singapore are only slightly lower than prices in Germany.

Since Asians tend to avoid the sun, and since it is too hot outside anyway, the main attraction are the city’s numerous shopping malls. Usually, the metro stops directly transition into a mall. You never know where the metro stop ends and where the mall begins and vice versa.

Popular in these malls are expensive European or American luxury brands. And since Singaporeans seem to have money, these boutiques are crowded. Second most important after the malls is the food: Every mall has a food court that offers a wide choice of Asian and Western food. Remember to NEVER order anything that is spicy. When they say it is “a little spicy”, it is usually too hot.

Otherwise, Singapore presents itself as a highly-efficient city. Everything is regulated, misbehavior like drinking or eating in the metro is heavily fined. The city is very clean. You never see litter lying around.

Heartless Efficiency?

This efficiency has only one drawback: It sometimes feels a bit heartless. If you have a problem that does not fit into the Singaporean’s “Standard Operating Procedures” you have lost.

The Metro "MRT" in Singapore. Highly efficient and very clean.

The Metro “MRT” in Singapore. Highly efficient and very clean.

Example: The Singapore Flyer is a kind of ferris wheel that allows you to see the city from above. “Last admission 22.15” it says on their website. Arriving at 22.07 at the ticket office, happy to have made it just in time before closing, I learn that the last ticket sale closes at 22.00. After kindly asking and only getting a “no” as an answer, I see that it is hopeless to get in and let go of this attraction. A visit is not possible for me.

50 Grades of Snow

When I grew up, I read somewhere that the Inuit had a large number of words to describe snow. At the time, snow was just snow for me – white and cold. After living in Scandinavia for a while, I start to understand the different types of snow and ice.

Slippery or not?

To know the types of snow and ice is important. It can help to answer the main question: Is the street slippery or not? When I first came to Scandinavia, I quickly realized that snow is not just snow. For example, when it is below minus 12 degrees, almost any snow that is on normal streets is very compact and hard, making it easy to walk. Just like on the normal asphalt.

If the temperature get warmer, the “ugly” range is from -3 until +2 degrees. Here the snow is not really melting yet, but instead becomes more fluffy and dangerously slippery. Above +2 degrees, it is so warm, that the snow is just wet. It is not nice to walk on, but it is less slippery similarly to when it is raining.

Icy road topped with sand to make walking easier

Icy road topped with sand to make walking easier

If the temperature then falls again and it freezes, the wet snow becomes ice. Then again it can become very slippery. Drops the temperature again below -5 even the icy parts are easier to walk on.

Snow clasification

This snow classification is of course not an exact science. To be able to describe the snow conditions is also important for skiing. After going on a cross-country tour, I was asked by a Norwegian colleague immediately how the snow was, how the top layer was, the consistency and all kinds of details I had never imagined.

To know the snow also shows that you are not an outsider. People who have just arrived and walk too slow and too careful immediately stand out.

Working in Norway: Dress code at the job

Wrote an article about the different ways to dress on the job in Norway as a man. It got published in one of Germany’s best news papers, Die Zeit:

Dress code in Norway - My article published in Die Zeit

Dress code in Norway – My article published in Die Zeit

The main point is basically that the dresscode in Norway is quite relaxed. Even at companies that are usually known for having a strict and formal dresscode in other parts of the world. You can read the article here in German: http://www.zeit.de/lebensart/mode/2013-01/leserartikel-norwegen-kleidung

Ubuntu 12.10 on the Asus F201E / X201E

Since I am currently over-saturated with Apple products (MacBook, iPad, iPhone, iPod – I have them all) or Windows products (at work), I was looking for a portable notebook to escape the Apple/Windows universe every now and then to play a bit with Linux.

Requirements were that the notebook had to be light and very cheap – the latter characteristic is also good for traveling because you don’t need to worry too much that the notebook gets stolen. The choice fell on the Asus F201E that is called X201E (http://www.asus.com/Notebooks/Versatile_Performance/X201E/) in the US.

Choppy YouTube videos with shipped Ubuntu
It came preinstalled with Ubuntu 12.04 64-Bit, however the performance of fullscreen HD Flash videos was very poor. Videos on websites like YouTube were displayed very choppy and sometimes also with a lag in the audio track. Therefore, I tried to install newer graphics drivers, tried several other tweaks and a few other Linux distributions – with no real improvement.

The Asus F201E running Ubuntu 12.10.

The Asus F201E running Ubuntu 12.10.

Fresh install of Ubuntu 12.10
Finally, I found out that my favorite distribution for better performance (less choppy Flash video) and usability for desktop use (installed fonts, installed Flash plugin, drivers, clearness of the user interface) was Ubuntu 12.10. The main trick here was to take the 32-Bit version and NOT the 64-Bit version although the processor supports it.

I used Linux Live USB creator on Windows to put the downloaded iso file from Ubuntu (link) onto a USB stick and make it bootable. I booted from the stick using the legacy BIOS option by pressing ESC during startup and then selecting the USB stick in the menu and not the UEFI boot option.

The UEFI install caused a lot of trouble and did not work, also with the other Linux distributions. To save time, I therefore opted for the good old BIOS option that seemed to work. I let Ubuntu partition the entire 500 GB harddrive. The installation went fine, only a few things had to be changed to make it work as before:

Minor tweaks necessary
For a few issues, some tweaks were necessary to fix them.

Brightness keys
After the installation, the keys for the brightness were not working. This could be fixed by editing the /etc/default/grub file and changing the line “GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” to “GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash acpi_osi=”. After running “sudo update-grub” in the terminal and rebooting, the keys were working again.

Network card not working
Besides, the ethernet controller was not recognized and did not work, while Wifi was functioning just fine. This could be fixed my installing the package linux-backports-modules-cw-3.6-quantal-generic. This package will install several other packages (depending on the current kernel used) and after running “modprobe alx” in the terminal as super user, the ethernet card was working also.

Asus software sources
The original Ubuntu that came with the Asus was using two special software sources, those I added again in 12.10. They were “http://asus.archive.canonical.com/updates precise-annan public” and “http://asus.archive.canonical.com/updates precise-annan public (Source Code)”. I don’t really know whether Ubuntu 12.10 is using any of these Asus packages, but for future reference, I just included them in this blog post.

System up and running
After fixing these few issues, Ubuntu 12.10 is running fine. Flash videos play more smoothly and everything seems to work just as intended. Speed-wise, the notebook naturally cannot compete with devices that have faster processors and are more expensive, but with this build quality it is a nice travel companion at the fraction of the price of a MacBook air.

Airbus A380 in Cologne

This Saturday, the world’s biggest passenger plane Airbus A380 made its first-time landing at Cologne-Bonn Airport (CGN/EDDK).

Since I was curious, I had to go and take some pictures. It turned out to be really crowded with all kinds of people. A mountain biker asked me on the way “Hey, do you know what is happening here?”. He thought there would be a kind of open air concert.

The Airbus finally touched down at around 17.30 local time and when it was over my head it was so huge that it did not really fit onto the photo. I was standing in the approach zone of runway 14L, a few hundred meters before the runway threshold (special thanks to this website). NRWeblog also took some photos.

Here are some pictures from the landing: