Hello Andik,
If you are using BDM connection for in-circuit debugging, then you cannot share the BKGD pin with other I/O port. Since after reset, the BKGD pin becomes dedicated serial interface pin for the background debug mode. That's why you cannot share with other I/O pin when debugging. You can only use that pin for I/O port when standard alone (without in-circuit debugging).
By the way, what kind of debugger are you using? You may find some efficiency development in the following site:
http://www.softecmicro.com/index.html