puts()/printf() ends up at PE_DEBUGHALT() under MQX Lite

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

puts()/printf() ends up at PE_DEBUGHALT() under MQX Lite

1,134 Views
danielnagy
Contributor II

Dear Forum Members,

I am facing an issue with an FRDM-K22F development board, on which I am trying to run a simple MQX Lite application. I am using the following tools:

- Kinetis Design Studio 3.0

- Processor Expert

- MQX Lite

I have added the MQX Lite Processor Expert component and the ConsoleIO component to be able to write to the virtual COM port. I have 3 simple tasks in the MQX Lite environment, one of which is the following:

void Task1_task(uint32_t task_init_data)

{

    int counter = 0;

    puts("Task 1 has started to run!");

    while(1)

    {

        counter++;

        /* Write your code here ... */

        BLUE_ClrVal(0);

        _time_delay_ticks(50);

        BLUE_SetVal(0);

        _time_delay_ticks(50);

    }

}

When I try to debug the program via OpenOCD and Task1 starts, instead of writing to the serial console, it gets stuck at a piece of code in Vectors.c which looks like this:

PE_ISR(Unhandled_ivINT_Hard_Fault)

{

  PE_DEBUGHALT();

}

I created my program following this piece of MQX Lite training material: http://www.nxp.com/files/training/doc/dwf/DWF13_AMF_ENT_T1017.pdf

Some additional information:

- Same issue when trying to use printf()

- If I comment out the puts() line, everything works fine

- ConsoleIO is configured correctly: in Processor Expert projects without MQX Lite, printf()/puts() work fine with the same ConsoleIO settings

- In the CPU Processor Expert component, under Build options -> Generate Linker files, Stack size is set to 0x0400 and Heap size is set to 0x0C00

Could anyone please give me some advice? I have searched the Internet extensively and found nothing helpful except some tutorials explaining how to use printf() with Kinetis microcontrollers - based on these, I should be facing no issues at all. For example: https://community.freescale.com/servlet/JiveServlet/download/104349-3-290895/Printf_Console_UART_kds...

Your help is highly appreciated.

Thanks and regards

Daniel

0 Kudos
2 Replies

506 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

HI,

I suggest you read this article. it may help you.

How to use printf() to print string to UART in KDS3.0 + KSDK1.3


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

506 Views
danielnagy
Contributor II

Dear Jennie,

Thanks for your suggestion. I have read the article, but have two issues:

1.) I have followed the instructions in the article and added a single MQX Lite task:

void Task1_task(os_task_param_t task_init_data)

{

  /* Write your local variable definition here */

 

#ifdef PEX_USE_RTOS

  while (1) {

#endif

    /* Write your code here ... */

    printf("Hello!\r\n");

    OSA_TimeDelay(10);

#ifdef PEX_USE_RTOS  

  }

#endif   

}

When I run the application, it sometimes works fine, sometimes it doesn't - it seems to me, that this changed randomly even without changing a single line of code or any other setting. When it does not work, it simple prints nothing to the console. I have not yet been able to find out what causes this or how to fix it.

2.) This article does not really reflect to my original problem. If I don't use KSDK, then I have to substitute the component fsl_debug_console with ConsoleIO. In this case, it simply jumps to the PE_DEBUGHALT() line I quoted above. I did not find anything in the article that I could use to find out more about this problem.

Do you have any further suggestions? I highly appreciate your help.

Thnaks and regards

Daniel

0 Kudos