Hi,
is there any Example to use the UART ? I need an monitor while the application is running, is the UART COM Port the right one for this?
Is there an example with the app_uart?
Best regards Nils
Hi,
is there any Example to use the UART ? I need an monitor while the application is running, is the UART COM Port the right one for this?
Is there an example with the app_uart?
Best regards Nils
You just need to add simple_uart.c to your project and include simple_uart.h headers.
I generally use:
simple_uart_putstring("Some text\r\n");
To send my debugging output.
If you're using the nRF51822-EK, configure the onboard USB UART with:
simple_uart_config (0, 9, 0, 11, false):
And set your baud rate on your terminal program to 38.4K and find the USB CDC serial port that should appear.
I'm embarrassed to say that I didn't even clue-in to the onboard CDC emulation at first :-/
Hope that helps.
-m
@Yalcim , connecting to printf is fairly well explained in the Keil documentation, but I don't know how to do it for GCC.
Although not a perfect solution, if you have simple_uart_putstring() working, then you can do this:
[b] uint8_t text_buffer[128];
sprintf( text_buffer, "Formatted answer %8d %8.3f\n\r",
intvar, floatvar);
simple_uart_putstring( text_buffer );[/b]
Yes the way Yalcin told you is the right way. You have to comment the #define out. If it does not work i can send you my code tomorrow.
Nils
@Philip, I tried using sprintf(). I confirmed that no problem about int type. but, the float type of the %f don't be seen on screen. How can I solve this problem?