Cannot use WrPortI on PCDDR without breaking debugger

Hello Everyone,

I have a sample program I have pasted below and it runs and seems to set PCDDR to the correct value… but after a while, I get an error message saying: “While Debugging: Timeout while waiting for response from target.” If I have any long running threads or loops, this error message causes the debugger to detach and it is extremely frustrating. What am I doing wrong?

My version of dynamic C is 10.72. I have applied no patches.

#define VERBOSE
#memmap xmem

#class auto
#use rcm40xx.lib

   unsigned int Reg_Val = 0;

	brdInit();				//initialize board for this demo

   WrPortI(PCDDR, &PCDDRShadow, 0xFF);       // This does not work!
   //BitWrPortI(PCDDR, &PCDDRShadow, 1, 1); // This works!

   Reg_Val = RdPortI(PCDDR);
   printf("PCDDR: %u
", Reg_Val);

Look at Setting up digital IO in Dynamic C for Rabbit 4000 boards and newer in here

Hello edha,
I based my code off of this example and it was very helpful, but it does not solve my problem. I don’t understand why the debugger is detaching just because I set this 1 IO line.

try this code:
WrPortI(PCDDR, &PCDDRShadow, PCDDRShadow & 0xFF);

PC6 and PC7 are used for serial port A which is the port used by the debugger to communicate with the board. If you change the configuration of these pins the debugger can no longer communicate with the board.

WrPortI(PCDDR, &PCDDRShadow, 0xFF) sets all the port c pins to outputs.



This was indeed the issue. Thank you petermcs!