Hello, everyone,
I am trying to get the printf() function working (I am using the MSCAN driver example as a start point, since will need CAN communication later.)
I have followed couple tutorials, such as Tutorial: Printf() with (and without) Processor Expert | MCU on Eclipse, but I got no luck.
I have used PE to configure ConsoleIO, compiled the program, no error. Flashed into the KEA128, open putty, baud rate 38400. nothing shows on screen.
I have attached my project here, any help is appreciated!
Alan
Original Attachment has been moved to: MSCAN_KEA128.zip
已解决! 转到解答。
Hello Alan,
I ever made console printf demo with TRK-KEA board. it works fine on my side.
there is two points we need to pay attention:
1. to have accurate serial baud rate: if clock ICS mode is FEI, I trim slow internal reference clock to 37.44k. this will get accurate SCI baud clock:
bus clock= 37.44k*1280/2=47.932M
SCI baud rate = bus clock/39/16=38400
you needn't set baud rate as accurate as above, but if the result deviates more, the output to screenshot through SCI is messy code per my test.
2. choose right UART port for consolveIO based on the board design.
for example, I use TRK-KEA board, according to schematic, Open SDA CDC uses KEA128 UART2. if you use other UART, CDC can't work.
I attached my testing code. ConsoleIO functions works well with my TRK-KEA board, baud rate is 384000.
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Alan,
I ever made console printf demo with TRK-KEA board. it works fine on my side.
there is two points we need to pay attention:
1. to have accurate serial baud rate: if clock ICS mode is FEI, I trim slow internal reference clock to 37.44k. this will get accurate SCI baud clock:
bus clock= 37.44k*1280/2=47.932M
SCI baud rate = bus clock/39/16=38400
you needn't set baud rate as accurate as above, but if the result deviates more, the output to screenshot through SCI is messy code per my test.
2. choose right UART port for consolveIO based on the board design.
for example, I use TRK-KEA board, according to schematic, Open SDA CDC uses KEA128 UART2. if you use other UART, CDC can't work.
I attached my testing code. ConsoleIO functions works well with my TRK-KEA board, baud rate is 384000.
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi, Jennie,
Thanks for explaining, I found I was using the wrong UART port. I am trying to trim the Slow internal reference clock to 37.44k in my project, but it won't let me, every time I input the value, it just goes back to its original which is 32.768k. How could I change this setting?