I try to print with serial. How can I print something without a format. I want to print it directly. If yes, which function should I call?
For example, What I am looking for: if I print "ABC", I receive only 41 42 43 and some padding zeros from the serial window.
My current situation is that when I try to print "EVA", what I get is "45 56 41 |EVA "
For this example, I print "EVA" by using the NRF_LOG_RAW_HEXDUMP_INFO(pointer of the data, 3);
Output from the serial window:
What you see in the PC application that you use, are both a listing of the hexadecimal values of the bytes sent over UART (e.g. "45 56 41") and the same data printed out as ASCII text (e.g. "EVA"). Those are two ways to display the same binary data (the three bytes that you send.) The specific format that you see in the application, is something that the application made. The data sent over UART was always the three bytes representing the ascii text "EVA".
Thanks for your reply, but I have tried to use NRF_LOG_RAW_INFO("ABC"); to print it as desired.
But the problem is how can I print the data from with a pointer. I tried to use .NRF_LOG_RAW_INFO(pointer), aiming to print the 'A' at the pointer. However, it fails.
The pointer points to the p.data of the scanned buffer. An"ABC" is saved in this scanned buffer. I tried to create a variable of char/uint8_t to store the data located by the pointer but I cannot get it printed correctly.
Can you aid me with how to cast this pointer into a printable string for the function NRF_LOG_RAW_INFO?
NRF_LOG_RAW_INFO does not take a pointer. The macros with HEXDUMP as part of the name do. Have a look at the macro listings in the Logger module documentation.
Note that all those macros are intended for logging. If you want to use the UART for normal serial communication, you should not go through the logger module. Please have a look at the UART Example and the BLE NUS examples, for how to use UART directly in your application.