Why Trace_Printf doesNOT work?

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

Why Trace_Printf doesNOT work?

跳至解决方案
2,436 次查看
aresmarser
Contributor III

Hi Sir,

I am working on NHS3100 with LPCXpresso.

I imported the project archive release_mra2_10_1_nhs3100.zip and tested the example projects such as "app_example_dp_i2c" to study I2C driver usage.

But here I met the problem that Trace_Printf doesNOT work.

It looks like the function "Trace_Printf" blocking the routine running.

I tried to disable "Trace_Printf" by adding a "return" statement in the begin of the function body as below:

---------

void Trace_Printf(const char *format, ...)
{

  return;

// ...

}

---------

and after that, the phenomenon disappears.

Could you help to review and advice how I should do or config something to let the original project "app_example_dp_i2c" run normally?

Many thanks,

Arna

标签 (1)
1 解答
2,077 次查看
driesmoors
NXP Employee
NXP Employee

Hi,

1. Yes, correct.

2. Enabling will redirect the datapipe to the SWD debugger interface - provided you link in the semihosting functionality by using the Redlib (semihost) library. So, yes.

Best,
Dries.

在原帖中查看解决方案

3 回复数
2,077 次查看
aresmarser
Contributor III

Hi Dries Moors,

Thank you for your reply.

I read the function "Trace_Printf" again and debug by breakpoint.

It looks the default "#define TRACE_DATAPIPE_I2C0 1".

So the function call the below code snippet:

---

        #if TRACE_DATAPIPE_I2C0 == 1
    I2CIO_Tx((const uint8_t*)Trace_formattedString, stringSize);
        #endif

---

1. As my understand, this should require a I2C peripheral to printf the message?

2. So I should undefine "TRACE_DATAPIPE_I2C0" and define "TRACE_DATAPIPE_SEMIHOSTING" to value "1" if I have no I2C device for printf pipe?

Thanks,

Arna

0 项奖励
2,078 次查看
driesmoors
NXP Employee
NXP Employee

Hi,

1. Yes, correct.

2. Enabling will redirect the datapipe to the SWD debugger interface - provided you link in the semihosting functionality by using the Redlib (semihost) library. So, yes.

Best,
Dries.

2,077 次查看
driesmoors
NXP Employee
NXP Employee

Hi, Is this problem resolved at your side? Looking at the other posts, I assume it is? Keep in mind that semihosting in combination with the Deep Power Down and Power-off modes will not work: the moment you lose the SWD debug connection, any semihosting print will halt the core indefinitely.

0 项奖励