Hi,
I woould just add that on Kinetis MCUs there is recommended to use the LDD component which are newer generation of component that should replace the legacy "high level components" like AsynchroSerial.
If you'd like to use buffering, the Serial_LDD allows to use your own string buffers. Here is a "from scratch" example that processes input by blocks of 10 characters, with interrupts enabled (otherwise you would have to call AS1_Main method of the component in your loop) :
Content in ProcessorExpert.c:
bool DataReceivedFlg = FALSE;
char OutData[] = "Hello!";
char SerialBuf[10];
char Received[10];
LDD_TError Error;
void main(void)
{
. . .
/* Start reception of a given number of characters (in this case 10), passing pointer to the buffer */
Error = AS1_ReceiveBlock(AS1_DeviceData, SerialBuf, 10);
for(;;) {
if (DataReceivedFlg) {
/* Do something with the data in Received string here. It only must take shorther than receiving other 10 characters.... */
/* clear flag */
DataReceivedFlg = FALSE;
/* you can for example reply something back */
Error = AS1_SendBlock(AS1_DeviceData, OutData, sizeof(OutData));
}
...
}
}
Content of Events.c:
extern volatile bool DataReceivedFlg;
void AS1_OnBlockReceived(LDD_TUserData *UserDataPtr)
{
/* just move received data for main loop processing */
memcpy(Received, SerialBuf, sizeof(Received));
/* Set DataReceivedFlg flag */
DataReceivedFlg = TRUE;
/* Start reception again */
Error = AS1_ReceiveBlock(AS1_DeviceData, SerialBuf, 10);
}
You can see some simple examples on the Typical usage page from from the Serial_LDD component help (you can invoke it using "Help on component" pop-up menu command):
To use the printf, there is necessary to add ConsoleIO component to the project which automaticalle (which uses an inherited Serial_LDD) as erich described in his nice tutorial ( Tutorial: Printf() with (and without) Processor Expert | MCU on Eclipse ).
best regards
Petr Hradsky
Processor Expert Support Team