MPC5748G project can only run in single-step mode while debugging but not in full-speed mode

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

MPC5748G project can only run in single-step mode while debugging but not in full-speed mode

Jump to solution
1,345 Views
mahoneinsh
Contributor I

Dear NXP supporter:
Development enviroment of the project is:S32DS_Power_v2017.R1, PE multilink universal
Simple function introduction: Using eMIOS module to generate 2 PWM waveforms with different intial phase(0°,180°). So i wrote a function to change related registers as below:
void EMIOS_ResetUCCnt(void)
{
eMIOS_MCR_SET_FRZ(INST_EMIOS0_MC,1);
REG_WRITE32(&eMIOS[0]->UC[PWM1_eMIOS_CHN].CNT,0);
REG_WRITE32(&eMIOS[0]->UC[PWM2_eMIOS_CHN].CNT,500);
eMIOS_MCR_SET_FRZ(INST_EMIOS0_MC,0);
}
Description of the problems encounterred in my project:

(1) If the above function "EMIOS_ResetUCCnt()" is executed by single-step in debugging mode, the 2 PWM pulses output successfully with different phase. But run it at full-speed without breakpoint, the PWM fail to change their phases.

Figure1. Single-step running

mahoneinsh_0-1663406803675.png

Figure2. Single-step running result (different phases)

mahoneinsh_2-1663406881932.jpeg

Figure3. full-speed running

mahoneinsh_3-1663406984818.png

Figure4. full-speed running result (same phases)

mahoneinsh_4-1663407017970.jpeg

(2) If preprocessors related to second core(DEBUG_SECONDARY_CORES、TURN_ON_CPU1) is added to the project, and run it at full-speed mode, the PWM output is correct(figure 2).

(3) Base on step (2), the rountine ran successfully in debugging mode, but then stopped debugging mode and restarted the board, the PWM output is wrong(figure 4).

From my understanding, the root reason of the problems is :

whether function  "EMIOS_ResetUCCnt()" is successfully executed or not.  why preprocessors of second core affects the first core.

Could you please give me some hint? thank you in advance. 

The project program is attached below.

Thank you again~

@ lukaszadrapa

0 Kudos
Reply
1 Solution
1,248 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

here is the reason:

lukaszadrapa_0-1663684140760.png

 The FRZ/FREN take effect only in debug mode:

lukaszadrapa_1-1663684462572.png

If you single step over these commands, the device is in debug mode. But if you click on Run button, it's not considered as debug mode.

Regards

Lukas

 

View solution in original post

0 Kudos
Reply
6 Replies
1,319 Views
mahoneinsh
Contributor I

I've made some further tests, found that:

the following 2 instructions must be ran by single-step, or it will fail to modify the corresponding registers.

 REG_WRITE32(&eMIOS[0]->UC[PWM1_eMIOS_CHN].CNT,0);
 REG_WRITE32(&eMIOS[0]->UC[PWM2_eMIOS_CHN].CNT,500);

0 Kudos
Reply
1,249 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

here is the reason:

lukaszadrapa_0-1663684140760.png

 The FRZ/FREN take effect only in debug mode:

lukaszadrapa_1-1663684462572.png

If you single step over these commands, the device is in debug mode. But if you click on Run button, it's not considered as debug mode.

Regards

Lukas

 

0 Kudos
Reply
1,233 Views
mahoneinsh
Contributor I

I‘ve print the DBG_MODE bit of MC_ME->GS register which indicates whether the chip is in debug mode, found that chip was in normal mode while debugging. 

mahoneinsh_0-1663726545796.png

mahoneinsh_1-1663726742825.png

 

 

0 Kudos
Reply
1,241 Views
mahoneinsh
Contributor I

lucas,

Thank you for your reply~

So, is it achievable to enter debug mode by software when running in normal mode?  Could you  give me some reference? Thank you~

0 Kudos
Reply
1,225 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

No, that's not possible. And as the description suggests, it's not expected use case to modify the CNT in this way. It's possible to do that in debug mode for debug purposes but not in runtime.

Regards,

Lukas

0 Kudos
Reply
1,213 Views
mahoneinsh
Contributor I

Lucas,

Thank you very much~

Your comments are really  helpful for me. I've verified that chip goes into debug mode with debugger. Maybe i should find another way to realize the expected function.

Regard,

Mahone

0 Kudos
Reply