How to log console data from LPC804?

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

How to log console data from LPC804?

952 Views
mbra16
Contributor II

I'm working on a project where a sensor measures distance. I'm using an LPC804 on an eval board, and I figured if I flash the MCU I could use PuTTy (or another COM port sniffing tool) to read the measurements. 

I use the standard printf("%u", var) where "var" holds the value of the measurement in mm. 

I flashed the MCU so the IDE would'nt block the COM port, but I still can't read anything from the MCU via PuTTy or other programs.

I'm confident that PuTTy is set up right, so it must be something on the MCU side, that is not working correctly.

This is the first time I'm working with a "real" MCU, (read: not an Arduino/raspberry pi), and I wonder if there's some setup, that I need to do? I have added the following to my pin_mux.c file:

void BOARD_InitPins(void)
{
    CLOCK_EnableClock(kCLOCK_Swm);

    /* USART0_TXD connect to P0_4 */
    SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_4);

    /* USART0_RXD connect to P0_0 */
    SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_0);

    /* Disable clock for switch matrix. */
    CLOCK_DisableClock(kCLOCK_Swm);
}

I found the above code in the example code, that is mentioned below. It didn't do the trick. I also chose the SDK debug console to be UART console in stead of semihosting.

As a bonus info I can say that I tried out the "lpc_i2c_polling_b2b_transfer" example. In the readme file it stated that one simply can use PuTTy to read what's being sent from master to slave and vice versa. I was also unsuccesful in trying to catch the communication between master and slave in this example, so I must have missed something.

Any tips or hints is appreciated a lot!

Tags (2)
0 Kudos
3 Replies

861 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Martin,

Could you please confirm what IDE you are using and the version.

Also in the meanwhile could you additionally attempt to run the "helloworld " example from the SDK examples.

Are you using the LPCXpresso804 evaluation board?

Best Regards,

Sabina

0 Kudos

861 Views
mbra16
Contributor II

Hello Sabina,

Yes, I am indeed using the eval. board you linked to. I can run the "helloworld" example fine. It actually outputs the printfs in PuTTy. 

I'm using MCUXpresso v 11.0.1

Can you maybe give me a hint as to what's done in the helloworld example to make it work with a COM port sniffer?

0 Kudos

861 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Martin,

So first I'd recommend to make sure that the initialization of the uart pins you are using is correct. In the helloword as well as in the i2c example you mention above. The uart pins that are being used are from PORT E pin 0 and 1. you can find the configuration inside the BOARD_InitPins(void) function of the examples.

Next the printf, that you are describing is not done in lowercase letters it is PRINTF this actually is a macro for a function called DbgConsole_Printf which you will find inside the fsl_debug_console.c file. This is configured in our SDKs to redirect it to your debug serial console using uart.

For example if your project has the UART debug console settings, this code snippet will look like this on console.

pastedImage_3.png

If you change the settings for the project to semihosting settings, the same code snippet will look like this on the semihosting console.

pastedImage_1.png

You can change the console settings in the Quickstart Panel -> Quick Settings -> SDK Debug Console

As you can see the UART settings will print only with the PRINTF macro as this is configured to output through UART. For semihosting it is different and you may refer to the MCUXpresso IDE user manual for more info.

In addition, you should not have problems printing the variables from your %u, var variable using PRINTF.

Best Regards,

Sabina

0 Kudos