AnsweredAssumed Answered

memory leakage in mqx

Question asked by adt 123 on Apr 19, 2014
Latest reply on Apr 25, 2014 by Garabo

Hi All,

I am using mqx4.0.2

codewarrior 10.5

TWRK60F120M

In my project I used nandflash using FFS,usb,& 2 uarts(UART2-PTD2&PTD3),(UART3-PTE4&PTE5).when I used nandflash,I faced the problem of memory leakage & solved it as given in https://community.freescale.com/message/323494#323494.

but without nandflash also I see the memory leakage whenever I send data over uart or receive data from uart.I am not getting where is the problem.

Here is my uart initialization routine-

UART_INIT()

{

MY_ISR_STRUCT_PTR isr_ptr;

    isr_ptr = _mem_alloc_zero(sizeof(MY_ISR_STRUCT));

    isr_ptr->COUNTER = 0;

   

    PORTE_PCR4 = (uint32_t)((PORTE_PCR4 & (uint32_t)~(uint32_t)(

                      PORT_PCR_ISF_MASK |/*PORT_PCR_DSE_MASK|*/

                      PORT_PCR_MUX(0x04)

                      )) | (uint32_t)(

                      PORT_PCR_MUX(0x03)

                      ));                                 

     PORTE_PCR5 = (uint32_t)((PORTE_PCR5 & (uint32_t)~(uint32_t)(

                      PORT_PCR_ISF_MASK |

                      PORT_PCR_MUX(0x04)

                      )) | (uint32_t)(

                      PORT_PCR_MUX(0x03)

                      ));    

      SIM_SCGC4 |= SIM_SCGC4_UART3_MASK;                                  

      UART3_BDH = UART_BDH_SBR(0x00);       /*115200 baud rate*/                            

      UART3_BDL = UART_BDL_SBR(0x20);

 

     _int_install_isr(INT_UART3_RX_TX, ISR_UART3, isr_ptr);

     _bsp_int_init(INT_UART3_RX_TX, 3, 0, TRUE);

     _bsp_int_enable(INT_UART3_RX_TX); 

 

}

& isr routine

ISR_UART3(pointer user_isr_ptr)

{

MY_ISR_STRUCT_PTR  isr_ptr; 

   

    isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr; 

    isr_ptr->COUNTER++; 

    /*CHECK FOR RECEIVE DATA REG FLAG*/

    if(UART3_S1 & UART_S1_RDRF_MASK)

    {

        uCInpdata[uICounter]=UART3_D;

    }

}

Outcomes