MQX Timer loop

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MQX Timer loop

688 次查看
elsoft
Contributor I

Hi all

I need help

I have developed a project based on a Freescale MCF52259

I used to develop Codewarrior 7.2 e MQX 3.6

In the project use an interrupt IRQ7, serial communication and a timer.

The timer triggers an interrupt every 50 ms and operates a number of variables related to the time

IRQ7 set 1 to a variable

The main when he sees the variable to 1 enables a serial communication (Interrupt mode)

My problem is that some time the timer interrupt go to loop.

This does not happen if IRQ7 and serial communication are never activated.

any ideas?

Below is the code.

Main()

{

MCF522XX_EPORT_STRUCT_PTR eport_reg_ptr ;

//IRQ7

eport_reg_ptr = (pointer)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->EPORT[0]);

_int_install_isr (MCF5225_INT_EPORT0_EPF7, (void (_CODE_PTR_))P3_IRQ7, (pointer)eport_reg_ptr);

_mcf5225_int_init(MCF5225_INT_EPORT0_EPF7, BSP_EPORT0_EPF7_INT_LEVEL, BSP_EPORT0_EPF7_INT_SUBLEVEL, TRUE)

//TIMER

_timer_create_component(TIMER_DEFAULT_TASK_PRIORITY, TIMER_STACK_SIZE);

realck = _timer_start_periodic_every((pointer)P3_realck,event_ptr,TIMER_KERNEL_TIME_MODE, 50L);

//COMM

MQX_FILE_PTR Seriale1 = (pointer)fopen("ittya:", NULL);

//interupt ricezione

_int_install_isr(BSP_UART0_INT_VECTOR,(pointer)P3_Read_Comm1,Seriale1);

}

void P3_Read_Comm1(uint_8 P3_HeadNow)

{

char UART_REGISTER;

vuart = (MCF52XX_UART_STRUCT_PTR)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[0]);

//read

P3_BufferRx[ContCarRX]=vuart->READ.URB;

P3_LastChar=vuart->READ.URB;

UART_REGISTER = vuart->READ.USR;

ContCarRX++;

}

void P3_Write_Comm1(char buff[])

{

uint_32 x=0;

char temp;

P3_LastChar='!';

P3_Memcpy0(P3_BufferTx,buff);

vuart = (MCF52XX_UART_STRUCT_PTR)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[0]);

ContCarTX=0;

ContCarRX=0;

while (1)

{

if (P3_BufferTx[ContCarTX]==0x00) break;

vuart->WRITE.UTB=P3_BufferTx[ContCarTX];

while(1)

{

temp = vuart->WRITE.UIMR && 0x01;

if (temp == 0x01) break;

}

x=0;

if (P3_BufferTx[ContCarTX]=='\n') break;

ContCarTX++;

}

}

标记 (4)
0 项奖励
回复
0 回复数