ADC1 freezes whole CPU

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ADC1 freezes whole CPU

2,418件の閲覧回数
FabianS
Contributor II

Hello,

I am trying to use the ADC1 on the Tower evaluation board with K60.

For initialisation I use the Processor Expert (see attetchment) and this is the start code:

[code]adc1Data=ADCPoti_Init(NULL);

ADCPoti_SelectSampleGroup(adc1Data, 0);

ADCPoti_StartLoopMeasurement(adc1Data);[/code]

 

After calling StartLoopMeasurement() the whole system hangs, not even the jtag debugger is able to pause the system. Interesting is, with disabled interrupt for ADC1 everything works fine, exept the interrupt of course. 

With interrupt enabled, the interrupt handler it is called once and never again. Is there something I have to do in the interrupt or what is my problem?

0 件の賞賛
返信
7 返答(返信)

1,810件の閲覧回数
Alex_HMBE
Contributor II

Installed CW MCU 10.2 this morning and they issue seems to be resolved.

0 件の賞賛
返信

1,810件の閲覧回数
ProcessorExpert
Senior Contributor III

Hello,

 

could you please post here the whole project that leads you to getting the error?

 

best regards
Vojtech Filip
Processor Expert Support Team

0 件の賞賛
返信

1,810件の閲覧回数
FabianS
Contributor II

Of course. I atteched the whole Eclipse project.

He should create a sine wave on DAC0_OUT and toggle the Pin PTC1 each time the ADC interrupt handler is called.

The ADC0 runs in free run mode, capturing the state of the poti of the tower board (ADC1_DM1).

The main loop will create the sine wave with a frequency depending on the ADC value.

0 件の賞賛
返信

1,810件の閲覧回数
ProcessorExpert
Senior Contributor III

We have reproduced the same behavior, the project freezes after a while. It seems that the problem is related to usage of floating point math and interrupts. I have reproduced the same behavior with new simple project containing just one timer interrupt and main loop containing floating point expression and assignment.

As a workaround it seems to work to disable interrupts as you did or removing floating point calculation.

I have asked compiler team to check this issue.

 

best regards
Petr Hradsky
Processor Expert Support Team

0 件の賞賛
返信

1,810件の閲覧回数
emh203
Contributor II

Any news on this?   I notice that my system has been crashing during a floating point operation.   I have narrowed it down to the floating point operations but I can't seem to make it happen on demand

0 件の賞賛
返信

1,810件の閲覧回数
HummingbirdElec
Contributor I

Hi

 

We are seeing a similar thing using floating point trig.  The CPU seems to freeze along with the debugger.  Has there been any progress in resolving this?

 

Thanks, Norman

0 件の賞賛
返信

1,810件の閲覧回数
FabianS
Contributor II

It seems that this is a problem of my main loop:

[code]    while(1)
    {
        //Cpu_DisableInt();
        DA1_SetValue(dac1Data, (((uint16_t)((sin(dacX)+1.0)*2047.0))&0x00000fff));
        dacX+=((double)adc1_value)/255.0*0.04;
        if(dacX>2*3.14159265)
            dacX=0.0;
        //Cpu_EnableInt();
        for(i=0; i<10000; i++)
            asm("nop");
        //GPIOD_PTOR = (1<<6);
    }[/code]

 

With this code the cpu crashes after a few seconds, uncommenting the Cpu_DisableInt() and Cpu_EnableInt(); functions solves this problem. I tryed to find out which command is responsible for that but it seems like all commands are. Is it a problem with the floating point operations? Maybe they are not interruptable? Any idea?

0 件の賞賛
返信