Code formatting in AVR Studio 5

I discovered that AVR Studio 5.1 doesnt always work in relation to code formatting. I searched for bugs and found a number of places where Atmel has replied that they are working on fixing this. However, until this happens a nice work around using an external tool can be used.

This is how to setup the external tool AStyle which is on SourceForge and free.

  1. Download AStyle and unzip it somewhere you like
  2. Open AVR Studio 5
  3. Go to: Tools->External Tools…
  4. Add a tool and fill in the fields:
    1. Title = AStyle
    2. Command: full path to C:\\…\AStyle.exe
    3. Arguments: -y –indent=tab –style=ansi –errors-to-stdout –suffix=none $(ItemDir)$(ItemFileName)$(ItemExt)
      1. If you like the code formatted differently you can check the AStyle documentation
    4. And finally check the Use Output Window, so it doesnt popup a new windows every time you run it.
  5. Now we need to setup a key binding for it like Ctrl+Shift+F and make the document reload automatically when formatted
    1. Goto Tools->Options
      1. Locate Environment->Keyboard in the left tree
      2. Then fund the command: Tools.ExternalCommand1 (assuming you only have one external tool specified)
      3. Assign a Ctrl+Shift+F to it as global. And the key binding is complete.
      4. Locate Environment->Document
        1. Check “Auto-load changes, if saved”
  6. That’s it enjoy

Upgrading firmware on STK500 with AVR Studio 5

Aparently AVR Studio 5 does not support upgrade of the STK500 through the Tools->AVR Tools Firmware Upgrade so here is how it can be done manually.

Since the AVR Prog program is not distributed with the Atmel Studio installer anymore. There is a separate installer for a set of command line tools which also includes AVR Prog.

  1. Make sure the command line tools are installed
  2. Power off the Atmel STK500
  3. On the STK500, push the PROGRAM button while turning on the power.
  4. Make sure there is a serial connection between the PC and the STK500 DSUB9 marked RS232 CTRL
  5. Start ‘AvrProg.exe’. The default installation location is C:\Program Files\Atmel\AVR Tools\AvrProg\AvrProg.exe or C:\Program Files (x86)\Atmel\AVR Tools\AvrProg\AvrProg.exe on 64-bit OS.
  6. Locate the firmware upgrade hex-file stk500.ebn by pushing the Browse button in the Avr Prog Hex File window. The path for the stk500.ebn for a normal Atmel Studio installation is C:\Program Files (x86)\Atmel\AVR Studio 6.0\tools\STK500\STK500.ebn.
  7. Push the Program button in the Avr Prog Flash window. A progress bar will now appear while showing additional information messages. Wait until the verify operation is finished.
  8. Close the Avr Prog program
  9. Power off and on the STK500 PCB. The STK500 is now ready to be used with the new firmware.

Source

This can also be used if write of board settings vent wrong and communication isn’t possible from AVR Studio anymore.

Adding a new Key Fob to a VW Touran 2007

This will explain how to buy a new (or used) key fob and program the remote to the car.

It is worth mentioning that programming the immobilizer is not really a thing you can do you self unless you have all the required codes which you properly don’t have do to the way VW manages these now a days.

Before you go on to ebay or else where to find a new key there is a few tings that you need to know. Two numbers must match the key you are searching for, that being:

  1. Remote part number.
    This number indicated what frequency the key uses e.g:

    • HLO 1K0 959 753 A – 434MHz for mobel PR-5D1
    • HLO 1K0 959 753 B – 315MHz for model “J..”: PR-5D3
    • HLO 1K0 959 753 C – 315MHz for model “ROK”: 5D5
    • HLO 1K0 959 753 D – 315MHz
    • HLO 1K0 959 753 G – 434MHz
  2. The type of immobilizer
    This is a number similar to: 5FA 009 263-10
The part numbers can be found on the back of the remote part when dissembled from its metal key part.
Key for a VW Touran

Key for a VW Touran

VW key not for a VW touran but with easy readable part numbers

If only you remote is broken and the car still is able to start. Then the old immobilizer can just be assembled with a new remote part. (Saving you for the expensive programming at a VW dealer)
More info about keys can be found in this post.

Programming

This is only a guide to program the remote control part of the key e.g the part with the 3 buttons (on the right below) – NOT the immobilizer with the metal key (on the left).

VW Generic Programming of Remote Controls

  1. Place your first key into the ignition and turn to the second notch (do not start the car)
  2. Now close the door and place your second key into the handle lock
  3. Turn the key to the lock position and let it spring back to the central position.
  4. Hold down the Lock button on your new remote, you may hear a bleep from the car
  5. Now unlock the car using the key in the barrel and remove, then take your first key out of the ignition
  6. Close the door
  7. Your remote should now be coded

VCDS Procedure for matching radio-frequency remote controls

The VCDS matching guide is available here.

