P.E. TWR K70 BAREBOARD and STDIO REdirect

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P.E. TWR K70 BAREBOARD and STDIO REdirect

Jump to solution
1,206 Views
crezyoz
Contributor IV

Working on my first of 3 projects for the K70. I have a P.E. project running and I have been able to use an Async Serial component to send data back to a terminal. Now I would like to redirect STDIO out as well. Currently, printf statmements do who up in a CodeWarrior terminal but I would like to redirect all stdio to any port I wish.

 

Been searching for this solution for a few hours.. coming up short. Could really use an assist here.

 

Thanks!

 

Crezyoz.

0 Kudos
1 Solution
923 Views
ProcessorExpert
Senior Contributor III

Hi,

You can redirect the printf to serial port by redefining the following functions to use serial port:

 

int __read_console(__file_handle handle, unsigned char* buffer, size_t * count);

int __write_console(__file_handle handle, unsigned char* buffer, size_t* count);

 

You can find examples in the CW directory - MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K70FN1M

 

best regards
Petr Hradsky
Processor Expert Support Team

 

View solution in original post

0 Kudos
3 Replies
924 Views
ProcessorExpert
Senior Contributor III

Hi,

You can redirect the printf to serial port by redefining the following functions to use serial port:

 

int __read_console(__file_handle handle, unsigned char* buffer, size_t * count);

int __write_console(__file_handle handle, unsigned char* buffer, size_t* count);

 

You can find examples in the CW directory - MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K70FN1M

 

best regards
Petr Hradsky
Processor Expert Support Team

 

0 Kudos
923 Views
crezyoz
Contributor IV

Thank you for your response. I am not sure how to integrate that with the PE code I have for the K70. The only serial example I found was in the K40 folders.I am new to the K70 and even newer to PE so it's all somewhat of a mystery to me still.

 

 

I have successfuly been able to send output to the host using the USB serial connection form the K70 (UART2). But I can not receive any input from incoming characters sent from my terminal. Apparently there is a problem when attempting to use this ? SO I installed the TWR-SER board but it uses the same UART  as the USB serial setup on the K70-TWR.

 

So I am confused as to what to do next..

 

I have 3 products to get up and running soon. Is there another way to get faster help with things like this?

 

 

0 Kudos
923 Views
ProcessorExpert
Senior Contributor III

Look for example at the CRC demo project, the file is {CW MCU v10.2}\MCU\CodeWarrior_Examples\Processor_Expert\Kinetis\TWR-K70FN1M\CRC\Sources\ConsoleIO.c

 

best regards
Petr Hradsky
Processor Expert Support Team