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 Team,
There's an issue from the customer need your help:
I'm using SCI, because the data is hex, Serial Port Printing cannot be visually viewed using the Serial Port Assistant, so need to use printf to achieve data converting. For example, when printf is achieved, code:
Uint8 a=0XC8;
printf("\n\r 0X9F= %x\n\r",a);
Serial Port Assistant view: 0xF9 = C8
If regular serial port are used then the scenario is:
SCIA_TX('\n');
SCIA_TX('\r');
SCIA_TX(0XC8);
In Serial Port Assistant normal view just continuing line break without any other information,
when use hex view it prints: 0A 0D 63 38, which are ASCII hex value of '\n' '\r' 'C' '8' respectively.
I rewrote the int fputc(int _c, register FILE *_fp) to try to get to the first effect as shown above.
but when i use printf("\n\r 0X9F= %x\n\r",a) it just shows 0X9F=, no C8 following.
why is this happening? How to fix this?
code:
/*
printf() 重定义相关 about redefine
*/
/*
int fputc(int _c, register FILE *_fp)
{
Uint8 tx=_c;
while (SciaRegs.SCICTL2.bit.TXEMPTY == 0) {} //等待输出完成 wait for output complete
SciaRegs.SCITXBUF=(Uint16)tx; //必须右对齐 must right-justified
while (SciaRegs.SCICTL2.bit.TXEMPTY == 0) {} //等待输出完成
return 1;
}
*/
Could you help check this case?
Thanks & Regards,
Ben
Hi Ben,
Has the customer allocated the appropriate stack size? Please refer to this thread for more details: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/420808/sprintf-with-f28069
Best Regards,
Marlyn