S12 BDMPod detection in App

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

S12 BDMPod detection in App

Jump to solution
1,192 Views
fmiku
Contributor III

Hello,

There is any possible way to detect a connected BDMPod to the controller in a runing firmware ?

My target is realtime bypassing of the wai and stop instructions while debugger are connected.

I very rarely using the debugger and I always stuck on same problem.

Because my firmware uses wai and stop the debugger can't connect and/or freezes when thh processor going to sleep.

so I always spend of hours to finding the problem, why de debugger is freezes....

I know I'm stupid a little...

My another question is, any easy way to disable all interrupts when I stopped and using trace command ?

currently im mods the CCR by hand to disable the interrupts.

I'm using BDMPod with Firmware: 6.0.0b17, Bootloader Version: 2.0.6 with S12G, S12VR, S12XS processors.

1 Solution
996 Views
RadekS
NXP Employee
NXP Employee

Hi Ferenc,
Unfortunately, my experiences with LFBDMPGMR are quite limited.
 
I am afraid that BDM connection is not the right tool for debugging MCU which going into stop mode.
The clocks are disabled and BDM connection lost in that case.


I think that you probably need some tool for real-time debugging. I would like to recommend for example Freemaster:
http://www.nxp.com/products/power-management/wireless-charging-ics/freemaster-run-time-debugging-too...
You may read/modify/write variables/register/… during run-time. It typically uses some serial channel like SCI for communication.
The disadvantage is that you need to implement and service serial driver in your code.

Note: The CPU can not enter a low power mode (stop or wait) during BDM active mode.


Yes, you may set I bit for mask all I-bit maskable interrupts.
Currently, I do not have any other idea how to do a different way.
Note: If your application uses COP, I would like to recommend trying to set RSBCK bit for stop the COP and RTI in Active BDM mode.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

3 Replies
996 Views
kef2
Senior Contributor V

Hi Ferenc,

Since most of BDM debuggers most of the time start the debug session from resetting target into special single chip mode, you may detect it like this

      // wasn't BKGD pulled low at poweron / reset?

      if(MODE & MODE_MODC_MASK)
      {
             // no, it was high and not pulled low by BDM dongle

             // ,normal operating mode, we can WAI...

              asm("WAI");
       }

996 Views
fmiku
Contributor III

Hi Edward,

It's an awsome idea !

works perfectly, Thank you ! :smileyhappy:

0 Kudos
Reply
997 Views
RadekS
NXP Employee
NXP Employee

Hi Ferenc,
Unfortunately, my experiences with LFBDMPGMR are quite limited.
 
I am afraid that BDM connection is not the right tool for debugging MCU which going into stop mode.
The clocks are disabled and BDM connection lost in that case.


I think that you probably need some tool for real-time debugging. I would like to recommend for example Freemaster:
http://www.nxp.com/products/power-management/wireless-charging-ics/freemaster-run-time-debugging-too...
You may read/modify/write variables/register/… during run-time. It typically uses some serial channel like SCI for communication.
The disadvantage is that you need to implement and service serial driver in your code.

Note: The CPU can not enter a low power mode (stop or wait) during BDM active mode.


Yes, you may set I bit for mask all I-bit maskable interrupts.
Currently, I do not have any other idea how to do a different way.
Note: If your application uses COP, I would like to recommend trying to set RSBCK bit for stop the COP and RTI in Active BDM mode.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------