Wednesday 23 August 2017

Eclipse Oxygen 4.7.0 with EmbSysRegView on Ubuntu 17.04

I recently reinstalled Ubuntu 17.04, and after reinstalling the regular STM32 tools (Eclipse C/C++, GNU MCU Eclipse, OpenOCD) I tried to install EmbSysRegView.

Normally I do this through the Eclipse Marketplace but it wasn't showing up when I searched for. Never mind; the EmbSysRegView website said I could install it manually:
Install the view by copying the jar files:
Get the latest jar files (you need both of them) from https://sourceforge.net/projects/embsysregview/files/
Simply copying to your eclipse plugins folder, and your done.

So I downloaded the four files and threw them in the /opt/eclipse/cpp-oxygen/plugins/ folder. But nothing appeared when searching in the "Window -> Show View -> Other..." Eclipse menu.

Searching online suggested restarting and running Eclipse with the -clean parameter (i.e. "./eclipse -clean").

Still nothing.

Searching further revealed that the correct place to place the EmbSysRegView .jar files is in the Eclipse /dropins folder (i.e. "/opt/eclipse/cpp-oxygen/dropins/").

After placing the files here, the EmbSys Registers view option appeared.


On a separate note, the majority of menu buttons weren't showing in eclipse until I added the following two lines below the "plugins" section of eclipse.ini file in the Eclipse install directory:
--launcher.GTK_version
2

Now I can easily switch perspectives since the quick switch buttons are visible!

Saturday 15 August 2015

Terasic DE0-Nano-SoC with Quartus II on Ubuntu: USB ID Problems

I had some trouble yesterday when I tried to connect my new Terasic DE0-Nano-SoC development board and program it using Quartus. The software couldn't see the on-board JTAG programmer, but was able to find my older device, the non-SoC version of the board.

My setup is as follows:

  • Ubuntu 14.04
  • Quartus II Web Edition 15.0.0.145 (Linux)
  • Terasic DE0-Nano-SoC Kit

One thing that confused the problem for me was that Quartus II doesn't load it's menu icons unless you run it as root. Initially I thought that running Quartus II as root might solve this problem, but it didn't.

Run as a normal user:









































Run as super user:






































After messing around with a few other things, I figured that it must have been a problem with the PC's device rules.
Checking the USB device IDs using the 'lsusb' command showed the following device:
Bus 002 Device 003: ID 09fb:6010 Altera
And checking the rules folder (/etc/udev/rules.d/) revealed the following file:
-rw-r--r-- 1 root  root   591 Aug 15 19:29 51-altera-usb-blaster.rules
which contained:
# Altera USB BlasterATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
This appears to work for the USB Blaster device on the DE0-Nano board, but not the SoC board.
So I changed the file to this:
# Altera USB BlasterATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
# Altera USB Blaster TerasicATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666"

and reloaded the rules with 'sudo udevadm control --reload'.
After this, Quartus was able to see the JTAG device...


....Well, at least, it was for a while.
I'm not sure exactly what happened. I didn't change the DIP switches on the board, or anything like that, but the USB ID changed from '09fb:6010' to '09fb:6810'. It stayed that way for a few power cycles (both PC and SoC board cycles), and then reverted to '6010'.

The only things I can think of that I did that may have changed the ID are:

  • Accidentally having multiple Quartus instances open at once
  • Killing and rebooting the jtagd process using the following commands:
    • sudo killall jtagd
    • sudo ps -A | grep jtag
    • ./jtagd            (run from the Quartus 'bin' directory)
    • ./jtagconfig    (run from the Quartus 'bin' directory)

However I still haven't been able to "force" the ID to change again by repeating these. As a temporary fix, I've added an extra rule to the file for the '6810' ID. I just hope it doesn't change to a third ID suddenly.

Friday 28 March 2014

Installing a Brother HL-2140 on Ubuntu 13.10 64-bit

When you let Ubuntu install a Brother HL-2140 printer, for some reason every print job will return an endless stream of blank pages. It seems to be a problem that's existed for quite a few Ubuntu versions, and while I'm not sure why they haven't fixed it yet (legacy hardware?), the solution on the relevant Brother support page seems to be lacking a key step for Ubuntu 13.10 compatibility.

The prerequisites for Ubuntu8.04 or greater are:
  1. "sudo aa-complain cupsd" command is required before the installation.
  2. "sudo mkdir /usr/share/cups/model" command (as it is) is required before the installation.
However, my system has no idea what "aa-complain cupsd" is. The solution is to install appamor-utils:
sudo apt-get install apparmor-utils
After this, I was able issue the prerequisite commands and proceed with the installation. I've seen a few people mention that you can simply install an HL-2140 as an HL-2170 and the problem should be fixed, but with 13.10 I couldn't see how to manually install a printer as one that Ubuntu has already recognised via the USB connection. Perhaps manual specification was easier in versions before 13.10.

Saturday 22 February 2014

Installing Altera Quartus II 13.0.0 Build 156 and Modelsim on Ubuntu 13.10 64-bit

