STM32373 question for programming

I have a board with a STM32 con this problem:

I put the oscilloscope probe on the R161:

Works fine

It doesn't work fine

The problem is software:
After the waveform the level sometimes remains to 1.
Here the code for wave form:

void pwm_uC_init()
{

cc_buzz.frequency = 1000000;
cc_buzz.callback = NULL;
cc_buzz.dier = STM32_TIM_DIER_CC2IE;
cc_buzz.cr1 = 0;
cc_buzz.cr2 = 0;
cc_buzz.egr = 0;
cc_buzz.smcr = 0;
cc_buzz.ccmrx[0] = STM32_TIM_CCMR1_OC2M(6);
cc_buzz.ccmrx[1] = 0;
cc_buzz.ccer = STM32_TIM_CCER_CC2E;
cc_buzz.ccrx[0] = 0;
cc_buzz.ccrx[1] = 487; number of usec to lev 1 (50% to level 1)
cc_buzz.ccrx[2] = 0;
cc_buzz.ccrx[3] = 0;

gptStop(&GPTD5);
gptStart(&GPTD5, &cc_buzz);
}

void pwm_uC_buzzStart(){
gptStartContinuous(&GPTD5, 974); waveform number of usec
}

void pwm_uC_buzzStop(){
gptStopTimer(&GPTD5);
}

void pwm_uC_buzz(bool __en){
if(__en){
pwm_uC_hal_buzzStart();
}else{
pwm_uC_hal_buzzStop();
}
}

Here the timer:

void Keyb::manager()
{
int i;
KeyA::keyReadingValues_t keyRead;

for (i = 0; i < getKeysNumber(); i++)
{
m_keys*->manager();*
if (m_keys*->pop(keyRead))
_
{_
if (keyRead == KeyA::KEY_PRESS)
_
{_
push(m_keys->keyNumber());
if(m_keys->beepIsEnable())
_ {_
m_keys->beep();
if(m_pfBeep != NULL)
_ {_
m_buzzTimer.preset(100); 100msec timer*

(m_pfBeep)(true);
_ }
}
}else*

* {
}
}
}_

if(m_buzzTimer.match())
_ {_
m_buzzTimer.stop();
if(m_pfBeep != NULL)*

(*m_pfBeep)(false);
Anyone can help me for solve this problem?

One pretty big problem is that you're missing both your setup() and loop() functions. It almost looks like you're not even using the Arduino IDE, but I'm sure you would have told us if that was the case!

Sorry you are right, no, Arduino IDE.
I'm new what does it need?

I think it would be worth reading this post to get an idea of the sort of information you need to give us if you want help.
This statement doesn't really clear things up:

lex5555:
Sorry you are right, no, Arduino IDE.