In MCUXpresso-IDE, when I use CMSIS-DSP function: arm_dot_prod_q15() :
* I got a "q63_t" type data: result = 5 (I debug with break-point)
* But when I print with:
PRINTF("data: %X \r\n", result); ===> data: 430C0000 (It should be: data: 5)
So what is wrong, how to deal with "q63_t" data type?
Thanks!
Jerry
已解决! 转到解答。
Is your PRINTF being vectored onto the SDK DEBUGCONSOLE output (typically output via UART), or the C library's printf function (typically output via semihosting) ? See section 11.5 "Use of printf" of the MCUXpresso IDE v10.0.0 User Guide for more background on this.
Might be useful to see your actual project (use Quickstart Panel -> Export option), or at least see the content of your build console after doing a clean build.
Regards,
MCUXpresso IDE Support
I am somewhat confused by so many print functions.
But now I have more observations: (I am printing via UART, and just using templates from demo projects)
-----------------------------------------------------------------------------------------------------------
uint64_t v1=12;
uint32_t v2=34;
uint16_t v3=56;
PRINTF("values: %d %d %d \r\n", v2, v2, v3); ===> values: 34 34 56
PRINTF("values: %d %d %d \r\n", v1, v2, v3); ===> values: 536935956 12 0
-------------------------------------------------------------------------------------------------------------
So obviously (by the way, I am testing on board TWR-K60D100M):
* Printing 64-bit values messes up everything!
So how to fix this bug?
Thanks, but I tried both "%ld" and "%lld", all seem to be wrong code, it just print:
PRINTF("values: %lld %d %d \r\n", v1, v2, v3); ===> values: lld 536935956 12
So what is the correct format code for 64-bit value?
I have just run this code
uint64_t v1=12;
uint32_t v2=34;
uint16_t v3=56;
printf("values: %lld %d %d \r\n", v1, v2, v3);
printf("values: %d %d %lld \r\n", v3, v2, v1);
which gives this output
values: 12 34 56
values: 56 34 12
i.e. it works as expected.
* what IDE did you use?
* And did you print inside IDE? I use PRINTF to print to UART (SDK DEBUG CONSOLE).
(I guess PRINTF == printf if you print inside IDE. BUT it seems that printf can't print to UART!)
I used MCUXpresso IDE. Yes, I printed to the console. Suggest you try the same to track down the issue.
Your previous post was interesting. You said the output was
PRINTF("values: %lld %d %d \r\n", v1, v2, v3); ===> values: lld 536935956 12
i.e. the (underlying) printf you are using does not understand %lld formatting, which implies that it is incapable of printing 64 bit values. So, try using standard printf to print to the console, then gradually change other things until you find the issue.