So I thought the installation of Quartus was successful, and I'd finished writing a VHDL test bench, but when I went to launch the Model Sim simulation software from within Quartus I was shown an error message:
Can't launch ModelSim-Altera Simulation software -- make sure the software is properly installed and the environment variable LM_LICENSE_FILE or MGLS_LICENSE_FILE points to the correct license file.
Initially I thought this may have been a licencing issue, which would have been strange since I was using the free "Web Edition".
After searching for a while, similar problems were being experienced by others due to the ia32-libs libraries not being installed, but I wasn't able to install them (i.e. using "sudo apt-get install ia32-libs") since the package was not available.

The solution was to install a different package with the following command:
sudo apt-get install libc6:i386 lsb-core
However, when I tried to run Model Sim from the terminal (done by executing vsim from the /altera/13.0/modelsim_ase/linuxaloem/ directory) I was given another error:
error while loading shared libraries: libXft.so.2: cannot open shared object file: No such file or directory
This lead me to install libxft2:i386 with:
sudo apt-get install libxft2:i386
But Linux wasn't done preventing me from running Model Sim:
error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
And I wasn't done breaking down the barriers:
sudo apt-get install libncurses5:i386
After this the software launched correctly from terminal and also from within Quartus II. There's probably a simpler solution or package to install, so if anyone knows, that would be helpful. But for now it's working!

Tuesday 3 December 2013

Adding the Terasic USB Blaster to Ubuntu 13.10

When I tried to use my Terasic USB Blaster with Altera Quartus 13.0 tonight, the device was detecting but the JTAG programmer would report "fail" instantly upon attempting to program.

The problem was to do with the permissions device, and the following should fix that:

  • Create a new file called "terasic-usb-blaster.rules" in the "/etc/udev/rules.d/" folder
  • Simply add the following line to the otherwise empty file:
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="666"
Thanks to http://www.eecg.toronto.edu/~laforest/USB-Blaster-Debian.html for explaining this solution!

Adding a Launcher to the Launch Bar in Ubuntu 13.10

So I installed Altera Quartus 13.0 (the final version to support the Cyclone II FPGA I'm using), and either I forgot to add a shortcut, or it didn't choose to add one (I know 13.1 did everything for me).

Anyway, to create one, here's what I did:

  • Locate the executable (in this case "/opt/altera/13.0/quartus/bin/quartus")
  • Locate an icon (optional, in this case "/opt/altera/13.0/quartus/adm/quartusii.png")
  • Create a file in "/usr/share/applications" called <filename>.desktop (in this case "quartus.desktop")
  • Open it in an editor and configure as shown below (adjusting the fields like Name, Exec (the executable), Icon, and if you like you can change the applications's Categories field to make searching and grouping of applications easier):

[Desktop Entry]
Version=1.0
Name=Altera Quartus
Exec=/opt/altera/13.0/quartus/bin/quartus
Comment=Altera Quartus 13.0
Terminal=false
Icon=/opt/altera/13.0/quartus/adm/quartusii.png
Type=Application
Categories=IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=/opt/altera/13.0/quartus/bin/quartus
TargetEnvironment=Unity

  • Now the link with selected icon. should appear in your applications menu when you click the icon at the top of your launch bar. Simply drag this into the desired position on your launch bar. Easy.

(On a side note, If you have problems creating and saving in the applications folder like I did, just move the file from another directory with root access.)

Monday 19 August 2013

Cleared by Reading

It's been a while since my last update, and while I wish I had more to show off, I've been busy with... life. Back in July I resigned from my previous job, took a two week scuba and free diving holiday in Bali, I've just completed my third week with my new employer.



So anyway, I've decided to start tinkering again, and this afternoon I encountered something I hadn't really dealt with before. This debugging problem is pretty obvious when looking back, but had me stumped for half an hour.

I was trying to setup the RS-232 interface on a new development board, and I had to change the code to utilise USART6 instead of USART3 which I'd used previously. A library I had previously written uses interrupts to automatically store received characters into a FIFO buffer. However when I first changed the code to use the new peripheral, the buffer system wasn't working.

I set a breakpoint at the start of the "Read data register not empty" interrupt service routine, but it was never reached. The USART6 registers appeared to be configured correctly, so what else could it be? A few minutes later I realised what the problem was - the NVIC was not configured properly for this interrupt - and so once I had fixed, compiled and re-flashed the micro, I debugged again and this time when it ran the break point was reached. However, when I stepped through the code after the break point, I noticed that the check to see that the interrupt trigger was as expected (i.e. triggered by the RXNE flag) was not succeeding.

But what else could have triggered the interrupt? The RXNE interrupt was the only one currently enabled. Something strange was going on.

Then a strange thought occurred to me. I had all the USART6 registers 'exposed' for viewing in the 'EmbSys Registers' viewer in Eclipse. This plug-in allows easy viewing of all the DSP's registers, and it automatically reads the requested registers and presents them to the user whenever the processor is halted. I remembered the datasheet saying that the RXNE flag is cleared by a read to the USART's data register, DR.

Bingo.

Removing the breakpoint and placing a new one within the IF statement fixed everything, as did removing the DR register from the EmbSys Registers viewer. This is the kind of problem that could have stumped me for quite a while, but luckily I must have been thinking logically.