Printf error on MQX Lite

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

Printf error on MQX Lite

1,501件の閲覧回数
wendersonolivei
Contributor IV

Hi all,

I'm using the MQX Lite on my FRDM KL25Z.

I'm having a problem with printf inside a loop. This is the code:

void Initial_task(uint32_t task_init_data)

{

  uint32 ptr;

  #ifdef DEBUG

  for(ptr = 0; ptr < 10; ptr++)

  {

       printf("\n"); //Clear terminal

  }

  printf("\n< start >\n\n");

  #endif

  HardwareInitialize();

  printf("\n> Hardware Initializated\n");

  SetAudio(2);

  for(;;)

  {

      int i;

      if (LED_GetVal())

      {

           printf("\nLED on");

           _time_delay_ticks(2000);

      }

  }

The printf inside the "for" isn't working. When I run that code, the program stops at PE_ISR(Cpu_ivINT_Hard_Fault).

I can make it work by removing the printf function from loop. But, why that isn't working at this loop?

Thanks

タグ(2)
0 件の賞賛
返信
4 返答(返信)

1,250件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Wenderson.

can you please upload your demo project here? I will test it.

Please also let me know your CW version: Start the IDE and click on Help | About CodeWarrior Development Studio. Send me the version and build id.

ZhangJun

0 件の賞賛
返信

1,250件の閲覧回数
wendersonolivei
Contributor IV

Hi Zhang

I'm using CW 10.6,  Build Id:140329.

A demo project with this same error is attached.

Regards

0 件の賞賛
返信

1,250件の閲覧回数
anthony_huereca
NXP Employee
NXP Employee

Does it work if you put the loop after the HardwareInitialize() call? It may be that the HardwareInitialize turns on the clock gating for the UART module, and if you try to use the UART module before that it would cause a hard fault like you're seeing. Try moving it to after it.

-Anthony

0 件の賞賛
返信

1,250件の閲覧回数
wendersonolivei
Contributor IV

Hi Anthony

Sorry, I did not express myself correctly... the "printf" that isn't working is from the second "for". The hardware initialize function just set IO ports, the UART module is initialized by PEx.

0 件の賞賛
返信