Hi all,
There is somebody that has implemented the "printf("")" with IAR for CC2530?
I need the "printf" to print floats and hex to the UART.
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Igor,
Thank you very much for the answer. There are two functions, and I heve a doubt with debug_msg():
1. debug_msg(). Is this function for print only values of 3 variables (max)? I don't understand the function.
2. debug_str(). only for text messages.
Thanks.
Joaquim Martinez said:1. debug_msg(). Is this function for print only values of 3 variables (max)? I don't understand the function.
This function will build and send a message to MT_TASK event_process_loop, this message
can contain up to 3 UINT16 type variables.
Joaquim Martinez said:2. debug_str(). only for text messages.
Well, you may not pass to this function a buffer with ascii character, however the buffer must
be a null terminated. Though in general I think the main purpose of this function is for text msgs.
Hey,
Well, since I have pointed you to this kind of solution, I must clarify several things:
You must know that the functionality you are seeking for is a small part of the
debug_trace+mt_task modules in Z-stack
So be patient, and go step by step, try to use some inverse engineering methods.
One more suggestion, is to use Ctrl+Shift+F search options, this will perform a
search through entire project, listing search results, which makes it much easier to
trace thing back and forth. In the end, I think, you'll be able to write some printf() like
code for embedded 2530. :)
Good luck
Hi Igor,
Yes I have seen that is a small part of no simple debug_trace+mt_task modules in Z-stack.
I was looking for a function more flexible, I need print text and varible at the same time with conversion variables capatibility (like %u, %d, %3w, etc.) like printf.
I know "Ctrl+Shift+F" seach options, is basic in TIMAC and ZSTACK. I have experience :)
Thanks.
Hi Antonio,
Yes. It was more simple than the expected.
I just redefined the standar output of RS232.
If you uses the putchar(), this function send by the default port the data. As you know the inconvenient is you need to do previous conversions, etc.
But if you redefine the putchar function as below, you will use the printf normally (conversions types and it uses putchar to send). You don't need to do nothing more.
It works fine!
Hope this help.
/*********************************************************
* @fn Redifinició de la sortida estandar pel printf
*/
__near_func int putchar(int caracter)
{
return (int)HalUARTWrite(0, (uint8 *) &caracter, 1);
}
Hi Joaquin,
Where I have to redefine the putchar function ? in studio.h file or in the application files?
Could you send me an e-mail? I'm from Spain and I would like (if you want) to ask you about your experiences with cc2530 SoC.
Regards, Antonio Rosa.
You can #include <stdio.h> and use sprintf, then output the string with debug_str. That will give you the string formatting functionalities of printf.
Hello,
Thank you very much for your message!
I am trying the same, I put the "printf" at the same point of SimpleBLEPeripheral example, no errors and warnings occur but I cannot see anything at the Terminal I/O!
Could you please give me the settings you follow or to send me the .zip file of the example you are executing, please ?
I use BLE Stack 1.4.1 and attachment is my example to use printf in SimpleBLEPeripheral.