Detect BDM connection at runtime in MCF51AC256

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detect BDM connection at runtime in MCF51AC256

995 Views
antoniomagrì
Contributor II

I am trying to find a way to detect the presence of a debug connection at runtime. The idea is to use this with a custom implementation of assert() that would cause a break (via the HALT instruction) if the debugger is connected. The reason for this is that HALT will cause a reset if no debug connection is present and I want to avoid that. I found that in the S08 core I can test the DBGEN bit in DBGC (Debug Control) register, but there seems not to exist anything similar in the Coldfire V1.

 

Has anyone found a way to detect the presence of the debug interface at runtime?

 

Thanks,

 

Antonio

Labels (1)
Tags (2)
0 Kudos
4 Replies

673 Views
TomE
Specialist II

You might be able to have the debugger write a special value to a RAM location, and have the code check for that value.

Tom

673 Views
miduo
NXP Employee
NXP Employee

Hi,

Unfortunately for ColdFire V1 it is not possible for the processor to detect when the BDM is attached. The pins related with the BDM are out of the memory map so the processor cannot read those pins. And there has no register bit for this purpose.

673 Views
TomE
Specialist II

Have the assert call a function that has the ONE COPY of the HALT instruction in it.

The  from the debugger, set a breakpoint on that function (and therefore on the HALT instruction).

So when the code fails the asserts and goes to call the HALT function it ends up in the debugger.

Tom

0 Kudos

673 Views
antoniomagrì
Contributor II

Thanks for the response,

as for the idea of using a special ram location to check for "debugger connected" condition, I will try that, if it can be done automatically that would be a plus...

The purpose of the HALT instruction was to actually not need a breakpoint added, so in that case I could just not use HALT and set the debugger to break on the failed assertion function call.

Thanks again,

Antonio

0 Kudos