Why Trace_Printf doesNOT work?

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

Why Trace_Printf doesNOT work?

Jump to solution
2,331 Views
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

Labels (1)
1 Solution
1,972 Views
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.

View solution in original post

3 Replies
1,972 Views
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 Kudos
1,973 Views
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.

1,972 Views
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 Kudos