However this guide didnt quite work for me. I just wanted to add a single new (already used for another car, which type is not known to me other than it was a VW) key to the car but the procedure shown below didn’t allow me to save a 2 in the new value. If I pressed Test it will then just come back and allow me to Test again and not Save. So I had to save 0 in channel 0 to reset it. This deleted all FOBs associated with the car and enabled me to start over and save 2 as the new value indicating two new keys. VCDS

  1. Place the key to program in the ignition and turn it (do not start the engine)
  2. [46 – Cent. Conv.]
    1. [Adaption – 10]
      1. Read channel 1
      2. Change the Test Value to 1 (The guide says it should be the number of keys but any value except one doesn’t work for me)
      3. Hold in UNLOCK on the key until confirmation (in my case by the turn lights)
      4. That’s it exit VCDS and turn of the car the remote should work now as well as your old one(s)
Tagged with: , , ,

Unlocking Webasto Aux. Heater on a VW Touran

The Webasto Aux. Heater can be unlocked through VCDS. It may be come locked do to a broken water pump or simply failed starts.

The heater is locked if it reports the following fault code:

205935
00 0018 03 1232 thermo top v 12v /42 w 5kw

Saturday,05,November,2011,16:56:54:21701
VCDS Version: Release 10.6.5
                Address 18: Aux. Heat       Labels: None
Control Module Part Number: 1K0 815 071 R
  Component and/or Version: Zuheizer        050 2302
           Software Coding: 0000011
            Work Shop Code: WSC 01324 785 00200
                      VCID: 346C9F582EA0
1 Faults Found:

02251 - Heater Unit Locked
            000 -  -
             Freeze Frame:
                    Fault Status: 01100000
                    Fault Priority: 2
                    Fault Frequency: 1
                    Reset counter: 145
                    Mileage: 204126 km
                    Time Indication: 0

The heater can be unlocked through VCDS by:

  1. Selecting the “Select Control Module” option and then
  2. Select the Aux. Heater:
  3. And then select the Adaptation:
  4. The save 1 in channel 42.
    1. That’s it.
    2. Clear the fault codes and read them again and you should not get the heater locked fault any more.
Tagged with: , , ,

VW Webasto water pump test using VCDS

The Webasto water pump can be tested through the VCDS program for VW cars.

The idea is to activate the pump when the car engine isn’t started, this way it will be possible to listen to the front right side of the bumper to determine if the pump is running.

The following steps will guide you through the steps to start the pump:

  1. Connect the VCDS cable and turn the ignition key to power up the instrument panel
  2. Open VCDS and click the “select control module” button
  3. Then select “Aux. Heat”
  4. Then select “Output tests”
  5. The next dialog is a step-vice guide to activate different components associated with the aux heater
  6. Press next and activate and go to the front of the car and listen:
    1. If no new summing sound appears the pump is broken. Look at this post on how to replace the pump.
    2. If a summing sound starts and stops again when continuing the guide the pump is most likely working correct.

 

Tagged with: , ,

VW Touran Webasto Thermo Top V Water pump renewal

This post will explain how to change the water pump attached to the Webasto aux heater on a VW Touran.

Determining if the water pump is broken

Before explaining how to get a new pump or replace it lets look at how to see if the pump is the one to blame for your cold car.

The heater should turn on if you start the car and the temperature is less then 11 degrees Celsius (<11) and the ECON light is off in the climate control. Beside when this is the case you should be able to heat a faint summing from the lower right of the bumper (thats the pump) , if you dont try to use VCDS to read out error codes, if you get something like this error your pump is most likely broken:

Address 18: Aux. Heat        Labels: None
   Part No: 1K0 815 071 R
   Component: Zuheizer        050 2302
   Revision: 00050000    Serial number: 09009839000000
   Coding: 0000011
   Shop #: WSC 01324 785 00200
   VCID: 346C9F582EA0

1 Fault Found:
01415 - Recirculating Pump (V55)
            010 - Open or Short to Plus
             Freeze Frame:
                    Fault Status: 01101010
                    Fault Priority: 3
                    Fault Frequency: 2
                    Reset counter: 126
                    Mileage: 203208 km
                    Time Indication: 0

             Freeze Frame:
                        OFF
                    Temperature: 33.0°C
                    Temperature: 70.0°C
                    Voltage: 12.00 V

Future more see this post on testing the pump.

Where to buy a new pump

There is a number of options here:

  1. Go to your local VW dealer and pay a lot of money or..
  2. Look for a new pump with almost the same spare number but different output directions

The pump is actually now a VW manufactured pump but from Webasto and it happens to be the case the they only use a few different pumps where the pip outlets are different angled.

This means that you can go and search for a new pump with pare number: 7E0.965.561

 New Water Pump dissambly

If you chose to buy a water pump that has a different angled outlet the outlet needs to be removed and replaced with the one already installed in the car, here are a few pictures:

(In my case I didn’t remove the pipes from the old pump outlet. I just unscrewed the screws and were a bit quick to remove the old pump and re-install the new one without loosing much cooling liquid)

The pump is different in its connection as the original one since it comes with a connector instead, here is a picture of the old pump wire:

 

The old wire can just be cut off and with advantage extended about 10 cm and attached to the connector for the new pump. If wired wrong the pump will not turn at all.

  • black wire to pin 1
  • brown wire to pin 2

 

 

 

Installation

The installation required the front bumper to be removed, which is quite easy and quick even though it should like a lot of work.

  1. Open the hood
  2. unscrew the 4 screws holding the plastic/metal part with the VW logo and the number plate
    1. pull it strait out
  3. now pull out the lower black plastic part covering the lower part of the cooler. But be care full now to damage your temperature sensor if you have one (right side just under the screw you tool out)
  4. new to the actual bumper
    1. each wheel box has 3 screws pointing forward into the bumper and 1 which goes up/backwards. They must all be removed
    2. then pull out the bumper to the right/left of the car such that it clips out of the guide
    3. under the front of the car there is a number of screws as well starting from the one attaching a plastic rod.
    4. if all screws are removed you should be able to un-clip the 4 clippers which is located under the first plate you removed. Gently push them down and the bumper should slide nicely forward and off.
      1. be careful not to damage the wires on the right side of the bumper and the springler pipe on the left

Assembly is in the opposite order.

You may wish to loosen the sprinkler tank to get more space releasing the pump wires.

Installing the new pump

The old pump is just loosened from its holder and pipes can be detached or the pump outlet can be unscrewed (the cooling liquid is quite lubricating so avoid too much of this on you hands and tools).

Before re-installing check the following

  1. Check the exhoust of the heater – the material should be non corroding but clearly not the case here:
    1. Also check the springler o’rings, the pipe can be seen on the picture above just behind the water pump if the car is old the o’ring might be hard and not sealing properly making the springler liquid leek after assembly.

Final result

The result after a new pump + exhaust and sprinkler o’rings:

Finally:

You might want to unlock the heater, see this

And thanks to http://vw-touran.dk/Ny%20vandpumpe%20i%20tilskudsvarmer.html for the guide and idea about the cheaper pump.

Tagged with: , , ,

Eclipse Adding License To Source Files

Eclipse provides a good tool for applies copy right headers to source files, it can also replace one ones if the file already contain a copyright header.

The tool can be installed from the eclipse update site and is called:

  • Eclipse Releng Tools
Another tool which might be useful is: Eclipse Copyright Generator, it can be installed from the updatesite:
The latter plugin adds
  • a new Panel in the preferences (global or project based) with: Menu > Windows > Preferences > General > Copyright.
  • a Menu Menu > Project > Apply Copyright…
  • a realy nice Wizard with a lot of options and some default template for Open-Source licence (Apache, EPL, …)

Source of this post

 

JUnit test with dynamic number of tests

This can be done as follows in JUnit 3:

public class XTest extends TestCase {

    public File file;

    public XTest(File file) {
        super(file.toString());
        this.file = file;
    }

    public void testX() {
        fail("Failed: " + file);
    }

}

public class XTestSuite extends TestSuite {

    public static Test suite() {
        TestSuite suite = new TestSuite("XTestSuite");
        File[] files = new File(".").listFiles();
        for (File file : files) {
                suite.addTest(new XTest(file));
        }
        return suite;
    }

}
And for JUnit 4:
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class TestY {

    @Parameters
    public static Collection<Object[]> getFiles() {
        Collection<Object[]> params = new ArrayList<Object[]>();
        for (File f : new File(".").listFiles()) {
                Object[] arr = new Object[] { f };
                params.add(arr);
        }
        return params;
    }

    private File file;

    public TestY(File file) {
        this.file = file;
    }

    @Test
    public void testY() {
        fail(file.toString());
    }

}

Here is a link to another discussion on stack overflow link

Tagged with:

Java Regular Expressions

Here is a nice guide for regular expressions in Java:

http://www.vogella.de/articles/JavaRegularExpressions/article.html

Open shared calender in Exchange webmail 2010

To open a shared calender you need to have access and the following commands:

https://webmail.iha.dk/owa/<mail address of the calender owner>/?cmd=contents&module=calendar

 

Views Links
Calendar View – Default – Daily https://<server name>/owa/<SMTP address>/?cmd=contents&module=calendar
Calendar View – Daily https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Daily
Calendar View – Weekly https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Weekly
Calendar View – Daily – Specific Date by specifying Date, Month and Year 

https://<server name>/owa/<SMTP address>/?cmd=contents&f=Calendar&view=Daily&d=3&m=7&y=2009 

Where…

d=[1-31]
m=[1-12]
y=[four digit year]

See more at: http://exchangeshare.wordpress.com/2009/06/15/how-to-open-shared-calendar-in-owa/

Tagged with: , ,
Top